From ea21a47edab5d3b1908023d62fc9fa220ab4d4e5 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 13:20:28 +0100 Subject: [PATCH 01/12] Delete all the vendored packages. This commit breaks tests, but it bundles the large deletions into a single commit. This makes it easier to understand the later commits that made this change. --- .../_vendor/backoff-2.1.2.dist-info.pyi | 1 - .../_vendor/backoff-2.1.2.dist-info/INSTALLER | 1 - .../_vendor/backoff-2.1.2.dist-info/LICENSE | 21 - .../_vendor/backoff-2.1.2.dist-info/METADATA | 393 --- .../_vendor/backoff-2.1.2.dist-info/RECORD | 16 - .../_vendor/backoff-2.1.2.dist-info/REQUESTED | 0 .../_vendor/backoff-2.1.2.dist-info/WHEEL | 4 - opensafely/_vendor/backoff/LICENSE | 21 - opensafely/_vendor/backoff/__init__.py | 30 - opensafely/_vendor/backoff/_async.py | 187 - opensafely/_vendor/backoff/_common.py | 120 - opensafely/_vendor/backoff/_decorator.py | 222 -- opensafely/_vendor/backoff/_jitter.py | 28 - opensafely/_vendor/backoff/_sync.py | 131 - opensafely/_vendor/backoff/_typing.py | 43 - opensafely/_vendor/backoff/_wait_gen.py | 86 - opensafely/_vendor/backoff/py.typed | 0 opensafely/_vendor/backoff/types.py | 6 - opensafely/_vendor/google.pyi | 1 - opensafely/_vendor/google/api/__init__.py | 0 .../_vendor/google/api/annotations.proto | 31 - .../_vendor/google/api/annotations_pb2.py | 48 - opensafely/_vendor/google/api/auth.proto | 232 -- opensafely/_vendor/google/api/auth_pb2.py | 124 - opensafely/_vendor/google/api/backend.proto | 182 - opensafely/_vendor/google/api/backend_pb2.py | 71 - opensafely/_vendor/google/api/billing.proto | 75 - opensafely/_vendor/google/api/billing_pb2.py | 67 - opensafely/_vendor/google/api/client.proto | 99 - opensafely/_vendor/google/api/client_pb2.py | 59 - .../_vendor/google/api/config_change.proto | 84 - .../_vendor/google/api/config_change_pb2.py | 78 - opensafely/_vendor/google/api/consumer.proto | 82 - opensafely/_vendor/google/api/consumer_pb2.py | 71 - opensafely/_vendor/google/api/context.proto | 89 - opensafely/_vendor/google/api/context_pb2.py | 68 - opensafely/_vendor/google/api/control.proto | 32 - opensafely/_vendor/google/api/control_pb2.py | 54 - .../_vendor/google/api/distribution.proto | 211 -- .../_vendor/google/api/distribution_pb2.py | 142 - .../_vendor/google/api/documentation.proto | 162 - .../_vendor/google/api/documentation_pb2.py | 82 - opensafely/_vendor/google/api/endpoint.proto | 68 - opensafely/_vendor/google/api/endpoint_pb2.py | 56 - .../_vendor/google/api/error_reason.proto | 397 --- .../_vendor/google/api/error_reason_pb2.py | 66 - .../_vendor/google/api/field_behavior.proto | 90 - .../_vendor/google/api/field_behavior_pb2.py | 62 - opensafely/_vendor/google/api/http.proto | 375 -- opensafely/_vendor/google/api/http_pb2.py | 82 - opensafely/_vendor/google/api/httpbody.proto | 81 - opensafely/_vendor/google/api/httpbody_pb2.py | 57 - opensafely/_vendor/google/api/label.proto | 48 - opensafely/_vendor/google/api/label_pb2.py | 57 - .../_vendor/google/api/launch_stage.proto | 72 - .../_vendor/google/api/launch_stage_pb2.py | 54 - opensafely/_vendor/google/api/log.proto | 54 - opensafely/_vendor/google/api/log_pb2.py | 57 - opensafely/_vendor/google/api/logging.proto | 80 - opensafely/_vendor/google/api/logging_pb2.py | 67 - opensafely/_vendor/google/api/metric.proto | 264 -- opensafely/_vendor/google/api/metric_pb2.py | 115 - .../google/api/monitored_resource.proto | 118 - .../google/api/monitored_resource_pb2.py | 123 - .../_vendor/google/api/monitoring.proto | 105 - .../_vendor/google/api/monitoring_pb2.py | 69 - opensafely/_vendor/google/api/quota.proto | 183 - opensafely/_vendor/google/api/quota_pb2.py | 112 - opensafely/_vendor/google/api/resource.proto | 238 -- opensafely/_vendor/google/api/resource_pb2.py | 91 - opensafely/_vendor/google/api/routing.proto | 461 --- opensafely/_vendor/google/api/routing_pb2.py | 75 - opensafely/_vendor/google/api/service.proto | 172 - opensafely/_vendor/google/api/service_pb2.py | 80 - .../_vendor/google/api/source_info.proto | 31 - .../_vendor/google/api/source_info_pb2.py | 57 - .../_vendor/google/api/system_parameter.proto | 95 - .../google/api/system_parameter_pb2.py | 82 - opensafely/_vendor/google/api/usage.proto | 95 - opensafely/_vendor/google/api/usage_pb2.py | 68 - .../_vendor/google/api/visibility.proto | 111 - .../_vendor/google/api/visibility_pb2.py | 102 - .../google/cloud/extended_operations.proto | 150 - .../google/cloud/extended_operations_pb2.py | 79 - .../google/cloud/location/locations.proto | 108 - .../google/cloud/location/locations_pb2.py | 129 - .../_vendor/google/gapic/metadata/__init__.py | 0 .../gapic/metadata/gapic_metadata.proto | 92 - .../gapic/metadata/gapic_metadata_pb2.py | 144 - .../_vendor/google/logging/type/__init__.py | 0 .../google/logging/type/http_request.proto | 95 - .../google/logging/type/http_request_pb2.py | 57 - .../google/logging/type/log_severity.proto | 71 - .../google/logging/type/log_severity_pb2.py | 55 - .../_vendor/google/longrunning/__init__.py | 0 .../google/longrunning/operations.proto | 247 -- .../google/longrunning/operations_grpc.py | 19 - .../google/longrunning/operations_grpc_pb2.py | 15 - .../google/longrunning/operations_pb2.py | 42 - .../google/longrunning/operations_pb2_grpc.py | 341 -- .../google/longrunning/operations_proto.py | 5 - .../longrunning/operations_proto_pb2.py | 196 -- .../_vendor/google/protobuf/__init__.py | 33 - opensafely/_vendor/google/protobuf/any_pb2.py | 26 - opensafely/_vendor/google/protobuf/api_pb2.py | 32 - .../google/protobuf/compiler/__init__.py | 0 .../google/protobuf/compiler/plugin_pb2.py | 35 - .../_vendor/google/protobuf/descriptor.py | 1224 ------- .../google/protobuf/descriptor_database.py | 177 - .../_vendor/google/protobuf/descriptor_pb2.py | 1925 ----------- .../google/protobuf/descriptor_pool.py | 1295 ------- .../_vendor/google/protobuf/duration_pb2.py | 26 - .../_vendor/google/protobuf/empty_pb2.py | 26 - .../_vendor/google/protobuf/field_mask_pb2.py | 26 - .../google/protobuf/internal/__init__.py | 0 .../protobuf/internal/api_implementation.py | 112 - .../google/protobuf/internal/builder.py | 130 - .../google/protobuf/internal/containers.py | 710 ---- .../google/protobuf/internal/decoder.py | 1029 ------ .../google/protobuf/internal/encoder.py | 829 ----- .../protobuf/internal/enum_type_wrapper.py | 124 - .../protobuf/internal/extension_dict.py | 213 -- .../protobuf/internal/message_listener.py | 78 - .../protobuf/internal/python_message.py | 1539 --------- .../google/protobuf/internal/type_checkers.py | 435 --- .../protobuf/internal/well_known_types.py | 878 ----- .../google/protobuf/internal/wire_format.py | 268 -- .../_vendor/google/protobuf/json_format.py | 912 ----- opensafely/_vendor/google/protobuf/message.py | 424 --- .../google/protobuf/message_factory.py | 185 - .../_vendor/google/protobuf/proto_builder.py | 134 - .../_vendor/google/protobuf/pyext/__init__.py | 0 .../google/protobuf/pyext/cpp_message.py | 65 - .../_vendor/google/protobuf/reflection.py | 95 - opensafely/_vendor/google/protobuf/service.py | 228 -- .../google/protobuf/service_reflection.py | 295 -- .../google/protobuf/source_context_pb2.py | 26 - .../_vendor/google/protobuf/struct_pb2.py | 36 - .../google/protobuf/symbol_database.py | 194 -- .../_vendor/google/protobuf/text_encoding.py | 110 - .../_vendor/google/protobuf/text_format.py | 1795 ---------- .../_vendor/google/protobuf/timestamp_pb2.py | 26 - .../_vendor/google/protobuf/type_pb2.py | 42 - .../_vendor/google/protobuf/util/__init__.py | 0 .../google/protobuf/util/json_format_pb2.py | 72 - .../protobuf/util/json_format_proto3_pb2.py | 129 - .../_vendor/google/protobuf/wrappers_pb2.py | 42 - opensafely/_vendor/google/rpc/__init__.py | 24 - opensafely/_vendor/google/rpc/code.proto | 186 - opensafely/_vendor/google/rpc/code_pb2.py | 63 - .../_vendor/google/rpc/context/__init__.py | 0 .../rpc/context/attribute_context.proto | 343 -- .../rpc/context/attribute_context_pb2.py | 223 -- .../_vendor/google/rpc/error_details.proto | 249 -- .../_vendor/google/rpc/error_details_pb2.py | 250 -- opensafely/_vendor/google/rpc/status.proto | 47 - opensafely/_vendor/google/rpc/status_pb2.py | 57 - opensafely/_vendor/google/type/__init__.py | 0 .../_vendor/google/type/calendar_period.proto | 56 - .../google/type/calendar_period_pb2.py | 54 - opensafely/_vendor/google/type/color.proto | 174 - opensafely/_vendor/google/type/color_pb2.py | 57 - opensafely/_vendor/google/type/date.proto | 52 - opensafely/_vendor/google/type/date_pb2.py | 54 - opensafely/_vendor/google/type/datetime.proto | 104 - .../_vendor/google/type/datetime_pb2.py | 71 - .../_vendor/google/type/dayofweek.proto | 50 - .../_vendor/google/type/dayofweek_pb2.py | 54 - opensafely/_vendor/google/type/decimal.proto | 95 - opensafely/_vendor/google/type/decimal_pb2.py | 54 - opensafely/_vendor/google/type/expr.proto | 73 - opensafely/_vendor/google/type/expr_pb2.py | 54 - opensafely/_vendor/google/type/fraction.proto | 33 - .../_vendor/google/type/fraction_pb2.py | 54 - opensafely/_vendor/google/type/interval.proto | 46 - .../_vendor/google/type/interval_pb2.py | 57 - opensafely/_vendor/google/type/latlng.proto | 37 - opensafely/_vendor/google/type/latlng_pb2.py | 54 - .../_vendor/google/type/localized_text.proto | 36 - .../_vendor/google/type/localized_text_pb2.py | 54 - opensafely/_vendor/google/type/money.proto | 42 - opensafely/_vendor/google/type/money_pb2.py | 54 - opensafely/_vendor/google/type/month.proto | 65 - opensafely/_vendor/google/type/month_pb2.py | 59 - .../_vendor/google/type/phone_number.proto | 113 - .../_vendor/google/type/phone_number_pb2.py | 67 - .../_vendor/google/type/postal_address.proto | 134 - .../_vendor/google/type/postal_address_pb2.py | 54 - .../_vendor/google/type/quaternion.proto | 94 - .../_vendor/google/type/quaternion_pb2.py | 54 - .../_vendor/google/type/timeofday.proto | 44 - .../_vendor/google/type/timeofday_pb2.py | 54 - ...gleapis_common_protos-1.56.4.dist-info.pyi | 1 - .../INSTALLER | 1 - .../LICENSE | 202 -- .../METADATA | 32 - .../RECORD | 137 - .../REQUESTED | 0 .../WHEEL | 6 - .../namespace_packages.txt | 2 - .../top_level.txt | 1 - .../_vendor/googleapis_common_protos.LICENSE | 202 -- .../exporter/otlp/proto/http/__init__.py | 78 - .../otlp/proto/http/_log_exporter/__init__.py | 168 - .../http/_log_exporter/encoder/__init__.py | 102 - .../proto/http/trace_exporter/__init__.py | 184 - .../http/trace_exporter/encoder/__init__.py | 290 -- .../exporter/otlp/proto/http/version.py | 15 - .../_vendor/opentelemetry/proto/__init__.py | 0 .../opentelemetry/proto/collector/__init__.py | 0 .../collector/logs/v1/logs_service_pb2.py | 133 - .../collector/logs/v1/logs_service_pb2.pyi | 38 - .../logs/v1/logs_service_pb2_grpc.py | 77 - .../proto/collector/metrics/__init__.py | 0 .../proto/collector/metrics/v1/__init__.py | 0 .../metrics/v1/metrics_service_pb2.py | 133 - .../metrics/v1/metrics_service_pb2.pyi | 38 - .../metrics/v1/metrics_service_pb2_grpc.py | 77 - .../proto/collector/trace/__init__.py | 0 .../proto/collector/trace/v1/__init__.py | 0 .../collector/trace/v1/trace_service_pb2.py | 133 - .../collector/trace/v1/trace_service_pb2.pyi | 38 - .../trace/v1/trace_service_pb2_grpc.py | 77 - .../opentelemetry/proto/common/__init__.py | 0 .../opentelemetry/proto/common/v1/__init__.py | 0 .../proto/common/v1/common_pb2.py | 366 -- .../proto/common/v1/common_pb2.pyi | 150 - .../opentelemetry/proto/logs/v1/logs_pb2.py | 556 --- .../opentelemetry/proto/logs/v1/logs_pb2.pyi | 356 -- .../opentelemetry/proto/metrics/__init__.py | 0 .../metrics_config_service_pb2.py | 276 -- .../metrics_config_service_pb2.pyi | 136 - .../metrics_config_service_pb2_grpc.py | 84 - .../proto/metrics/v1/__init__.py | 0 .../proto/metrics/v1/metrics_pb2.py | 1308 ------- .../proto/metrics/v1/metrics_pb2.pyi | 1125 ------ .../opentelemetry/proto/resource/__init__.py | 0 .../proto/resource/v1/__init__.py | 0 .../proto/resource/v1/resource_pb2.py | 81 - .../proto/resource/v1/resource_pb2.pyi | 38 - .../opentelemetry/proto/trace/__init__.py | 0 .../opentelemetry/proto/trace/v1/__init__.py | 0 .../proto/trace/v1/trace_config_pb2.py | 290 -- .../proto/trace/v1/trace_config_pb2.pyi | 123 - .../opentelemetry/proto/trace/v1/trace_pb2.py | 654 ---- .../proto/trace/v1/trace_pb2.pyi | 551 --- .../_vendor/opentelemetry/proto/version.py | 15 - .../_vendor/opentelemetry/sdk/__init__.pyi | 18 - .../sdk/_configuration/__init__.py | 289 -- .../opentelemetry/sdk/_logs/__init__.py | 522 --- .../sdk/_logs/export/__init__.py | 330 -- .../_logs/export/in_memory_log_exporter.py | 51 - .../opentelemetry/sdk/_logs/severity.py | 115 - .../sdk/environment_variables.py | 444 --- .../sdk/error_handler/__init__.py | 149 - .../opentelemetry/sdk/metrics/__init__.py | 37 - .../sdk/metrics/_internal/__init__.py | 493 --- .../_internal/_view_instrument_match.py | 137 - .../sdk/metrics/_internal/aggregation.py | 531 --- .../sdk/metrics/_internal/exceptions.py | 17 - .../sdk/metrics/_internal/export/__init__.py | 505 --- .../sdk/metrics/_internal/instrument.py | 246 -- .../sdk/metrics/_internal/measurement.py | 30 - .../metrics/_internal/measurement_consumer.py | 126 - .../_internal/metric_reader_storage.py | 298 -- .../sdk/metrics/_internal/point.py | 215 -- .../metrics/_internal/sdk_configuration.py | 29 - .../sdk/metrics/_internal/view.py | 161 - .../sdk/metrics/export/__init__.py | 50 - .../sdk/metrics/view/__init__.py | 31 - opensafely/_vendor/opentelemetry/sdk/py.typed | 0 .../opentelemetry/sdk/resources/__init__.py | 355 -- .../opentelemetry/sdk/trace/__init__.py | 1210 ------- .../sdk/trace/export/__init__.py | 440 --- .../trace/export/in_memory_span_exporter.py | 58 - .../opentelemetry/sdk/trace/id_generator.py | 52 - .../opentelemetry/sdk/trace/sampling.py | 397 --- .../opentelemetry/sdk/util/__init__.py | 150 - .../opentelemetry/sdk/util/__init__.pyi | 73 - .../opentelemetry/sdk/util/instrumentation.py | 143 - .../_vendor/opentelemetry/sdk/version.py | 15 - .../_vendor/opentelemetry/semconv/__init__.py | 0 .../semconv/resource/__init__.py | 657 ---- .../opentelemetry/semconv/trace/__init__.py | 1268 ------- .../_vendor/opentelemetry/semconv/version.py | 15 - ...orter_otlp_proto_http-1.12.0.dist-info.pyi | 1 - .../INSTALLER | 1 - .../LICENSE | 201 -- .../METADATA | 56 - .../RECORD | 14 - .../REQUESTED | 0 .../WHEEL | 5 - .../entry_points.txt | 2 - .../top_level.txt | 1 - ...telemetry_exporter_otlp_proto_http.LICENSE | 201 -- .../opentelemetry_proto-1.12.0.dist-info.pyi | 1 - .../INSTALLER | 1 - .../LICENSE | 201 -- .../METADATA | 65 - .../RECORD | 46 - .../REQUESTED | 0 .../WHEEL | 5 - .../top_level.txt | 1 - .../_vendor/opentelemetry_proto.LICENSE | 201 -- .../opentelemetry_sdk-1.12.0.dist-info.pyi | 1 - .../INSTALLER | 1 - .../LICENSE | 201 -- .../METADATA | 49 - .../opentelemetry_sdk-1.12.0.dist-info/RECORD | 42 - .../REQUESTED | 0 .../opentelemetry_sdk-1.12.0.dist-info/WHEEL | 5 - .../entry_points.txt | 23 - .../top_level.txt | 1 - opensafely/_vendor/opentelemetry_sdk.LICENSE | 201 -- ..._semantic_conventions-0.33b0.dist-info.pyi | 1 - .../INSTALLER | 1 - .../LICENSE | 201 -- .../METADATA | 61 - .../RECORD | 11 - .../REQUESTED | 0 .../WHEEL | 5 - .../top_level.txt | 1 - ...opentelemetry_semantic_conventions.LICENSE | 201 -- .../_vendor/protobuf-3.20.2.dist-info.pyi | 1 - .../protobuf-3.20.2.dist-info/INSTALLER | 1 - .../_vendor/protobuf-3.20.2.dist-info/LICENSE | 32 - .../protobuf-3.20.2.dist-info/METADATA | 21 - .../_vendor/protobuf-3.20.2.dist-info/RECORD | 54 - .../protobuf-3.20.2.dist-info/REQUESTED | 0 .../_vendor/protobuf-3.20.2.dist-info/WHEEL | 6 - .../namespace_packages.txt | 1 - .../protobuf-3.20.2.dist-info/top_level.txt | 1 - opensafely/_vendor/protobuf.LICENSE | 32 - .../typing_extensions-4.7.1.dist-info.pyi | 1 - .../INSTALLER | 1 - .../typing_extensions-4.7.1.dist-info/LICENSE | 279 -- .../METADATA | 69 - .../typing_extensions-4.7.1.dist-info/RECORD | 7 - .../REQUESTED | 0 .../typing_extensions-4.7.1.dist-info/WHEEL | 4 - opensafely/_vendor/typing_extensions.LICENSE | 279 -- opensafely/_vendor/typing_extensions.py | 3072 ----------------- opensafely/_vendor/typing_extensions.pyi | 1 - .../_vendor/urllib3/contrib/appengine.py | 2 +- .../_vendor/wrapt-1.14.1.dist-info/RECORD | 1 - 345 files changed, 1 insertion(+), 53402 deletions(-) delete mode 100644 opensafely/_vendor/backoff-2.1.2.dist-info.pyi delete mode 100644 opensafely/_vendor/backoff-2.1.2.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/backoff-2.1.2.dist-info/LICENSE delete mode 100644 opensafely/_vendor/backoff-2.1.2.dist-info/METADATA delete mode 100644 opensafely/_vendor/backoff-2.1.2.dist-info/RECORD delete mode 100644 opensafely/_vendor/backoff-2.1.2.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/backoff-2.1.2.dist-info/WHEEL delete mode 100644 opensafely/_vendor/backoff/LICENSE delete mode 100644 opensafely/_vendor/backoff/__init__.py delete mode 100644 opensafely/_vendor/backoff/_async.py delete mode 100644 opensafely/_vendor/backoff/_common.py delete mode 100644 opensafely/_vendor/backoff/_decorator.py delete mode 100644 opensafely/_vendor/backoff/_jitter.py delete mode 100644 opensafely/_vendor/backoff/_sync.py delete mode 100644 opensafely/_vendor/backoff/_typing.py delete mode 100644 opensafely/_vendor/backoff/_wait_gen.py delete mode 100644 opensafely/_vendor/backoff/py.typed delete mode 100644 opensafely/_vendor/backoff/types.py delete mode 100644 opensafely/_vendor/google.pyi delete mode 100644 opensafely/_vendor/google/api/__init__.py delete mode 100644 opensafely/_vendor/google/api/annotations.proto delete mode 100644 opensafely/_vendor/google/api/annotations_pb2.py delete mode 100644 opensafely/_vendor/google/api/auth.proto delete mode 100644 opensafely/_vendor/google/api/auth_pb2.py delete mode 100644 opensafely/_vendor/google/api/backend.proto delete mode 100644 opensafely/_vendor/google/api/backend_pb2.py delete mode 100644 opensafely/_vendor/google/api/billing.proto delete mode 100644 opensafely/_vendor/google/api/billing_pb2.py delete mode 100644 opensafely/_vendor/google/api/client.proto delete mode 100644 opensafely/_vendor/google/api/client_pb2.py delete mode 100644 opensafely/_vendor/google/api/config_change.proto delete mode 100644 opensafely/_vendor/google/api/config_change_pb2.py delete mode 100644 opensafely/_vendor/google/api/consumer.proto delete mode 100644 opensafely/_vendor/google/api/consumer_pb2.py delete mode 100644 opensafely/_vendor/google/api/context.proto delete mode 100644 opensafely/_vendor/google/api/context_pb2.py delete mode 100644 opensafely/_vendor/google/api/control.proto delete mode 100644 opensafely/_vendor/google/api/control_pb2.py delete mode 100644 opensafely/_vendor/google/api/distribution.proto delete mode 100644 opensafely/_vendor/google/api/distribution_pb2.py delete mode 100644 opensafely/_vendor/google/api/documentation.proto delete mode 100644 opensafely/_vendor/google/api/documentation_pb2.py delete mode 100644 opensafely/_vendor/google/api/endpoint.proto delete mode 100644 opensafely/_vendor/google/api/endpoint_pb2.py delete mode 100644 opensafely/_vendor/google/api/error_reason.proto delete mode 100644 opensafely/_vendor/google/api/error_reason_pb2.py delete mode 100644 opensafely/_vendor/google/api/field_behavior.proto delete mode 100644 opensafely/_vendor/google/api/field_behavior_pb2.py delete mode 100644 opensafely/_vendor/google/api/http.proto delete mode 100644 opensafely/_vendor/google/api/http_pb2.py delete mode 100644 opensafely/_vendor/google/api/httpbody.proto delete mode 100644 opensafely/_vendor/google/api/httpbody_pb2.py delete mode 100644 opensafely/_vendor/google/api/label.proto delete mode 100644 opensafely/_vendor/google/api/label_pb2.py delete mode 100644 opensafely/_vendor/google/api/launch_stage.proto delete mode 100644 opensafely/_vendor/google/api/launch_stage_pb2.py delete mode 100644 opensafely/_vendor/google/api/log.proto delete mode 100644 opensafely/_vendor/google/api/log_pb2.py delete mode 100644 opensafely/_vendor/google/api/logging.proto delete mode 100644 opensafely/_vendor/google/api/logging_pb2.py delete mode 100644 opensafely/_vendor/google/api/metric.proto delete mode 100644 opensafely/_vendor/google/api/metric_pb2.py delete mode 100644 opensafely/_vendor/google/api/monitored_resource.proto delete mode 100644 opensafely/_vendor/google/api/monitored_resource_pb2.py delete mode 100644 opensafely/_vendor/google/api/monitoring.proto delete mode 100644 opensafely/_vendor/google/api/monitoring_pb2.py delete mode 100644 opensafely/_vendor/google/api/quota.proto delete mode 100644 opensafely/_vendor/google/api/quota_pb2.py delete mode 100644 opensafely/_vendor/google/api/resource.proto delete mode 100644 opensafely/_vendor/google/api/resource_pb2.py delete mode 100644 opensafely/_vendor/google/api/routing.proto delete mode 100644 opensafely/_vendor/google/api/routing_pb2.py delete mode 100644 opensafely/_vendor/google/api/service.proto delete mode 100644 opensafely/_vendor/google/api/service_pb2.py delete mode 100644 opensafely/_vendor/google/api/source_info.proto delete mode 100644 opensafely/_vendor/google/api/source_info_pb2.py delete mode 100644 opensafely/_vendor/google/api/system_parameter.proto delete mode 100644 opensafely/_vendor/google/api/system_parameter_pb2.py delete mode 100644 opensafely/_vendor/google/api/usage.proto delete mode 100644 opensafely/_vendor/google/api/usage_pb2.py delete mode 100644 opensafely/_vendor/google/api/visibility.proto delete mode 100644 opensafely/_vendor/google/api/visibility_pb2.py delete mode 100644 opensafely/_vendor/google/cloud/extended_operations.proto delete mode 100644 opensafely/_vendor/google/cloud/extended_operations_pb2.py delete mode 100644 opensafely/_vendor/google/cloud/location/locations.proto delete mode 100644 opensafely/_vendor/google/cloud/location/locations_pb2.py delete mode 100644 opensafely/_vendor/google/gapic/metadata/__init__.py delete mode 100644 opensafely/_vendor/google/gapic/metadata/gapic_metadata.proto delete mode 100644 opensafely/_vendor/google/gapic/metadata/gapic_metadata_pb2.py delete mode 100644 opensafely/_vendor/google/logging/type/__init__.py delete mode 100644 opensafely/_vendor/google/logging/type/http_request.proto delete mode 100644 opensafely/_vendor/google/logging/type/http_request_pb2.py delete mode 100644 opensafely/_vendor/google/logging/type/log_severity.proto delete mode 100644 opensafely/_vendor/google/logging/type/log_severity_pb2.py delete mode 100644 opensafely/_vendor/google/longrunning/__init__.py delete mode 100644 opensafely/_vendor/google/longrunning/operations.proto delete mode 100644 opensafely/_vendor/google/longrunning/operations_grpc.py delete mode 100644 opensafely/_vendor/google/longrunning/operations_grpc_pb2.py delete mode 100644 opensafely/_vendor/google/longrunning/operations_pb2.py delete mode 100644 opensafely/_vendor/google/longrunning/operations_pb2_grpc.py delete mode 100644 opensafely/_vendor/google/longrunning/operations_proto.py delete mode 100644 opensafely/_vendor/google/longrunning/operations_proto_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/__init__.py delete mode 100644 opensafely/_vendor/google/protobuf/any_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/api_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/compiler/__init__.py delete mode 100644 opensafely/_vendor/google/protobuf/compiler/plugin_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/descriptor.py delete mode 100644 opensafely/_vendor/google/protobuf/descriptor_database.py delete mode 100644 opensafely/_vendor/google/protobuf/descriptor_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/descriptor_pool.py delete mode 100644 opensafely/_vendor/google/protobuf/duration_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/empty_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/field_mask_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/__init__.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/api_implementation.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/builder.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/containers.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/decoder.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/encoder.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/enum_type_wrapper.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/extension_dict.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/message_listener.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/python_message.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/type_checkers.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/well_known_types.py delete mode 100644 opensafely/_vendor/google/protobuf/internal/wire_format.py delete mode 100644 opensafely/_vendor/google/protobuf/json_format.py delete mode 100644 opensafely/_vendor/google/protobuf/message.py delete mode 100644 opensafely/_vendor/google/protobuf/message_factory.py delete mode 100644 opensafely/_vendor/google/protobuf/proto_builder.py delete mode 100644 opensafely/_vendor/google/protobuf/pyext/__init__.py delete mode 100644 opensafely/_vendor/google/protobuf/pyext/cpp_message.py delete mode 100644 opensafely/_vendor/google/protobuf/reflection.py delete mode 100644 opensafely/_vendor/google/protobuf/service.py delete mode 100644 opensafely/_vendor/google/protobuf/service_reflection.py delete mode 100644 opensafely/_vendor/google/protobuf/source_context_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/struct_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/symbol_database.py delete mode 100644 opensafely/_vendor/google/protobuf/text_encoding.py delete mode 100644 opensafely/_vendor/google/protobuf/text_format.py delete mode 100644 opensafely/_vendor/google/protobuf/timestamp_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/type_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/util/__init__.py delete mode 100644 opensafely/_vendor/google/protobuf/util/json_format_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/util/json_format_proto3_pb2.py delete mode 100644 opensafely/_vendor/google/protobuf/wrappers_pb2.py delete mode 100644 opensafely/_vendor/google/rpc/__init__.py delete mode 100644 opensafely/_vendor/google/rpc/code.proto delete mode 100644 opensafely/_vendor/google/rpc/code_pb2.py delete mode 100644 opensafely/_vendor/google/rpc/context/__init__.py delete mode 100644 opensafely/_vendor/google/rpc/context/attribute_context.proto delete mode 100644 opensafely/_vendor/google/rpc/context/attribute_context_pb2.py delete mode 100644 opensafely/_vendor/google/rpc/error_details.proto delete mode 100644 opensafely/_vendor/google/rpc/error_details_pb2.py delete mode 100644 opensafely/_vendor/google/rpc/status.proto delete mode 100644 opensafely/_vendor/google/rpc/status_pb2.py delete mode 100644 opensafely/_vendor/google/type/__init__.py delete mode 100644 opensafely/_vendor/google/type/calendar_period.proto delete mode 100644 opensafely/_vendor/google/type/calendar_period_pb2.py delete mode 100644 opensafely/_vendor/google/type/color.proto delete mode 100644 opensafely/_vendor/google/type/color_pb2.py delete mode 100644 opensafely/_vendor/google/type/date.proto delete mode 100644 opensafely/_vendor/google/type/date_pb2.py delete mode 100644 opensafely/_vendor/google/type/datetime.proto delete mode 100644 opensafely/_vendor/google/type/datetime_pb2.py delete mode 100644 opensafely/_vendor/google/type/dayofweek.proto delete mode 100644 opensafely/_vendor/google/type/dayofweek_pb2.py delete mode 100644 opensafely/_vendor/google/type/decimal.proto delete mode 100644 opensafely/_vendor/google/type/decimal_pb2.py delete mode 100644 opensafely/_vendor/google/type/expr.proto delete mode 100644 opensafely/_vendor/google/type/expr_pb2.py delete mode 100644 opensafely/_vendor/google/type/fraction.proto delete mode 100644 opensafely/_vendor/google/type/fraction_pb2.py delete mode 100644 opensafely/_vendor/google/type/interval.proto delete mode 100644 opensafely/_vendor/google/type/interval_pb2.py delete mode 100644 opensafely/_vendor/google/type/latlng.proto delete mode 100644 opensafely/_vendor/google/type/latlng_pb2.py delete mode 100644 opensafely/_vendor/google/type/localized_text.proto delete mode 100644 opensafely/_vendor/google/type/localized_text_pb2.py delete mode 100644 opensafely/_vendor/google/type/money.proto delete mode 100644 opensafely/_vendor/google/type/money_pb2.py delete mode 100644 opensafely/_vendor/google/type/month.proto delete mode 100644 opensafely/_vendor/google/type/month_pb2.py delete mode 100644 opensafely/_vendor/google/type/phone_number.proto delete mode 100644 opensafely/_vendor/google/type/phone_number_pb2.py delete mode 100644 opensafely/_vendor/google/type/postal_address.proto delete mode 100644 opensafely/_vendor/google/type/postal_address_pb2.py delete mode 100644 opensafely/_vendor/google/type/quaternion.proto delete mode 100644 opensafely/_vendor/google/type/quaternion_pb2.py delete mode 100644 opensafely/_vendor/google/type/timeofday.proto delete mode 100644 opensafely/_vendor/google/type/timeofday_pb2.py delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info.pyi delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/LICENSE delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/METADATA delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/RECORD delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/WHEEL delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/namespace_packages.txt delete mode 100644 opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/googleapis_common_protos.LICENSE delete mode 100644 opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/encoder/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/version.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2_grpc.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/metrics/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2_grpc.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/trace/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/trace/v1/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2_grpc.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/common/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/common/v1/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/metrics/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/metrics/v1/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/resource/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/resource/v1/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/trace/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/trace/v1/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.py delete mode 100644 opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.pyi delete mode 100644 opensafely/_vendor/opentelemetry/proto/version.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/__init__.pyi delete mode 100644 opensafely/_vendor/opentelemetry/sdk/_configuration/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/_logs/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/_logs/export/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/_logs/export/in_memory_log_exporter.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/_logs/severity.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/environment_variables.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/error_handler/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/_view_instrument_match.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/aggregation.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/exceptions.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/export/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/instrument.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement_consumer.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/point.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/sdk_configuration.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/_internal/view.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/export/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/metrics/view/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/py.typed delete mode 100644 opensafely/_vendor/opentelemetry/sdk/resources/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/trace/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/trace/export/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/trace/export/in_memory_span_exporter.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/trace/id_generator.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/trace/sampling.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/util/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/util/__init__.pyi delete mode 100644 opensafely/_vendor/opentelemetry/sdk/util/instrumentation.py delete mode 100644 opensafely/_vendor/opentelemetry/sdk/version.py delete mode 100644 opensafely/_vendor/opentelemetry/semconv/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/semconv/resource/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/semconv/trace/__init__.py delete mode 100644 opensafely/_vendor/opentelemetry/semconv/version.py delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info.pyi delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/METADATA delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/RECORD delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/entry_points.txt delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/opentelemetry_exporter_otlp_proto_http.LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info.pyi delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/METADATA delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/RECORD delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/opentelemetry_proto.LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info.pyi delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/METADATA delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/RECORD delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/entry_points.txt delete mode 100644 opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/opentelemetry_sdk.LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info.pyi delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/METADATA delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/RECORD delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/opentelemetry_semantic_conventions.LICENSE delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info.pyi delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/LICENSE delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/METADATA delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/RECORD delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/WHEEL delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/namespace_packages.txt delete mode 100644 opensafely/_vendor/protobuf-3.20.2.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/protobuf.LICENSE delete mode 100644 opensafely/_vendor/typing_extensions-4.7.1.dist-info.pyi delete mode 100644 opensafely/_vendor/typing_extensions-4.7.1.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/typing_extensions-4.7.1.dist-info/LICENSE delete mode 100644 opensafely/_vendor/typing_extensions-4.7.1.dist-info/METADATA delete mode 100644 opensafely/_vendor/typing_extensions-4.7.1.dist-info/RECORD delete mode 100644 opensafely/_vendor/typing_extensions-4.7.1.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/typing_extensions-4.7.1.dist-info/WHEEL delete mode 100644 opensafely/_vendor/typing_extensions.LICENSE delete mode 100644 opensafely/_vendor/typing_extensions.py delete mode 100644 opensafely/_vendor/typing_extensions.pyi diff --git a/opensafely/_vendor/backoff-2.1.2.dist-info.pyi b/opensafely/_vendor/backoff-2.1.2.dist-info.pyi deleted file mode 100644 index f747b5cf..00000000 --- a/opensafely/_vendor/backoff-2.1.2.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from backoff-2.1.2.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/backoff-2.1.2.dist-info/INSTALLER b/opensafely/_vendor/backoff-2.1.2.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/backoff-2.1.2.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/backoff-2.1.2.dist-info/LICENSE b/opensafely/_vendor/backoff-2.1.2.dist-info/LICENSE deleted file mode 100644 index 9dc3cea5..00000000 --- a/opensafely/_vendor/backoff-2.1.2.dist-info/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 litl, LLC. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/opensafely/_vendor/backoff-2.1.2.dist-info/METADATA b/opensafely/_vendor/backoff-2.1.2.dist-info/METADATA deleted file mode 100644 index dfbeba18..00000000 --- a/opensafely/_vendor/backoff-2.1.2.dist-info/METADATA +++ /dev/null @@ -1,393 +0,0 @@ -Metadata-Version: 2.1 -Name: backoff -Version: 2.1.2 -Summary: Function decoration for backoff and retry -Home-page: https://github.com/litl/backoff -License: MIT -Keywords: retry,backoff,decorators -Author: Bob Green -Author-email: rgreen@aquent.com -Requires-Python: >=3.7,<4.0 -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Natural Language :: English -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Topic :: Internet :: WWW/HTTP -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Utilities -Project-URL: Repository, https://github.com/litl/backoff -Description-Content-Type: text/x-rst - -backoff -======= - -.. image:: https://travis-ci.org/litl/backoff.svg - :target: https://travis-ci.org/litl/backoff -.. image:: https://coveralls.io/repos/litl/backoff/badge.svg - :target: https://coveralls.io/r/litl/backoff?branch=python-3 -.. image:: https://github.com/litl/backoff/workflows/CodeQL/badge.svg - :target: https://github.com/litl/backoff/actions/workflows/codeql-analysis.yml -.. image:: https://img.shields.io/pypi/v/backoff.svg - :target: https://pypi.python.org/pypi/backoff -.. image:: https://img.shields.io/github/license/litl/backoff - :target: https://github.com/litl/backoff/blob/master/LICENSE - -**Function decoration for backoff and retry** - -This module provides function decorators which can be used to wrap a -function such that it will be retried until some condition is met. It -is meant to be of use when accessing unreliable resources with the -potential for intermittent failures i.e. network resources and external -APIs. Somewhat more generally, it may also be of use for dynamically -polling resources for externally generated content. - -Decorators support both regular functions for synchronous code and -`asyncio `__'s coroutines -for asynchronous code. - -Examples -======== - -Since Kenneth Reitz's `requests `_ module -has become a defacto standard for synchronous HTTP clients in Python, -networking examples below are written using it, but it is in no way required -by the backoff module. - -@backoff.on_exception ---------------------- - -The ``on_exception`` decorator is used to retry when a specified exception -is raised. Here's an example using exponential backoff when any -``requests`` exception is raised: - -.. code-block:: python - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException) - def get_url(url): - return requests.get(url) - -The decorator will also accept a tuple of exceptions for cases where -the same backoff behavior is desired for more than one exception type: - -.. code-block:: python - - @backoff.on_exception(backoff.expo, - (requests.exceptions.Timeout, - requests.exceptions.ConnectionError)) - def get_url(url): - return requests.get(url) - -**Give Up Conditions** - -Optional keyword arguments can specify conditions under which to give -up. - -The keyword argument ``max_time`` specifies the maximum amount -of total time in seconds that can elapse before giving up. - -.. code-block:: python - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - max_time=60) - def get_url(url): - return requests.get(url) - - -Keyword argument ``max_tries`` specifies the maximum number of calls -to make to the target function before giving up. - -.. code-block:: python - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - max_tries=8, - jitter=None) - def get_url(url): - return requests.get(url) - - -In some cases the raised exception instance itself may need to be -inspected in order to determine if it is a retryable condition. The -``giveup`` keyword arg can be used to specify a function which accepts -the exception and returns a truthy value if the exception should not -be retried: - -.. code-block:: python - - def fatal_code(e): - return 400 <= e.response.status_code < 500 - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - max_time=300, - giveup=fatal_code) - def get_url(url): - return requests.get(url) - -By default, when a give up event occurs, the exception in question is reraised -and so code calling an `on_exception`-decorated function may still -need to do exception handling. This behavior can optionally be disabled -using the `raise_on_giveup` keyword argument. - -In the code below, `requests.exceptions.RequestException` will not be raised -when giveup occurs. Note that the decorated function will return `None` in this -case, regardless of the logic in the `on_exception` handler. - -.. code-block:: python - - def fatal_code(e): - return 400 <= e.response.status_code < 500 - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - max_time=300, - raise_on_giveup=False, - giveup=fatal_code) - def get_url(url): - return requests.get(url) - -This is useful for non-mission critical code where you still wish to retry -the code inside of `backoff.on_exception` but wish to proceed with execution -even if all retries fail. - -@backoff.on_predicate ---------------------- - -The ``on_predicate`` decorator is used to retry when a particular -condition is true of the return value of the target function. This may -be useful when polling a resource for externally generated content. - -Here's an example which uses a fibonacci sequence backoff when the -return value of the target function is the empty list: - -.. code-block:: python - - @backoff.on_predicate(backoff.fibo, lambda x: x == [], max_value=13) - def poll_for_messages(queue): - return queue.get() - -Extra keyword arguments are passed when initializing the -wait generator, so the ``max_value`` param above is passed as a keyword -arg when initializing the fibo generator. - -When not specified, the predicate param defaults to the falsey test, -so the above can more concisely be written: - -.. code-block:: python - - @backoff.on_predicate(backoff.fibo, max_value=13) - def poll_for_message(queue): - return queue.get() - -More simply, a function which continues polling every second until it -gets a non-falsey result could be defined like like this: - -.. code-block:: python - - @backoff.on_predicate(backoff.constant, jitter=None, interval=1) - def poll_for_message(queue): - return queue.get() - -The jitter is disabled in order to keep the polling frequency fixed. - -Jitter ------- - -A jitter algorithm can be supplied with the ``jitter`` keyword arg to -either of the backoff decorators. This argument should be a function -accepting the original unadulterated backoff value and returning it's -jittered counterpart. - -As of version 1.2, the default jitter function ``backoff.full_jitter`` -implements the 'Full Jitter' algorithm as defined in the AWS -Architecture Blog's `Exponential Backoff And Jitter -`_ post. -Note that with this algorithm, the time yielded by the wait generator -is actually the *maximum* amount of time to wait. - -Previous versions of backoff defaulted to adding some random number of -milliseconds (up to 1s) to the raw sleep value. If desired, this -behavior is now available as ``backoff.random_jitter``. - -Using multiple decorators -------------------------- - -The backoff decorators may also be combined to specify different -backoff behavior for different cases: - -.. code-block:: python - - @backoff.on_predicate(backoff.fibo, max_value=13) - @backoff.on_exception(backoff.expo, - requests.exceptions.HTTPError, - max_time=60) - @backoff.on_exception(backoff.expo, - requests.exceptions.Timeout, - max_time=300) - def poll_for_message(queue): - return queue.get() - - -Runtime Configuration ---------------------- - -The decorator functions ``on_exception`` and ``on_predicate`` are -generally evaluated at import time. This is fine when the keyword args -are passed as constant values, but suppose we want to consult a -dictionary with configuration options that only become available at -runtime. The relevant values are not available at import time. Instead, -decorator functions can be passed callables which are evaluated at -runtime to obtain the value: - -.. code-block:: python - - def lookup_max_time(): - # pretend we have a global reference to 'app' here - # and that it has a dictionary-like 'config' property - return app.config["BACKOFF_MAX_TIME"] - - @backoff.on_exception(backoff.expo, - ValueError, - max_time=lookup_max_time) - -Event handlers --------------- - -Both backoff decorators optionally accept event handler functions -using the keyword arguments ``on_success``, ``on_backoff``, and ``on_giveup``. -This may be useful in reporting statistics or performing other custom -logging. - -Handlers must be callables with a unary signature accepting a dict -argument. This dict contains the details of the invocation. Valid keys -include: - -* *target*: reference to the function or method being invoked -* *args*: positional arguments to func -* *kwargs*: keyword arguments to func -* *tries*: number of invocation tries so far -* *elapsed*: elapsed time in seconds so far -* *wait*: seconds to wait (``on_backoff`` handler only) -* *value*: value triggering backoff (``on_predicate`` decorator only) - -A handler which prints the details of the backoff event could be -implemented like so: - -.. code-block:: python - - def backoff_hdlr(details): - print ("Backing off {wait:0.1f} seconds after {tries} tries " - "calling function {target} with args {args} and kwargs " - "{kwargs}".format(**details)) - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - on_backoff=backoff_hdlr) - def get_url(url): - return requests.get(url) - -**Multiple handlers per event type** - -In all cases, iterables of handler functions are also accepted, which -are called in turn. For example, you might provide a simple list of -handler functions as the value of the ``on_backoff`` keyword arg: - -.. code-block:: python - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - on_backoff=[backoff_hdlr1, backoff_hdlr2]) - def get_url(url): - return requests.get(url) - -**Getting exception info** - -In the case of the ``on_exception`` decorator, all ``on_backoff`` and -``on_giveup`` handlers are called from within the except block for the -exception being handled. Therefore exception info is available to the -handler functions via the python standard library, specifically -``sys.exc_info()`` or the ``traceback`` module. - -Asynchronous code ------------------ - -Backoff supports asynchronous execution in Python 3.5 and above. - -To use backoff in asynchronous code based on -`asyncio `__ -you simply need to apply ``backoff.on_exception`` or ``backoff.on_predicate`` -to coroutines. -You can also use coroutines for the ``on_success``, ``on_backoff``, and -``on_giveup`` event handlers, with the interface otherwise being identical. - -The following examples use `aiohttp `__ -asynchronous HTTP client/server library. - -.. code-block:: python - - @backoff.on_exception(backoff.expo, aiohttp.ClientError, max_time=60) - async def get_url(url): - async with aiohttp.ClientSession(raise_for_status=True) as session: - async with session.get(url) as response: - return await response.text() - -Logging configuration ---------------------- - -By default, backoff and retry attempts are logged to the 'backoff' -logger. By default, this logger is configured with a NullHandler, so -there will be nothing output unless you configure a handler. -Programmatically, this might be accomplished with something as simple -as: - -.. code-block:: python - - logging.getLogger('backoff').addHandler(logging.StreamHandler()) - -The default logging level is INFO, which corresponds to logging -anytime a retry event occurs. If you would instead like to log -only when a giveup event occurs, set the logger level to ERROR. - -.. code-block:: python - - logging.getLogger('backoff').setLevel(logging.ERROR) - -It is also possible to specify an alternate logger with the ``logger`` -keyword argument. If a string value is specified the logger will be -looked up by name. - -.. code-block:: python - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - logger='my_logger') - # ... - -It is also supported to specify a Logger (or LoggerAdapter) object -directly. - -.. code-block:: python - - my_logger = logging.getLogger('my_logger') - my_handler = logging.StreamHandler() - my_logger.addHandler(my_handler) - my_logger.setLevel(logging.ERROR) - - @backoff.on_exception(backoff.expo, - requests.exceptions.RequestException, - logger=my_logger) - # ... - -Default logging can be disabled all together by specifying -``logger=None``. In this case, if desired alternative logging behavior -could be defined by using custom event handlers. - diff --git a/opensafely/_vendor/backoff-2.1.2.dist-info/RECORD b/opensafely/_vendor/backoff-2.1.2.dist-info/RECORD deleted file mode 100644 index ff7fb31d..00000000 --- a/opensafely/_vendor/backoff-2.1.2.dist-info/RECORD +++ /dev/null @@ -1,16 +0,0 @@ -backoff-2.1.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -backoff-2.1.2.dist-info/LICENSE,sha256=KmtNX4hNTXob8E6n3xlEzxKzLjWnmobQoHWi0_QPuaw,1077 -backoff-2.1.2.dist-info/METADATA,sha256=QMU7pbauHvsAP51nuT0DfBPKNLhzPJmo_cX3cveRxg8,13970 -backoff-2.1.2.dist-info/RECORD,, -backoff-2.1.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -backoff-2.1.2.dist-info/WHEEL,sha256=y3eDiaFVSNTPbgzfNn0nYn5tEn1cX6WrdetDlQM4xWw,83 -backoff/__init__.py,sha256=6AMkIVMp4N7O7mNlLxbLtY_lG4q-zWBJUnEdqfqqyO4,898 -backoff/_async.py,sha256=NzFgUA7MzBa-OfhGU9_An_7rAd5yg3GrBRRcU3qWwDk,6699 -backoff/_common.py,sha256=8s3_5AJH8hiHd9GR2PdKqiaeE2sdEUoyf6cW9OCo1F8,3478 -backoff/_decorator.py,sha256=ZAOQSL0zTB0Je_8sA9YnQpvrshIHFyPn0ipkudL2bJ8,9768 -backoff/_jitter.py,sha256=LjJShpjryk9sWBCWiz-3UX1DJCx6rebNJ5Bf3nPMlYQ,782 -backoff/_sync.py,sha256=4ku9BKM80jLMmwXGr1teEMR972Dtil3cGSeO-Nh1KpI,4144 -backoff/_typing.py,sha256=sRCFcxcYprMIaLtmhsAmKMpvVRDV8NA0fhifvEt7a5w,1218 -backoff/_wait_gen.py,sha256=R_PRqDUHcK2DUTCCCHJfpphk5U41kqJB0tnFZoy4Hsw,2370 -backoff/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -backoff/types.py,sha256=4DGG6Ltcz0wVfXrk0YBOnp_oPpcki4c0BOnodRhgoqg,73 diff --git a/opensafely/_vendor/backoff-2.1.2.dist-info/REQUESTED b/opensafely/_vendor/backoff-2.1.2.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/backoff-2.1.2.dist-info/WHEEL b/opensafely/_vendor/backoff-2.1.2.dist-info/WHEEL deleted file mode 100644 index 37646521..00000000 --- a/opensafely/_vendor/backoff-2.1.2.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: poetry 1.0.7 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/opensafely/_vendor/backoff/LICENSE b/opensafely/_vendor/backoff/LICENSE deleted file mode 100644 index 9dc3cea5..00000000 --- a/opensafely/_vendor/backoff/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 litl, LLC. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/opensafely/_vendor/backoff/__init__.py b/opensafely/_vendor/backoff/__init__.py deleted file mode 100644 index dbc51dd7..00000000 --- a/opensafely/_vendor/backoff/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding:utf-8 -""" -Function decoration for backoff and retry - -This module provides function decorators which can be used to wrap a -function such that it will be retried until some condition is met. It -is meant to be of use when accessing unreliable resources with the -potential for intermittent failures i.e. network resources and external -APIs. Somewhat more generally, it may also be of use for dynamically -polling resources for externally generated content. - -For examples and full documentation see the README at -https://github.com/litl/backoff -""" -from opensafely._vendor.backoff._decorator import on_exception, on_predicate -from opensafely._vendor.backoff._jitter import full_jitter, random_jitter -from opensafely._vendor.backoff._wait_gen import constant, expo, fibo, runtime - -__all__ = [ - 'on_predicate', - 'on_exception', - 'constant', - 'expo', - 'fibo', - 'runtime', - 'full_jitter', - 'random_jitter', -] - -__version__ = "2.1.2" diff --git a/opensafely/_vendor/backoff/_async.py b/opensafely/_vendor/backoff/_async.py deleted file mode 100644 index a155e8b4..00000000 --- a/opensafely/_vendor/backoff/_async.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding:utf-8 -import datetime -import functools -import asyncio -from datetime import timedelta - -from opensafely._vendor.backoff._common import (_init_wait_gen, _maybe_call, _next_wait) - - -def _ensure_coroutine(coro_or_func): - if asyncio.iscoroutinefunction(coro_or_func): - return coro_or_func - else: - @functools.wraps(coro_or_func) - async def f(*args, **kwargs): - return coro_or_func(*args, **kwargs) - return f - - -def _ensure_coroutines(coros_or_funcs): - return [_ensure_coroutine(f) for f in coros_or_funcs] - - -async def _call_handlers(handlers, - *, - target, args, kwargs, tries, elapsed, - **extra): - details = { - 'target': target, - 'args': args, - 'kwargs': kwargs, - 'tries': tries, - 'elapsed': elapsed, - } - details.update(extra) - for handler in handlers: - await handler(details) - - -def retry_predicate(target, wait_gen, predicate, - *, - max_tries, max_time, jitter, - on_success, on_backoff, on_giveup, - wait_gen_kwargs): - on_success = _ensure_coroutines(on_success) - on_backoff = _ensure_coroutines(on_backoff) - on_giveup = _ensure_coroutines(on_giveup) - - # Easy to implement, please report if you need this. - assert not asyncio.iscoroutinefunction(max_tries) - assert not asyncio.iscoroutinefunction(jitter) - - assert asyncio.iscoroutinefunction(target) - - @functools.wraps(target) - async def retry(*args, **kwargs): - - # update variables from outer function args - max_tries_value = _maybe_call(max_tries) - max_time_value = _maybe_call(max_time) - - tries = 0 - start = datetime.datetime.now() - wait = _init_wait_gen(wait_gen, wait_gen_kwargs) - while True: - tries += 1 - elapsed = timedelta.total_seconds(datetime.datetime.now() - start) - details = { - "target": target, - "args": args, - "kwargs": kwargs, - "tries": tries, - "elapsed": elapsed, - } - - ret = await target(*args, **kwargs) - if predicate(ret): - max_tries_exceeded = (tries == max_tries_value) - max_time_exceeded = (max_time_value is not None and - elapsed >= max_time_value) - - if max_tries_exceeded or max_time_exceeded: - await _call_handlers(on_giveup, **details, value=ret) - break - - try: - seconds = _next_wait(wait, ret, jitter, elapsed, - max_time_value) - except StopIteration: - await _call_handlers(on_giveup, **details, value=ret) - break - - await _call_handlers(on_backoff, **details, value=ret, - wait=seconds) - - # Note: there is no convenient way to pass explicit event - # loop to decorator, so here we assume that either default - # thread event loop is set and correct (it mostly is - # by default), or Python >= 3.5.3 or Python >= 3.6 is used - # where loop.get_event_loop() in coroutine guaranteed to - # return correct value. - # See for details: - # - # - await asyncio.sleep(seconds) - continue - else: - await _call_handlers(on_success, **details, value=ret) - break - - return ret - - return retry - - -def retry_exception(target, wait_gen, exception, - *, - max_tries, max_time, jitter, giveup, - on_success, on_backoff, on_giveup, raise_on_giveup, - wait_gen_kwargs): - on_success = _ensure_coroutines(on_success) - on_backoff = _ensure_coroutines(on_backoff) - on_giveup = _ensure_coroutines(on_giveup) - giveup = _ensure_coroutine(giveup) - - # Easy to implement, please report if you need this. - assert not asyncio.iscoroutinefunction(max_tries) - assert not asyncio.iscoroutinefunction(jitter) - - @functools.wraps(target) - async def retry(*args, **kwargs): - - max_tries_value = _maybe_call(max_tries) - max_time_value = _maybe_call(max_time) - - tries = 0 - start = datetime.datetime.now() - wait = _init_wait_gen(wait_gen, wait_gen_kwargs) - while True: - tries += 1 - elapsed = timedelta.total_seconds(datetime.datetime.now() - start) - details = { - "target": target, - "args": args, - "kwargs": kwargs, - "tries": tries, - "elapsed": elapsed, - } - - try: - ret = await target(*args, **kwargs) - except exception as e: - giveup_result = await giveup(e) - max_tries_exceeded = (tries == max_tries_value) - max_time_exceeded = (max_time_value is not None and - elapsed >= max_time_value) - - if giveup_result or max_tries_exceeded or max_time_exceeded: - await _call_handlers(on_giveup, **details) - if raise_on_giveup: - raise - return None - - try: - seconds = _next_wait(wait, e, jitter, elapsed, - max_time_value) - except StopIteration: - await _call_handlers(on_giveup, **details) - raise e - - await _call_handlers(on_backoff, **details, wait=seconds) - - # Note: there is no convenient way to pass explicit event - # loop to decorator, so here we assume that either default - # thread event loop is set and correct (it mostly is - # by default), or Python >= 3.5.3 or Python >= 3.6 is used - # where loop.get_event_loop() in coroutine guaranteed to - # return correct value. - # See for details: - # - # - await asyncio.sleep(seconds) - else: - await _call_handlers(on_success, **details) - - return ret - return retry diff --git a/opensafely/_vendor/backoff/_common.py b/opensafely/_vendor/backoff/_common.py deleted file mode 100644 index 2b2e54ef..00000000 --- a/opensafely/_vendor/backoff/_common.py +++ /dev/null @@ -1,120 +0,0 @@ -# coding:utf-8 - -import functools -import logging -import sys -import traceback -import warnings - - -# Use module-specific logger with a default null handler. -_logger = logging.getLogger('backoff') -_logger.addHandler(logging.NullHandler()) # pragma: no cover -_logger.setLevel(logging.INFO) - - -# Evaluate arg that can be either a fixed value or a callable. -def _maybe_call(f, *args, **kwargs): - if callable(f): - try: - return f(*args, **kwargs) - except TypeError: - return f - else: - return f - - -def _init_wait_gen(wait_gen, wait_gen_kwargs): - kwargs = {k: _maybe_call(v) for k, v in wait_gen_kwargs.items()} - initialized = wait_gen(**kwargs) - initialized.send(None) # Initialize with an empty send - return initialized - - -def _next_wait(wait, send_value, jitter, elapsed, max_time): - value = wait.send(send_value) - try: - if jitter is not None: - seconds = jitter(value) - else: - seconds = value - except TypeError: - warnings.warn( - "Nullary jitter function signature is deprecated. Use " - "unary signature accepting a wait value in seconds and " - "returning a jittered version of it.", - DeprecationWarning, - stacklevel=2, - ) - - seconds = value + jitter() - - # don't sleep longer than remaining allotted max_time - if max_time is not None: - seconds = min(seconds, max_time - elapsed) - - return seconds - - -def _prepare_logger(logger): - if isinstance(logger, str): - logger = logging.getLogger(logger) - return logger - - -# Configure handler list with user specified handler and optionally -# with a default handler bound to the specified logger. -def _config_handlers( - user_handlers, *, default_handler=None, logger=None, log_level=None -): - handlers = [] - if logger is not None: - assert log_level is not None, "Log level is not specified" - # bind the specified logger to the default log handler - log_handler = functools.partial( - default_handler, logger=logger, log_level=log_level - ) - handlers.append(log_handler) - - if user_handlers is None: - return handlers - - # user specified handlers can either be an iterable of handlers - # or a single handler. either way append them to the list. - if hasattr(user_handlers, '__iter__'): - # add all handlers in the iterable - handlers += list(user_handlers) - else: - # append a single handler - handlers.append(user_handlers) - - return handlers - - -# Default backoff handler -def _log_backoff(details, logger, log_level): - msg = "Backing off %s(...) for %.1fs (%s)" - log_args = [details['target'].__name__, details['wait']] - - exc_typ, exc, _ = sys.exc_info() - if exc is not None: - exc_fmt = traceback.format_exception_only(exc_typ, exc)[-1] - log_args.append(exc_fmt.rstrip("\n")) - else: - log_args.append(details['value']) - logger.log(log_level, msg, *log_args) - - -# Default giveup handler -def _log_giveup(details, logger, log_level): - msg = "Giving up %s(...) after %d tries (%s)" - log_args = [details['target'].__name__, details['tries']] - - exc_typ, exc, _ = sys.exc_info() - if exc is not None: - exc_fmt = traceback.format_exception_only(exc_typ, exc)[-1] - log_args.append(exc_fmt.rstrip("\n")) - else: - log_args.append(details['value']) - - logger.log(log_level, msg, *log_args) diff --git a/opensafely/_vendor/backoff/_decorator.py b/opensafely/_vendor/backoff/_decorator.py deleted file mode 100644 index 9b00857c..00000000 --- a/opensafely/_vendor/backoff/_decorator.py +++ /dev/null @@ -1,222 +0,0 @@ -# coding:utf-8 -import asyncio -import logging -import operator -from typing import Any, Callable, Iterable, Optional, Type, Union - -from opensafely._vendor.backoff._common import ( - _prepare_logger, - _config_handlers, - _log_backoff, - _log_giveup -) -from opensafely._vendor.backoff._jitter import full_jitter -from opensafely._vendor.backoff import _async, _sync -from opensafely._vendor.backoff._typing import ( - _CallableT, - _Handler, - _Jitterer, - _MaybeCallable, - _MaybeLogger, - _MaybeSequence, - _Predicate, - _WaitGenerator, -) - - -def on_predicate(wait_gen: _WaitGenerator, - predicate: _Predicate[Any] = operator.not_, - *, - max_tries: Optional[_MaybeCallable[int]] = None, - max_time: Optional[_MaybeCallable[float]] = None, - jitter: Union[_Jitterer, None] = full_jitter, - on_success: Union[_Handler, Iterable[_Handler]] = None, - on_backoff: Union[_Handler, Iterable[_Handler]] = None, - on_giveup: Union[_Handler, Iterable[_Handler]] = None, - logger: _MaybeLogger = 'backoff', - backoff_log_level: int = logging.INFO, - giveup_log_level: int = logging.ERROR, - **wait_gen_kwargs: Any) -> Callable[[_CallableT], _CallableT]: - """Returns decorator for backoff and retry triggered by predicate. - - Args: - wait_gen: A generator yielding successive wait times in - seconds. - predicate: A function which when called on the return value of - the target function will trigger backoff when considered - truthily. If not specified, the default behavior is to - backoff on falsey return values. - max_tries: The maximum number of attempts to make before giving - up. In the case of failure, the result of the last attempt - will be returned. The default value of None means there - is no limit to the number of tries. If a callable is passed, - it will be evaluated at runtime and its return value used. - max_time: The maximum total amount of time to try for before - giving up. If this time expires, the result of the last - attempt will be returned. If a callable is passed, it will - be evaluated at runtime and its return value used. - jitter: A function of the value yielded by wait_gen returning - the actual time to wait. This distributes wait times - stochastically in order to avoid timing collisions across - concurrent clients. Wait times are jittered by default - using the full_jitter function. Jittering may be disabled - altogether by passing jitter=None. - on_success: Callable (or iterable of callables) with a unary - signature to be called in the event of success. The - parameter is a dict containing details about the invocation. - on_backoff: Callable (or iterable of callables) with a unary - signature to be called in the event of a backoff. The - parameter is a dict containing details about the invocation. - on_giveup: Callable (or iterable of callables) with a unary - signature to be called in the event that max_tries - is exceeded. The parameter is a dict containing details - about the invocation. - logger: Name of logger or Logger object to log to. Defaults to - 'backoff'. - backoff_log_level: log level for the backoff event. Defaults to "INFO" - giveup_log_level: log level for the give up event. Defaults to "ERROR" - **wait_gen_kwargs: Any additional keyword args specified will be - passed to wait_gen when it is initialized. Any callable - args will first be evaluated and their return values passed. - This is useful for runtime configuration. - """ - def decorate(target): - nonlocal logger, on_success, on_backoff, on_giveup - - logger = _prepare_logger(logger) - on_success = _config_handlers(on_success) - on_backoff = _config_handlers( - on_backoff, - default_handler=_log_backoff, - logger=logger, - log_level=backoff_log_level - ) - on_giveup = _config_handlers( - on_giveup, - default_handler=_log_giveup, - logger=logger, - log_level=giveup_log_level - ) - - if asyncio.iscoroutinefunction(target): - retry = _async.retry_predicate - else: - retry = _sync.retry_predicate - - return retry( - target, - wait_gen, - predicate, - max_tries=max_tries, - max_time=max_time, - jitter=jitter, - on_success=on_success, - on_backoff=on_backoff, - on_giveup=on_giveup, - wait_gen_kwargs=wait_gen_kwargs - ) - - # Return a function which decorates a target with a retry loop. - return decorate - - -def on_exception(wait_gen: _WaitGenerator, - exception: _MaybeSequence[Type[Exception]], - *, - max_tries: Optional[_MaybeCallable[int]] = None, - max_time: Optional[_MaybeCallable[float]] = None, - jitter: Union[_Jitterer, None] = full_jitter, - giveup: _Predicate[Exception] = lambda e: False, - on_success: Union[_Handler, Iterable[_Handler]] = None, - on_backoff: Union[_Handler, Iterable[_Handler]] = None, - on_giveup: Union[_Handler, Iterable[_Handler]] = None, - raise_on_giveup: bool = True, - logger: _MaybeLogger = 'backoff', - backoff_log_level: int = logging.INFO, - giveup_log_level: int = logging.ERROR, - **wait_gen_kwargs: Any) -> Callable[[_CallableT], _CallableT]: - """Returns decorator for backoff and retry triggered by exception. - - Args: - wait_gen: A generator yielding successive wait times in - seconds. - exception: An exception type (or tuple of types) which triggers - backoff. - max_tries: The maximum number of attempts to make before giving - up. Once exhausted, the exception will be allowed to escape. - The default value of None means there is no limit to the - number of tries. If a callable is passed, it will be - evaluated at runtime and its return value used. - max_time: The maximum total amount of time to try for before - giving up. Once expired, the exception will be allowed to - escape. If a callable is passed, it will be - evaluated at runtime and its return value used. - jitter: A function of the value yielded by wait_gen returning - the actual time to wait. This distributes wait times - stochastically in order to avoid timing collisions across - concurrent clients. Wait times are jittered by default - using the full_jitter function. Jittering may be disabled - altogether by passing jitter=None. - giveup: Function accepting an exception instance and - returning whether or not to give up. Optional. The default - is to always continue. - on_success: Callable (or iterable of callables) with a unary - signature to be called in the event of success. The - parameter is a dict containing details about the invocation. - on_backoff: Callable (or iterable of callables) with a unary - signature to be called in the event of a backoff. The - parameter is a dict containing details about the invocation. - on_giveup: Callable (or iterable of callables) with a unary - signature to be called in the event that max_tries - is exceeded. The parameter is a dict containing details - about the invocation. - raise_on_giveup: Boolean indicating whether the registered exceptions - should be raised on giveup. Defaults to `True` - logger: Name or Logger object to log to. Defaults to 'backoff'. - backoff_log_level: log level for the backoff event. Defaults to "INFO" - giveup_log_level: log level for the give up event. Defaults to "ERROR" - **wait_gen_kwargs: Any additional keyword args specified will be - passed to wait_gen when it is initialized. Any callable - args will first be evaluated and their return values passed. - This is useful for runtime configuration. - """ - def decorate(target): - nonlocal logger, on_success, on_backoff, on_giveup - - logger = _prepare_logger(logger) - on_success = _config_handlers(on_success) - on_backoff = _config_handlers( - on_backoff, - default_handler=_log_backoff, - logger=logger, - log_level=backoff_log_level, - ) - on_giveup = _config_handlers( - on_giveup, - default_handler=_log_giveup, - logger=logger, - log_level=giveup_log_level, - ) - - if asyncio.iscoroutinefunction(target): - retry = _async.retry_exception - else: - retry = _sync.retry_exception - - return retry( - target, - wait_gen, - exception, - max_tries=max_tries, - max_time=max_time, - jitter=jitter, - giveup=giveup, - on_success=on_success, - on_backoff=on_backoff, - on_giveup=on_giveup, - raise_on_giveup=raise_on_giveup, - wait_gen_kwargs=wait_gen_kwargs - ) - - # Return a function which decorates a target with a retry loop. - return decorate diff --git a/opensafely/_vendor/backoff/_jitter.py b/opensafely/_vendor/backoff/_jitter.py deleted file mode 100644 index be7e3892..00000000 --- a/opensafely/_vendor/backoff/_jitter.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding:utf-8 - -import random - - -def random_jitter(value: float) -> float: - """Jitter the value a random number of milliseconds. - - This adds up to 1 second of additional time to the original value. - Prior to backoff version 1.2 this was the default jitter behavior. - - Args: - value: The unadulterated backoff value. - """ - return value + random.random() - - -def full_jitter(value: float) -> float: - """Jitter the value across the full range (0 to value). - - This corresponds to the "Full Jitter" algorithm specified in the - AWS blog's post on the performance of various jitter algorithms. - (http://www.awsarchitectureblog.com/2015/03/backoff.html) - - Args: - value: The unadulterated backoff value. - """ - return random.uniform(0, value) diff --git a/opensafely/_vendor/backoff/_sync.py b/opensafely/_vendor/backoff/_sync.py deleted file mode 100644 index bd230bca..00000000 --- a/opensafely/_vendor/backoff/_sync.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding:utf-8 -import datetime -import functools -import time -from datetime import timedelta - -from opensafely._vendor.backoff._common import (_init_wait_gen, _maybe_call, _next_wait) - - -def _call_handlers(hdlrs, target, args, kwargs, tries, elapsed, **extra): - details = { - 'target': target, - 'args': args, - 'kwargs': kwargs, - 'tries': tries, - 'elapsed': elapsed, - } - details.update(extra) - for hdlr in hdlrs: - hdlr(details) - - -def retry_predicate(target, wait_gen, predicate, - *, - max_tries, max_time, jitter, - on_success, on_backoff, on_giveup, - wait_gen_kwargs): - - @functools.wraps(target) - def retry(*args, **kwargs): - max_tries_value = _maybe_call(max_tries) - max_time_value = _maybe_call(max_time) - - tries = 0 - start = datetime.datetime.now() - wait = _init_wait_gen(wait_gen, wait_gen_kwargs) - while True: - tries += 1 - elapsed = timedelta.total_seconds(datetime.datetime.now() - start) - details = { - "target": target, - "args": args, - "kwargs": kwargs, - "tries": tries, - "elapsed": elapsed, - } - - ret = target(*args, **kwargs) - if predicate(ret): - max_tries_exceeded = (tries == max_tries_value) - max_time_exceeded = (max_time_value is not None and - elapsed >= max_time_value) - - if max_tries_exceeded or max_time_exceeded: - _call_handlers(on_giveup, **details, value=ret) - break - - try: - seconds = _next_wait(wait, ret, jitter, elapsed, - max_time_value) - except StopIteration: - _call_handlers(on_giveup, **details) - break - - _call_handlers(on_backoff, **details, - value=ret, wait=seconds) - - time.sleep(seconds) - continue - else: - _call_handlers(on_success, **details, value=ret) - break - - return ret - - return retry - - -def retry_exception(target, wait_gen, exception, - *, - max_tries, max_time, jitter, giveup, - on_success, on_backoff, on_giveup, raise_on_giveup, - wait_gen_kwargs): - - @functools.wraps(target) - def retry(*args, **kwargs): - max_tries_value = _maybe_call(max_tries) - max_time_value = _maybe_call(max_time) - - tries = 0 - start = datetime.datetime.now() - wait = _init_wait_gen(wait_gen, wait_gen_kwargs) - while True: - tries += 1 - elapsed = timedelta.total_seconds(datetime.datetime.now() - start) - details = { - "target": target, - "args": args, - "kwargs": kwargs, - "tries": tries, - "elapsed": elapsed, - } - - try: - ret = target(*args, **kwargs) - except exception as e: - max_tries_exceeded = (tries == max_tries_value) - max_time_exceeded = (max_time_value is not None and - elapsed >= max_time_value) - - if giveup(e) or max_tries_exceeded or max_time_exceeded: - _call_handlers(on_giveup, **details) - if raise_on_giveup: - raise - return None - - try: - seconds = _next_wait(wait, e, jitter, elapsed, - max_time_value) - except StopIteration: - _call_handlers(on_giveup, **details) - raise e - - _call_handlers(on_backoff, **details, wait=seconds) - - time.sleep(seconds) - else: - _call_handlers(on_success, **details) - - return ret - return retry diff --git a/opensafely/_vendor/backoff/_typing.py b/opensafely/_vendor/backoff/_typing.py deleted file mode 100644 index 04daf8dd..00000000 --- a/opensafely/_vendor/backoff/_typing.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding:utf-8 -import logging -import sys -from typing import (Any, Callable, Dict, Generator, Sequence, Tuple, Union, - TypeVar) - - -details_kwargs = {"total": False} - -if sys.version_info >= (3, 8): # pragma: no cover - from typing import TypedDict -else: # pragma: no cover - # use typing_extensions if installed but don't require it - try: - from opensafely._vendor.typing_extensions import TypedDict - except ImportError: - TypedDict = Dict[str, Any] - del details_kwargs["total"] - - -class _Details(TypedDict): - target: Callable[..., Any] - args: Tuple[Any, ...] - kwargs: Dict[str, Any] - tries: int - elapsed: float - - -class Details(_Details, **details_kwargs): - wait: float # present in the on_backoff handler case for either decorator - value: Any # present in the on_predicate decorator case - - -T = TypeVar("T") - -_CallableT = TypeVar('_CallableT', bound=Callable[..., Any]) -_Handler = Callable[[Details], None] -_Jitterer = Callable[[float], float] -_MaybeCallable = Union[T, Callable[[], T]] -_MaybeLogger = Union[str, logging.Logger, None] -_MaybeSequence = Union[T, Sequence[T]] -_Predicate = Callable[[T], bool] -_WaitGenerator = Callable[..., Generator[float, None, None]] diff --git a/opensafely/_vendor/backoff/_wait_gen.py b/opensafely/_vendor/backoff/_wait_gen.py deleted file mode 100644 index aee05c58..00000000 --- a/opensafely/_vendor/backoff/_wait_gen.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding:utf-8 - -import itertools -from typing import Any, Callable, Generator, Iterable, Optional, Union - - -def expo( - base: int = 2, - factor: int = 1, - max_value: Optional[int] = None -) -> Generator[int, Any, None]: - - """Generator for exponential decay. - - Args: - base: The mathematical base of the exponentiation operation - factor: Factor to multiply the exponentiation by. - max_value: The maximum value to yield. Once the value in the - true exponential sequence exceeds this, the value - of max_value will forever after be yielded. - """ - # Advance past initial .send() call - yield # type: ignore[misc] - n = 0 - while True: - a = factor * base ** n - if max_value is None or a < max_value: - yield a - n += 1 - else: - yield max_value - - -def fibo(max_value: Optional[int] = None) -> Generator[int, None, None]: - """Generator for fibonaccial decay. - - Args: - max_value: The maximum value to yield. Once the value in the - true fibonacci sequence exceeds this, the value - of max_value will forever after be yielded. - """ - # Advance past initial .send() call - yield # type: ignore[misc] - - a = 1 - b = 1 - while True: - if max_value is None or a < max_value: - yield a - a, b = b, a + b - else: - yield max_value - - -def constant( - interval: Union[int, Iterable[int]] = 1 -) -> Generator[int, None, None]: - """Generator for constant intervals. - - Args: - interval: A constant value to yield or an iterable of such values. - """ - # Advance past initial .send() call - yield # type: ignore[misc] - - try: - itr = iter(interval) # type: ignore - except TypeError: - itr = itertools.repeat(interval) # type: ignore - - for val in itr: - yield val - - -def runtime(*, value: Callable[[Any], int]) -> Generator[int, None, None]: - """Generator that is based on parsing the return value or thrown - exception of the decorated method - - Args: - value: a callable which takes as input the decorated - function's return value or thrown exception and - determines how long to wait - """ - ret_or_exc = yield # type: ignore[misc] - while True: - ret_or_exc = yield value(ret_or_exc) diff --git a/opensafely/_vendor/backoff/py.typed b/opensafely/_vendor/backoff/py.typed deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/backoff/types.py b/opensafely/_vendor/backoff/types.py deleted file mode 100644 index 25f20a4c..00000000 --- a/opensafely/_vendor/backoff/types.py +++ /dev/null @@ -1,6 +0,0 @@ -# coding:utf-8 -from ._typing import Details - -__all__ = [ - 'Details' -] diff --git a/opensafely/_vendor/google.pyi b/opensafely/_vendor/google.pyi deleted file mode 100644 index 372b6818..00000000 --- a/opensafely/_vendor/google.pyi +++ /dev/null @@ -1 +0,0 @@ -from google import * \ No newline at end of file diff --git a/opensafely/_vendor/google/api/__init__.py b/opensafely/_vendor/google/api/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/api/annotations.proto b/opensafely/_vendor/google/api/annotations.proto deleted file mode 100644 index efdab3db..00000000 --- a/opensafely/_vendor/google/api/annotations.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/api/http.proto"; -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "AnnotationsProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // See `HttpRule`. - HttpRule http = 72295728; -} diff --git a/opensafely/_vendor/google/api/annotations_pb2.py b/opensafely/_vendor/google/api/annotations_pb2.py deleted file mode 100644 index 98b6548c..00000000 --- a/opensafely/_vendor/google/api/annotations_pb2.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/annotations.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.api import http_pb2 as google_dot_api_dot_http__pb2 -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1cgoogle/api/annotations.proto\x12\ngoogle.api\x1a\x15google/api/http.proto\x1a google/protobuf/descriptor.proto:E\n\x04http\x12\x1e.google.protobuf.MethodOptions\x18\xb0\xca\xbc" \x01(\x0b\x32\x14.google.api.HttpRuleBn\n\x0e\x63om.google.apiB\x10\x41nnotationsProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x04GAPIb\x06proto3' -) - - -HTTP_FIELD_NUMBER = 72295728 -http = DESCRIPTOR.extensions_by_name["http"] - -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension(http) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\020AnnotationsProtoP\001ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\242\002\004GAPI" -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/auth.proto b/opensafely/_vendor/google/api/auth.proto deleted file mode 100644 index 54026e1a..00000000 --- a/opensafely/_vendor/google/api/auth.proto +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "AuthProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Authentication` defines the authentication configuration for API methods -// provided by an API service. -// -// Example: -// -// name: calendar.googleapis.com -// authentication: -// providers: -// - id: google_calendar_auth -// jwks_uri: https://www.googleapis.com/oauth2/v1/certs -// issuer: https://securetoken.google.com -// rules: -// - selector: "*" -// requirements: -// provider_id: google_calendar_auth -// - selector: google.calendar.Delegate -// oauth: -// canonical_scopes: https://www.googleapis.com/auth/calendar.read -message Authentication { - // A list of authentication rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated AuthenticationRule rules = 3; - - // Defines a set of authentication providers that a service supports. - repeated AuthProvider providers = 4; -} - -// Authentication rules for the service. -// -// By default, if a method has any authentication requirements, every request -// must include a valid credential matching one of the requirements. -// It's an error to include more than one kind of credential in a single -// request. -// -// If a method doesn't have any auth requirements, request credentials will be -// ignored. -message AuthenticationRule { - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // The requirements for OAuth credentials. - OAuthRequirements oauth = 2; - - // If true, the service accepts API keys without any other credential. - // This flag only applies to HTTP and gRPC requests. - bool allow_without_credential = 5; - - // Requirements for additional authentication providers. - repeated AuthRequirement requirements = 7; -} - -// Specifies a location to extract JWT from an API request. -message JwtLocation { - oneof in { - // Specifies HTTP header name to extract JWT token. - string header = 1; - - // Specifies URL query parameter name to extract JWT token. - string query = 2; - } - - // The value prefix. The value format is "value_prefix{token}" - // Only applies to "in" header type. Must be empty for "in" query type. - // If not empty, the header value has to match (case sensitive) this prefix. - // If not matched, JWT will not be extracted. If matched, JWT will be - // extracted after the prefix is removed. - // - // For example, for "Authorization: Bearer {JWT}", - // value_prefix="Bearer " with a space at the end. - string value_prefix = 3; -} - -// Configuration for an authentication provider, including support for -// [JSON Web Token -// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). -message AuthProvider { - // The unique identifier of the auth provider. It will be referred to by - // `AuthRequirement.provider_id`. - // - // Example: "bookstore_auth". - string id = 1; - - // Identifies the principal that issued the JWT. See - // https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 - // Usually a URL or an email address. - // - // Example: https://securetoken.google.com - // Example: 1234567-compute@developer.gserviceaccount.com - string issuer = 2; - - // URL of the provider's public key set to validate signature of the JWT. See - // [OpenID - // Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). - // Optional if the key set document: - // - can be retrieved from - // [OpenID - // Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html) - // of the issuer. - // - can be inferred from the email domain of the issuer (e.g. a Google - // service account). - // - // Example: https://www.googleapis.com/oauth2/v1/certs - string jwks_uri = 3; - - // The list of JWT - // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). - // that are allowed to access. A JWT containing any of these audiences will - // be accepted. When this setting is absent, JWTs with audiences: - // - "https://[service.name]/[google.protobuf.Api.name]" - // - "https://[service.name]/" - // will be accepted. - // For example, if no audiences are in the setting, LibraryService API will - // accept JWTs with the following audiences: - // - - // https://library-example.googleapis.com/google.example.library.v1.LibraryService - // - https://library-example.googleapis.com/ - // - // Example: - // - // audiences: bookstore_android.apps.googleusercontent.com, - // bookstore_web.apps.googleusercontent.com - string audiences = 4; - - // Redirect URL if JWT token is required but not present or is expired. - // Implement authorizationUrl of securityDefinitions in OpenAPI spec. - string authorization_url = 5; - - // Defines the locations to extract the JWT. - // - // JWT locations can be either from HTTP headers or URL query parameters. - // The rule is that the first match wins. The checking order is: checking - // all headers first, then URL query parameters. - // - // If not specified, default to use following 3 locations: - // 1) Authorization: Bearer - // 2) x-goog-iap-jwt-assertion - // 3) access_token query parameter - // - // Default locations can be specified as followings: - // jwt_locations: - // - header: Authorization - // value_prefix: "Bearer " - // - header: x-goog-iap-jwt-assertion - // - query: access_token - repeated JwtLocation jwt_locations = 6; -} - -// OAuth scopes are a way to define data and permissions on data. For example, -// there are scopes defined for "Read-only access to Google Calendar" and -// "Access to Cloud Platform". Users can consent to a scope for an application, -// giving it permission to access that data on their behalf. -// -// OAuth scope specifications should be fairly coarse grained; a user will need -// to see and understand the text description of what your scope means. -// -// In most cases: use one or at most two OAuth scopes for an entire family of -// products. If your product has multiple APIs, you should probably be sharing -// the OAuth scope across all of those APIs. -// -// When you need finer grained OAuth consent screens: talk with your product -// management about how developers will use them in practice. -// -// Please note that even though each of the canonical scopes is enough for a -// request to be accepted and passed to the backend, a request can still fail -// due to the backend requiring additional scopes or permissions. -message OAuthRequirements { - // The list of publicly documented OAuth scopes that are allowed access. An - // OAuth token containing any of these scopes will be accepted. - // - // Example: - // - // canonical_scopes: https://www.googleapis.com/auth/calendar, - // https://www.googleapis.com/auth/calendar.read - string canonical_scopes = 1; -} - -// User-defined authentication requirements, including support for -// [JSON Web Token -// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). -message AuthRequirement { - // [id][google.api.AuthProvider.id] from authentication provider. - // - // Example: - // - // provider_id: bookstore_auth - string provider_id = 1; - - // NOTE: This will be deprecated soon, once AuthProvider.audiences is - // implemented and accepted in all the runtime components. - // - // The list of JWT - // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). - // that are allowed to access. A JWT containing any of these audiences will - // be accepted. When this setting is absent, only JWTs with audience - // "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" - // will be accepted. For example, if no audiences are in the setting, - // LibraryService API will only accept JWTs with the following audience - // "https://library-example.googleapis.com/google.example.library.v1.LibraryService". - // - // Example: - // - // audiences: bookstore_android.apps.googleusercontent.com, - // bookstore_web.apps.googleusercontent.com - string audiences = 2; -} diff --git a/opensafely/_vendor/google/api/auth_pb2.py b/opensafely/_vendor/google/api/auth_pb2.py deleted file mode 100644 index 3ff9e33a..00000000 --- a/opensafely/_vendor/google/api/auth_pb2.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/auth.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x15google/api/auth.proto\x12\ngoogle.api"l\n\x0e\x41uthentication\x12-\n\x05rules\x18\x03 \x03(\x0b\x32\x1e.google.api.AuthenticationRule\x12+\n\tproviders\x18\x04 \x03(\x0b\x32\x18.google.api.AuthProvider"\xa9\x01\n\x12\x41uthenticationRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12,\n\x05oauth\x18\x02 \x01(\x0b\x32\x1d.google.api.OAuthRequirements\x12 \n\x18\x61llow_without_credential\x18\x05 \x01(\x08\x12\x31\n\x0crequirements\x18\x07 \x03(\x0b\x32\x1b.google.api.AuthRequirement"L\n\x0bJwtLocation\x12\x10\n\x06header\x18\x01 \x01(\tH\x00\x12\x0f\n\x05query\x18\x02 \x01(\tH\x00\x12\x14\n\x0cvalue_prefix\x18\x03 \x01(\tB\x04\n\x02in"\x9a\x01\n\x0c\x41uthProvider\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06issuer\x18\x02 \x01(\t\x12\x10\n\x08jwks_uri\x18\x03 \x01(\t\x12\x11\n\taudiences\x18\x04 \x01(\t\x12\x19\n\x11\x61uthorization_url\x18\x05 \x01(\t\x12.\n\rjwt_locations\x18\x06 \x03(\x0b\x32\x17.google.api.JwtLocation"-\n\x11OAuthRequirements\x12\x18\n\x10\x63\x61nonical_scopes\x18\x01 \x01(\t"9\n\x0f\x41uthRequirement\x12\x13\n\x0bprovider_id\x18\x01 \x01(\t\x12\x11\n\taudiences\x18\x02 \x01(\tBk\n\x0e\x63om.google.apiB\tAuthProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_AUTHENTICATION = DESCRIPTOR.message_types_by_name["Authentication"] -_AUTHENTICATIONRULE = DESCRIPTOR.message_types_by_name["AuthenticationRule"] -_JWTLOCATION = DESCRIPTOR.message_types_by_name["JwtLocation"] -_AUTHPROVIDER = DESCRIPTOR.message_types_by_name["AuthProvider"] -_OAUTHREQUIREMENTS = DESCRIPTOR.message_types_by_name["OAuthRequirements"] -_AUTHREQUIREMENT = DESCRIPTOR.message_types_by_name["AuthRequirement"] -Authentication = _reflection.GeneratedProtocolMessageType( - "Authentication", - (_message.Message,), - { - "DESCRIPTOR": _AUTHENTICATION, - "__module__": "google.api.auth_pb2" - # @@protoc_insertion_point(class_scope:google.api.Authentication) - }, -) -_sym_db.RegisterMessage(Authentication) - -AuthenticationRule = _reflection.GeneratedProtocolMessageType( - "AuthenticationRule", - (_message.Message,), - { - "DESCRIPTOR": _AUTHENTICATIONRULE, - "__module__": "google.api.auth_pb2" - # @@protoc_insertion_point(class_scope:google.api.AuthenticationRule) - }, -) -_sym_db.RegisterMessage(AuthenticationRule) - -JwtLocation = _reflection.GeneratedProtocolMessageType( - "JwtLocation", - (_message.Message,), - { - "DESCRIPTOR": _JWTLOCATION, - "__module__": "google.api.auth_pb2" - # @@protoc_insertion_point(class_scope:google.api.JwtLocation) - }, -) -_sym_db.RegisterMessage(JwtLocation) - -AuthProvider = _reflection.GeneratedProtocolMessageType( - "AuthProvider", - (_message.Message,), - { - "DESCRIPTOR": _AUTHPROVIDER, - "__module__": "google.api.auth_pb2" - # @@protoc_insertion_point(class_scope:google.api.AuthProvider) - }, -) -_sym_db.RegisterMessage(AuthProvider) - -OAuthRequirements = _reflection.GeneratedProtocolMessageType( - "OAuthRequirements", - (_message.Message,), - { - "DESCRIPTOR": _OAUTHREQUIREMENTS, - "__module__": "google.api.auth_pb2" - # @@protoc_insertion_point(class_scope:google.api.OAuthRequirements) - }, -) -_sym_db.RegisterMessage(OAuthRequirements) - -AuthRequirement = _reflection.GeneratedProtocolMessageType( - "AuthRequirement", - (_message.Message,), - { - "DESCRIPTOR": _AUTHREQUIREMENT, - "__module__": "google.api.auth_pb2" - # @@protoc_insertion_point(class_scope:google.api.AuthRequirement) - }, -) -_sym_db.RegisterMessage(AuthRequirement) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\tAuthProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _AUTHENTICATION._serialized_start = 37 - _AUTHENTICATION._serialized_end = 145 - _AUTHENTICATIONRULE._serialized_start = 148 - _AUTHENTICATIONRULE._serialized_end = 317 - _JWTLOCATION._serialized_start = 319 - _JWTLOCATION._serialized_end = 395 - _AUTHPROVIDER._serialized_start = 398 - _AUTHPROVIDER._serialized_end = 552 - _OAUTHREQUIREMENTS._serialized_start = 554 - _OAUTHREQUIREMENTS._serialized_end = 599 - _AUTHREQUIREMENT._serialized_start = 601 - _AUTHREQUIREMENT._serialized_end = 658 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/backend.proto b/opensafely/_vendor/google/api/backend.proto deleted file mode 100644 index da387869..00000000 --- a/opensafely/_vendor/google/api/backend.proto +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "BackendProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Backend` defines the backend configuration for a service. -message Backend { - // A list of API backend rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated BackendRule rules = 1; -} - -// A backend rule provides configuration for an individual API element. -message BackendRule { - // Path Translation specifies how to combine the backend address with the - // request path in order to produce the appropriate forwarding URL for the - // request. - // - // Path Translation is applicable only to HTTP-based backends. Backends which - // do not accept requests over HTTP/HTTPS should leave `path_translation` - // unspecified. - enum PathTranslation { - PATH_TRANSLATION_UNSPECIFIED = 0; - - // Use the backend address as-is, with no modification to the path. If the - // URL pattern contains variables, the variable names and values will be - // appended to the query string. If a query string parameter and a URL - // pattern variable have the same name, this may result in duplicate keys in - // the query string. - // - // # Examples - // - // Given the following operation config: - // - // Method path: /api/company/{cid}/user/{uid} - // Backend address: https://example.cloudfunctions.net/getUser - // - // Requests to the following request paths will call the backend at the - // translated path: - // - // Request path: /api/company/widgetworks/user/johndoe - // Translated: - // https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe - // - // Request path: /api/company/widgetworks/user/johndoe?timezone=EST - // Translated: - // https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe - CONSTANT_ADDRESS = 1; - - // The request path will be appended to the backend address. - // - // # Examples - // - // Given the following operation config: - // - // Method path: /api/company/{cid}/user/{uid} - // Backend address: https://example.appspot.com - // - // Requests to the following request paths will call the backend at the - // translated path: - // - // Request path: /api/company/widgetworks/user/johndoe - // Translated: - // https://example.appspot.com/api/company/widgetworks/user/johndoe - // - // Request path: /api/company/widgetworks/user/johndoe?timezone=EST - // Translated: - // https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST - APPEND_PATH_TO_ADDRESS = 2; - } - - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // The address of the API backend. - // - // The scheme is used to determine the backend protocol and security. - // The following schemes are accepted: - // - // SCHEME PROTOCOL SECURITY - // http:// HTTP None - // https:// HTTP TLS - // grpc:// gRPC None - // grpcs:// gRPC TLS - // - // It is recommended to explicitly include a scheme. Leaving out the scheme - // may cause constrasting behaviors across platforms. - // - // If the port is unspecified, the default is: - // - 80 for schemes without TLS - // - 443 for schemes with TLS - // - // For HTTP backends, use [protocol][google.api.BackendRule.protocol] - // to specify the protocol version. - string address = 2; - - // The number of seconds to wait for a response from a request. The default - // varies based on the request protocol and deployment environment. - double deadline = 3; - - // Minimum deadline in seconds needed for this method. Calls having deadline - // value lower than this will be rejected. - double min_deadline = 4; - - // The number of seconds to wait for the completion of a long running - // operation. The default is no deadline. - double operation_deadline = 5; - - PathTranslation path_translation = 6; - - // Authentication settings used by the backend. - // - // These are typically used to provide service management functionality to - // a backend served on a publicly-routable URL. The `authentication` - // details should match the authentication behavior used by the backend. - // - // For example, specifying `jwt_audience` implies that the backend expects - // authentication via a JWT. - // - // When authentication is unspecified, the resulting behavior is the same - // as `disable_auth` set to `true`. - // - // Refer to https://developers.google.com/identity/protocols/OpenIDConnect for - // JWT ID token. - oneof authentication { - // The JWT audience is used when generating a JWT ID token for the backend. - // This ID token will be added in the HTTP "authorization" header, and sent - // to the backend. - string jwt_audience = 7; - - // When disable_auth is true, a JWT ID token won't be generated and the - // original "Authorization" HTTP header will be preserved. If the header is - // used to carry the original token and is expected by the backend, this - // field must be set to true to preserve the header. - bool disable_auth = 8; - } - - // The protocol used for sending a request to the backend. - // The supported values are "http/1.1" and "h2". - // - // The default value is inferred from the scheme in the - // [address][google.api.BackendRule.address] field: - // - // SCHEME PROTOCOL - // http:// http/1.1 - // https:// http/1.1 - // grpc:// h2 - // grpcs:// h2 - // - // For secure HTTP backends (https://) that support HTTP/2, set this field - // to "h2" for improved performance. - // - // Configuring this field to non-default values is only supported for secure - // HTTP backends. This field will be ignored for all other backends. - // - // See - // https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids - // for more details on the supported values. - string protocol = 9; -} diff --git a/opensafely/_vendor/google/api/backend_pb2.py b/opensafely/_vendor/google/api/backend_pb2.py deleted file mode 100644 index 5cfefe7c..00000000 --- a/opensafely/_vendor/google/api/backend_pb2.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/backend.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x18google/api/backend.proto\x12\ngoogle.api"1\n\x07\x42\x61\x63kend\x12&\n\x05rules\x18\x01 \x03(\x0b\x32\x17.google.api.BackendRule"\xf2\x02\n\x0b\x42\x61\x63kendRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x10\n\x08\x64\x65\x61\x64line\x18\x03 \x01(\x01\x12\x14\n\x0cmin_deadline\x18\x04 \x01(\x01\x12\x1a\n\x12operation_deadline\x18\x05 \x01(\x01\x12\x41\n\x10path_translation\x18\x06 \x01(\x0e\x32\'.google.api.BackendRule.PathTranslation\x12\x16\n\x0cjwt_audience\x18\x07 \x01(\tH\x00\x12\x16\n\x0c\x64isable_auth\x18\x08 \x01(\x08H\x00\x12\x10\n\x08protocol\x18\t \x01(\t"e\n\x0fPathTranslation\x12 \n\x1cPATH_TRANSLATION_UNSPECIFIED\x10\x00\x12\x14\n\x10\x43ONSTANT_ADDRESS\x10\x01\x12\x1a\n\x16\x41PPEND_PATH_TO_ADDRESS\x10\x02\x42\x10\n\x0e\x61uthenticationBn\n\x0e\x63om.google.apiB\x0c\x42\x61\x63kendProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_BACKEND = DESCRIPTOR.message_types_by_name["Backend"] -_BACKENDRULE = DESCRIPTOR.message_types_by_name["BackendRule"] -_BACKENDRULE_PATHTRANSLATION = _BACKENDRULE.enum_types_by_name["PathTranslation"] -Backend = _reflection.GeneratedProtocolMessageType( - "Backend", - (_message.Message,), - { - "DESCRIPTOR": _BACKEND, - "__module__": "google.api.backend_pb2" - # @@protoc_insertion_point(class_scope:google.api.Backend) - }, -) -_sym_db.RegisterMessage(Backend) - -BackendRule = _reflection.GeneratedProtocolMessageType( - "BackendRule", - (_message.Message,), - { - "DESCRIPTOR": _BACKENDRULE, - "__module__": "google.api.backend_pb2" - # @@protoc_insertion_point(class_scope:google.api.BackendRule) - }, -) -_sym_db.RegisterMessage(BackendRule) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\014BackendProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _BACKEND._serialized_start = 40 - _BACKEND._serialized_end = 89 - _BACKENDRULE._serialized_start = 92 - _BACKENDRULE._serialized_end = 462 - _BACKENDRULE_PATHTRANSLATION._serialized_start = 343 - _BACKENDRULE_PATHTRANSLATION._serialized_end = 444 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/billing.proto b/opensafely/_vendor/google/api/billing.proto deleted file mode 100644 index e94c2ec5..00000000 --- a/opensafely/_vendor/google/api/billing.proto +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "BillingProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Billing related configuration of the service. -// -// The following example shows how to configure monitored resources and metrics -// for billing, `consumer_destinations` is the only supported destination and -// the monitored resources need at least one label key -// `cloud.googleapis.com/location` to indicate the location of the billing -// usage, using different monitored resources between monitoring and billing is -// recommended so they can be evolved independently: -// -// -// monitored_resources: -// - type: library.googleapis.com/billing_branch -// labels: -// - key: cloud.googleapis.com/location -// description: | -// Predefined label to support billing location restriction. -// - key: city -// description: | -// Custom label to define the city where the library branch is located -// in. -// - key: name -// description: Custom label to define the name of the library branch. -// metrics: -// - name: library.googleapis.com/book/borrowed_count -// metric_kind: DELTA -// value_type: INT64 -// unit: "1" -// billing: -// consumer_destinations: -// - monitored_resource: library.googleapis.com/billing_branch -// metrics: -// - library.googleapis.com/book/borrowed_count -message Billing { - // Configuration of a specific billing destination (Currently only support - // bill against consumer project). - message BillingDestination { - // The monitored resource type. The type must be defined in - // [Service.monitored_resources][google.api.Service.monitored_resources] section. - string monitored_resource = 1; - - // Names of the metrics to report to this billing destination. - // Each name must be defined in [Service.metrics][google.api.Service.metrics] section. - repeated string metrics = 2; - } - - // Billing configurations for sending metrics to the consumer project. - // There can be multiple consumer destinations per service, each one must have - // a different monitored resource type. A metric can be used in at most - // one consumer destination. - repeated BillingDestination consumer_destinations = 8; -} diff --git a/opensafely/_vendor/google/api/billing_pb2.py b/opensafely/_vendor/google/api/billing_pb2.py deleted file mode 100644 index f1c7a37f..00000000 --- a/opensafely/_vendor/google/api/billing_pb2.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/billing.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x18google/api/billing.proto\x12\ngoogle.api"\x93\x01\n\x07\x42illing\x12\x45\n\x15\x63onsumer_destinations\x18\x08 \x03(\x0b\x32&.google.api.Billing.BillingDestination\x1a\x41\n\x12\x42illingDestination\x12\x1a\n\x12monitored_resource\x18\x01 \x01(\t\x12\x0f\n\x07metrics\x18\x02 \x03(\tBn\n\x0e\x63om.google.apiB\x0c\x42illingProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_BILLING = DESCRIPTOR.message_types_by_name["Billing"] -_BILLING_BILLINGDESTINATION = _BILLING.nested_types_by_name["BillingDestination"] -Billing = _reflection.GeneratedProtocolMessageType( - "Billing", - (_message.Message,), - { - "BillingDestination": _reflection.GeneratedProtocolMessageType( - "BillingDestination", - (_message.Message,), - { - "DESCRIPTOR": _BILLING_BILLINGDESTINATION, - "__module__": "google.api.billing_pb2" - # @@protoc_insertion_point(class_scope:google.api.Billing.BillingDestination) - }, - ), - "DESCRIPTOR": _BILLING, - "__module__": "google.api.billing_pb2" - # @@protoc_insertion_point(class_scope:google.api.Billing) - }, -) -_sym_db.RegisterMessage(Billing) -_sym_db.RegisterMessage(Billing.BillingDestination) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\014BillingProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _BILLING._serialized_start = 41 - _BILLING._serialized_end = 188 - _BILLING_BILLINGDESTINATION._serialized_start = 123 - _BILLING_BILLINGDESTINATION._serialized_end = 188 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/client.proto b/opensafely/_vendor/google/api/client.proto deleted file mode 100644 index 3b3fd0c4..00000000 --- a/opensafely/_vendor/google/api/client.proto +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2018 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "ClientProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // A definition of a client library method signature. - // - // In client libraries, each proto RPC corresponds to one or more methods - // which the end user is able to call, and calls the underlying RPC. - // Normally, this method receives a single argument (a struct or instance - // corresponding to the RPC request object). Defining this field will - // add one or more overloads providing flattened or simpler method signatures - // in some languages. - // - // The fields on the method signature are provided as a comma-separated - // string. - // - // For example, the proto RPC and annotation: - // - // rpc CreateSubscription(CreateSubscriptionRequest) - // returns (Subscription) { - // option (google.api.method_signature) = "name,topic"; - // } - // - // Would add the following Java overload (in addition to the method accepting - // the request object): - // - // public final Subscription createSubscription(String name, String topic) - // - // The following backwards-compatibility guidelines apply: - // - // * Adding this annotation to an unannotated method is backwards - // compatible. - // * Adding this annotation to a method which already has existing - // method signature annotations is backwards compatible if and only if - // the new method signature annotation is last in the sequence. - // * Modifying or removing an existing method signature annotation is - // a breaking change. - // * Re-ordering existing method signature annotations is a breaking - // change. - repeated string method_signature = 1051; -} - -extend google.protobuf.ServiceOptions { - // The hostname for this service. - // This should be specified with no prefix or protocol. - // - // Example: - // - // service Foo { - // option (google.api.default_host) = "foo.googleapi.com"; - // ... - // } - string default_host = 1049; - - // OAuth scopes needed for the client. - // - // Example: - // - // service Foo { - // option (google.api.oauth_scopes) = \ - // "https://www.googleapis.com/auth/cloud-platform"; - // ... - // } - // - // If there is more than one scope, use a comma-separated string: - // - // Example: - // - // service Foo { - // option (google.api.oauth_scopes) = \ - // "https://www.googleapis.com/auth/cloud-platform," - // "https://www.googleapis.com/auth/monitoring"; - // ... - // } - string oauth_scopes = 1050; -} diff --git a/opensafely/_vendor/google/api/client_pb2.py b/opensafely/_vendor/google/api/client_pb2.py deleted file mode 100644 index 168534b0..00000000 --- a/opensafely/_vendor/google/api/client_pb2.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/client.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n\x17google/api/client.proto\x12\ngoogle.api\x1a google/protobuf/descriptor.proto:9\n\x10method_signature\x12\x1e.google.protobuf.MethodOptions\x18\x9b\x08 \x03(\t:6\n\x0c\x64\x65\x66\x61ult_host\x12\x1f.google.protobuf.ServiceOptions\x18\x99\x08 \x01(\t:6\n\x0coauth_scopes\x12\x1f.google.protobuf.ServiceOptions\x18\x9a\x08 \x01(\tBi\n\x0e\x63om.google.apiB\x0b\x43lientProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x04GAPIb\x06proto3" -) - - -METHOD_SIGNATURE_FIELD_NUMBER = 1051 -method_signature = DESCRIPTOR.extensions_by_name["method_signature"] -DEFAULT_HOST_FIELD_NUMBER = 1049 -default_host = DESCRIPTOR.extensions_by_name["default_host"] -OAUTH_SCOPES_FIELD_NUMBER = 1050 -oauth_scopes = DESCRIPTOR.extensions_by_name["oauth_scopes"] - -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension( - method_signature - ) - google_dot_protobuf_dot_descriptor__pb2.ServiceOptions.RegisterExtension( - default_host - ) - google_dot_protobuf_dot_descriptor__pb2.ServiceOptions.RegisterExtension( - oauth_scopes - ) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\013ClientProtoP\001ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\242\002\004GAPI" -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/config_change.proto b/opensafely/_vendor/google/api/config_change.proto deleted file mode 100644 index f1fcde4f..00000000 --- a/opensafely/_vendor/google/api/config_change.proto +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/configchange;configchange"; -option java_multiple_files = true; -option java_outer_classname = "ConfigChangeProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Output generated from semantically comparing two versions of a service -// configuration. -// -// Includes detailed information about a field that have changed with -// applicable advice about potential consequences for the change, such as -// backwards-incompatibility. -message ConfigChange { - // Object hierarchy path to the change, with levels separated by a '.' - // character. For repeated fields, an applicable unique identifier field is - // used for the index (usually selector, name, or id). For maps, the term - // 'key' is used. If the field has no unique identifier, the numeric index - // is used. - // Examples: - // - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction - // - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value - // - logging.producer_destinations[0] - string element = 1; - - // Value of the changed object in the old Service configuration, - // in JSON format. This field will not be populated if ChangeType == ADDED. - string old_value = 2; - - // Value of the changed object in the new Service configuration, - // in JSON format. This field will not be populated if ChangeType == REMOVED. - string new_value = 3; - - // The type for this change, either ADDED, REMOVED, or MODIFIED. - ChangeType change_type = 4; - - // Collection of advice provided for this change, useful for determining the - // possible impact of this change. - repeated Advice advices = 5; -} - -// Generated advice about this change, used for providing more -// information about how a change will affect the existing service. -message Advice { - // Useful description for why this advice was applied and what actions should - // be taken to mitigate any implied risks. - string description = 2; -} - -// Classifies set of possible modifications to an object in the service -// configuration. -enum ChangeType { - // No value was provided. - CHANGE_TYPE_UNSPECIFIED = 0; - - // The changed object exists in the 'new' service configuration, but not - // in the 'old' service configuration. - ADDED = 1; - - // The changed object exists in the 'old' service configuration, but not - // in the 'new' service configuration. - REMOVED = 2; - - // The changed object exists in both service configurations, but its value - // is different. - MODIFIED = 3; -} diff --git a/opensafely/_vendor/google/api/config_change_pb2.py b/opensafely/_vendor/google/api/config_change_pb2.py deleted file mode 100644 index d454c551..00000000 --- a/opensafely/_vendor/google/api/config_change_pb2.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/config_change.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1egoogle/api/config_change.proto\x12\ngoogle.api"\x97\x01\n\x0c\x43onfigChange\x12\x0f\n\x07\x65lement\x18\x01 \x01(\t\x12\x11\n\told_value\x18\x02 \x01(\t\x12\x11\n\tnew_value\x18\x03 \x01(\t\x12+\n\x0b\x63hange_type\x18\x04 \x01(\x0e\x32\x16.google.api.ChangeType\x12#\n\x07\x61\x64vices\x18\x05 \x03(\x0b\x32\x12.google.api.Advice"\x1d\n\x06\x41\x64vice\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t*O\n\nChangeType\x12\x1b\n\x17\x43HANGE_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05\x41\x44\x44\x45\x44\x10\x01\x12\x0b\n\x07REMOVED\x10\x02\x12\x0c\n\x08MODIFIED\x10\x03\x42q\n\x0e\x63om.google.apiB\x11\x43onfigChangeProtoP\x01ZCgoogle.golang.org/genproto/googleapis/api/configchange;configchange\xa2\x02\x04GAPIb\x06proto3' -) - -_CHANGETYPE = DESCRIPTOR.enum_types_by_name["ChangeType"] -ChangeType = enum_type_wrapper.EnumTypeWrapper(_CHANGETYPE) -CHANGE_TYPE_UNSPECIFIED = 0 -ADDED = 1 -REMOVED = 2 -MODIFIED = 3 - - -_CONFIGCHANGE = DESCRIPTOR.message_types_by_name["ConfigChange"] -_ADVICE = DESCRIPTOR.message_types_by_name["Advice"] -ConfigChange = _reflection.GeneratedProtocolMessageType( - "ConfigChange", - (_message.Message,), - { - "DESCRIPTOR": _CONFIGCHANGE, - "__module__": "google.api.config_change_pb2" - # @@protoc_insertion_point(class_scope:google.api.ConfigChange) - }, -) -_sym_db.RegisterMessage(ConfigChange) - -Advice = _reflection.GeneratedProtocolMessageType( - "Advice", - (_message.Message,), - { - "DESCRIPTOR": _ADVICE, - "__module__": "google.api.config_change_pb2" - # @@protoc_insertion_point(class_scope:google.api.Advice) - }, -) -_sym_db.RegisterMessage(Advice) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\021ConfigChangeProtoP\001ZCgoogle.golang.org/genproto/googleapis/api/configchange;configchange\242\002\004GAPI" - _CHANGETYPE._serialized_start = 231 - _CHANGETYPE._serialized_end = 310 - _CONFIGCHANGE._serialized_start = 47 - _CONFIGCHANGE._serialized_end = 198 - _ADVICE._serialized_start = 200 - _ADVICE._serialized_end = 229 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/consumer.proto b/opensafely/_vendor/google/api/consumer.proto deleted file mode 100644 index b7e5df1c..00000000 --- a/opensafely/_vendor/google/api/consumer.proto +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2016 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ConsumerProto"; -option java_package = "com.google.api"; - -// A descriptor for defining project properties for a service. One service may -// have many consumer projects, and the service may want to behave differently -// depending on some properties on the project. For example, a project may be -// associated with a school, or a business, or a government agency, a business -// type property on the project may affect how a service responds to the client. -// This descriptor defines which properties are allowed to be set on a project. -// -// Example: -// -// project_properties: -// properties: -// - name: NO_WATERMARK -// type: BOOL -// description: Allows usage of the API without watermarks. -// - name: EXTENDED_TILE_CACHE_PERIOD -// type: INT64 -message ProjectProperties { - // List of per consumer project-specific properties. - repeated Property properties = 1; -} - -// Defines project properties. -// -// API services can define properties that can be assigned to consumer projects -// so that backends can perform response customization without having to make -// additional calls or maintain additional storage. For example, Maps API -// defines properties that controls map tile cache period, or whether to embed a -// watermark in a result. -// -// These values can be set via API producer console. Only API providers can -// define and set these properties. -message Property { - // Supported data type of the property values - enum PropertyType { - // The type is unspecified, and will result in an error. - UNSPECIFIED = 0; - - // The type is `int64`. - INT64 = 1; - - // The type is `bool`. - BOOL = 2; - - // The type is `string`. - STRING = 3; - - // The type is 'double'. - DOUBLE = 4; - } - - // The name of the property (a.k.a key). - string name = 1; - - // The type of this property. - PropertyType type = 2; - - // The description of the property - string description = 3; -} diff --git a/opensafely/_vendor/google/api/consumer_pb2.py b/opensafely/_vendor/google/api/consumer_pb2.py deleted file mode 100644 index 931e33a8..00000000 --- a/opensafely/_vendor/google/api/consumer_pb2.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/consumer.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x19google/api/consumer.proto\x12\ngoogle.api"=\n\x11ProjectProperties\x12(\n\nproperties\x18\x01 \x03(\x0b\x32\x14.google.api.Property"\xac\x01\n\x08Property\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x04type\x18\x02 \x01(\x0e\x32!.google.api.Property.PropertyType\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t"L\n\x0cPropertyType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\t\n\x05INT64\x10\x01\x12\x08\n\x04\x42OOL\x10\x02\x12\n\n\x06STRING\x10\x03\x12\n\n\x06\x44OUBLE\x10\x04\x42h\n\x0e\x63om.google.apiB\rConsumerProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigb\x06proto3' -) - - -_PROJECTPROPERTIES = DESCRIPTOR.message_types_by_name["ProjectProperties"] -_PROPERTY = DESCRIPTOR.message_types_by_name["Property"] -_PROPERTY_PROPERTYTYPE = _PROPERTY.enum_types_by_name["PropertyType"] -ProjectProperties = _reflection.GeneratedProtocolMessageType( - "ProjectProperties", - (_message.Message,), - { - "DESCRIPTOR": _PROJECTPROPERTIES, - "__module__": "google.api.consumer_pb2" - # @@protoc_insertion_point(class_scope:google.api.ProjectProperties) - }, -) -_sym_db.RegisterMessage(ProjectProperties) - -Property = _reflection.GeneratedProtocolMessageType( - "Property", - (_message.Message,), - { - "DESCRIPTOR": _PROPERTY, - "__module__": "google.api.consumer_pb2" - # @@protoc_insertion_point(class_scope:google.api.Property) - }, -) -_sym_db.RegisterMessage(Property) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\rConsumerProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig" - _PROJECTPROPERTIES._serialized_start = 41 - _PROJECTPROPERTIES._serialized_end = 102 - _PROPERTY._serialized_start = 105 - _PROPERTY._serialized_end = 277 - _PROPERTY_PROPERTYTYPE._serialized_start = 201 - _PROPERTY_PROPERTYTYPE._serialized_end = 277 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/context.proto b/opensafely/_vendor/google/api/context.proto deleted file mode 100644 index 8e776ecf..00000000 --- a/opensafely/_vendor/google/api/context.proto +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ContextProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Context` defines which contexts an API requests. -// -// Example: -// -// context: -// rules: -// - selector: "*" -// requested: -// - google.rpc.context.ProjectContext -// - google.rpc.context.OriginContext -// -// The above specifies that all methods in the API request -// `google.rpc.context.ProjectContext` and -// `google.rpc.context.OriginContext`. -// -// Available context types are defined in package -// `google.rpc.context`. -// -// This also provides mechanism to allowlist any protobuf message extension that -// can be sent in grpc metadata using “x-goog-ext--bin” and -// “x-goog-ext--jspb” format. For example, list any service -// specific protobuf types that can appear in grpc metadata as follows in your -// yaml file: -// -// Example: -// -// context: -// rules: -// - selector: "google.example.library.v1.LibraryService.CreateBook" -// allowed_request_extensions: -// - google.foo.v1.NewExtension -// allowed_response_extensions: -// - google.foo.v1.NewExtension -// -// You can also specify extension ID instead of fully qualified extension name -// here. -message Context { - // A list of RPC context rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated ContextRule rules = 1; -} - -// A context rule provides information about the context for an individual API -// element. -message ContextRule { - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // A list of full type names of requested contexts. - repeated string requested = 2; - - // A list of full type names of provided contexts. - repeated string provided = 3; - - // A list of full type names or extension IDs of extensions allowed in grpc - // side channel from client to backend. - repeated string allowed_request_extensions = 4; - - // A list of full type names or extension IDs of extensions allowed in grpc - // side channel from backend to client. - repeated string allowed_response_extensions = 5; -} diff --git a/opensafely/_vendor/google/api/context_pb2.py b/opensafely/_vendor/google/api/context_pb2.py deleted file mode 100644 index 945633b7..00000000 --- a/opensafely/_vendor/google/api/context_pb2.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/context.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x18google/api/context.proto\x12\ngoogle.api"1\n\x07\x43ontext\x12&\n\x05rules\x18\x01 \x03(\x0b\x32\x17.google.api.ContextRule"\x8d\x01\n\x0b\x43ontextRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12\x11\n\trequested\x18\x02 \x03(\t\x12\x10\n\x08provided\x18\x03 \x03(\t\x12"\n\x1a\x61llowed_request_extensions\x18\x04 \x03(\t\x12#\n\x1b\x61llowed_response_extensions\x18\x05 \x03(\tBn\n\x0e\x63om.google.apiB\x0c\x43ontextProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_CONTEXT = DESCRIPTOR.message_types_by_name["Context"] -_CONTEXTRULE = DESCRIPTOR.message_types_by_name["ContextRule"] -Context = _reflection.GeneratedProtocolMessageType( - "Context", - (_message.Message,), - { - "DESCRIPTOR": _CONTEXT, - "__module__": "google.api.context_pb2" - # @@protoc_insertion_point(class_scope:google.api.Context) - }, -) -_sym_db.RegisterMessage(Context) - -ContextRule = _reflection.GeneratedProtocolMessageType( - "ContextRule", - (_message.Message,), - { - "DESCRIPTOR": _CONTEXTRULE, - "__module__": "google.api.context_pb2" - # @@protoc_insertion_point(class_scope:google.api.ContextRule) - }, -) -_sym_db.RegisterMessage(ContextRule) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\014ContextProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _CONTEXT._serialized_start = 40 - _CONTEXT._serialized_end = 89 - _CONTEXTRULE._serialized_start = 92 - _CONTEXTRULE._serialized_end = 233 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/control.proto b/opensafely/_vendor/google/api/control.proto deleted file mode 100644 index 6eb1958e..00000000 --- a/opensafely/_vendor/google/api/control.proto +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ControlProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Selects and configures the service controller used by the service. The -// service controller handles features like abuse, quota, billing, logging, -// monitoring, etc. -message Control { - // The service control environment to use. If empty, no control plane - // feature (like quota and billing) will be enabled. - string environment = 1; -} diff --git a/opensafely/_vendor/google/api/control_pb2.py b/opensafely/_vendor/google/api/control_pb2.py deleted file mode 100644 index 5abb3af1..00000000 --- a/opensafely/_vendor/google/api/control_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/control.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x18google/api/control.proto\x12\ngoogle.api"\x1e\n\x07\x43ontrol\x12\x13\n\x0b\x65nvironment\x18\x01 \x01(\tBn\n\x0e\x63om.google.apiB\x0c\x43ontrolProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_CONTROL = DESCRIPTOR.message_types_by_name["Control"] -Control = _reflection.GeneratedProtocolMessageType( - "Control", - (_message.Message,), - { - "DESCRIPTOR": _CONTROL, - "__module__": "google.api.control_pb2" - # @@protoc_insertion_point(class_scope:google.api.Control) - }, -) -_sym_db.RegisterMessage(Control) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\014ControlProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _CONTROL._serialized_start = 40 - _CONTROL._serialized_end = 70 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/distribution.proto b/opensafely/_vendor/google/api/distribution.proto deleted file mode 100644 index b079a438..00000000 --- a/opensafely/_vendor/google/api/distribution.proto +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution"; -option java_multiple_files = true; -option java_outer_classname = "DistributionProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Distribution` contains summary statistics for a population of values. It -// optionally contains a histogram representing the distribution of those values -// across a set of buckets. -// -// The summary statistics are the count, mean, sum of the squared deviation from -// the mean, the minimum, and the maximum of the set of population of values. -// The histogram is based on a sequence of buckets and gives a count of values -// that fall into each bucket. The boundaries of the buckets are given either -// explicitly or by formulas for buckets of fixed or exponentially increasing -// widths. -// -// Although it is not forbidden, it is generally a bad idea to include -// non-finite values (infinities or NaNs) in the population of values, as this -// will render the `mean` and `sum_of_squared_deviation` fields meaningless. -message Distribution { - // The range of the population values. - message Range { - // The minimum of the population values. - double min = 1; - - // The maximum of the population values. - double max = 2; - } - - // `BucketOptions` describes the bucket boundaries used to create a histogram - // for the distribution. The buckets can be in a linear sequence, an - // exponential sequence, or each bucket can be specified explicitly. - // `BucketOptions` does not include the number of values in each bucket. - // - // A bucket has an inclusive lower bound and exclusive upper bound for the - // values that are counted for that bucket. The upper bound of a bucket must - // be strictly greater than the lower bound. The sequence of N buckets for a - // distribution consists of an underflow bucket (number 0), zero or more - // finite buckets (number 1 through N - 2) and an overflow bucket (number N - - // 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the - // same as the upper bound of bucket i - 1. The buckets span the whole range - // of finite values: lower bound of the underflow bucket is -infinity and the - // upper bound of the overflow bucket is +infinity. The finite buckets are - // so-called because both bounds are finite. - message BucketOptions { - // Specifies a linear sequence of buckets that all have the same width - // (except overflow and underflow). Each bucket represents a constant - // absolute uncertainty on the specific value in the bucket. - // - // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the - // following boundaries: - // - // Upper bound (0 <= i < N-1): offset + (width * i). - // Lower bound (1 <= i < N): offset + (width * (i - 1)). - message Linear { - // Must be greater than 0. - int32 num_finite_buckets = 1; - - // Must be greater than 0. - double width = 2; - - // Lower bound of the first bucket. - double offset = 3; - } - - // Specifies an exponential sequence of buckets that have a width that is - // proportional to the value of the lower bound. Each bucket represents a - // constant relative uncertainty on a specific value in the bucket. - // - // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the - // following boundaries: - // - // Upper bound (0 <= i < N-1): scale * (growth_factor ^ i). - // Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). - message Exponential { - // Must be greater than 0. - int32 num_finite_buckets = 1; - - // Must be greater than 1. - double growth_factor = 2; - - // Must be greater than 0. - double scale = 3; - } - - // Specifies a set of buckets with arbitrary widths. - // - // There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following - // boundaries: - // - // Upper bound (0 <= i < N-1): bounds[i] - // Lower bound (1 <= i < N); bounds[i - 1] - // - // The `bounds` field must contain at least one element. If `bounds` has - // only one element, then there are no finite buckets, and that single - // element is the common boundary of the overflow and underflow buckets. - message Explicit { - // The values must be monotonically increasing. - repeated double bounds = 1; - } - - // Exactly one of these three fields must be set. - oneof options { - // The linear bucket. - Linear linear_buckets = 1; - - // The exponential buckets. - Exponential exponential_buckets = 2; - - // The explicit buckets. - Explicit explicit_buckets = 3; - } - } - - // Exemplars are example points that may be used to annotate aggregated - // distribution values. They are metadata that gives information about a - // particular value added to a Distribution bucket, such as a trace ID that - // was active when a value was added. They may contain further information, - // such as a example values and timestamps, origin, etc. - message Exemplar { - // Value of the exemplar point. This value determines to which bucket the - // exemplar belongs. - double value = 1; - - // The observation (sampling) time of the above value. - google.protobuf.Timestamp timestamp = 2; - - // Contextual information about the example value. Examples are: - // - // Trace: type.googleapis.com/google.monitoring.v3.SpanContext - // - // Literal string: type.googleapis.com/google.protobuf.StringValue - // - // Labels dropped during aggregation: - // type.googleapis.com/google.monitoring.v3.DroppedLabels - // - // There may be only a single attachment of any given message type in a - // single exemplar, and this is enforced by the system. - repeated google.protobuf.Any attachments = 3; - } - - // The number of values in the population. Must be non-negative. This value - // must equal the sum of the values in `bucket_counts` if a histogram is - // provided. - int64 count = 1; - - // The arithmetic mean of the values in the population. If `count` is zero - // then this field must be zero. - double mean = 2; - - // The sum of squared deviations from the mean of the values in the - // population. For values x_i this is: - // - // Sum[i=1..n]((x_i - mean)^2) - // - // Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition - // describes Welford's method for accumulating this sum in one pass. - // - // If `count` is zero then this field must be zero. - double sum_of_squared_deviation = 3; - - // If specified, contains the range of the population values. The field - // must not be present if the `count` is zero. - Range range = 4; - - // Defines the histogram bucket boundaries. If the distribution does not - // contain a histogram, then omit this field. - BucketOptions bucket_options = 6; - - // The number of values in each bucket of the histogram, as described in - // `bucket_options`. If the distribution does not have a histogram, then omit - // this field. If there is a histogram, then the sum of the values in - // `bucket_counts` must equal the value in the `count` field of the - // distribution. - // - // If present, `bucket_counts` should contain N values, where N is the number - // of buckets specified in `bucket_options`. If you supply fewer than N - // values, the remaining values are assumed to be 0. - // - // The order of the values in `bucket_counts` follows the bucket numbering - // schemes described for the three bucket types. The first value must be the - // count for the underflow bucket (number 0). The next N-2 values are the - // counts for the finite buckets (number 1 through N-2). The N'th value in - // `bucket_counts` is the count for the overflow bucket (number N-1). - repeated int64 bucket_counts = 7; - - // Must be in increasing order of `value` field. - repeated Exemplar exemplars = 10; -} diff --git a/opensafely/_vendor/google/api/distribution_pb2.py b/opensafely/_vendor/google/api/distribution_pb2.py deleted file mode 100644 index d7526185..00000000 --- a/opensafely/_vendor/google/api/distribution_pb2.py +++ /dev/null @@ -1,142 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/distribution.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from opensafely._vendor.google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1dgoogle/api/distribution.proto\x12\ngoogle.api\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xd9\x06\n\x0c\x44istribution\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x0c\n\x04mean\x18\x02 \x01(\x01\x12 \n\x18sum_of_squared_deviation\x18\x03 \x01(\x01\x12-\n\x05range\x18\x04 \x01(\x0b\x32\x1e.google.api.Distribution.Range\x12>\n\x0e\x62ucket_options\x18\x06 \x01(\x0b\x32&.google.api.Distribution.BucketOptions\x12\x15\n\rbucket_counts\x18\x07 \x03(\x03\x12\x34\n\texemplars\x18\n \x03(\x0b\x32!.google.api.Distribution.Exemplar\x1a!\n\x05Range\x12\x0b\n\x03min\x18\x01 \x01(\x01\x12\x0b\n\x03max\x18\x02 \x01(\x01\x1a\xb5\x03\n\rBucketOptions\x12G\n\x0elinear_buckets\x18\x01 \x01(\x0b\x32-.google.api.Distribution.BucketOptions.LinearH\x00\x12Q\n\x13\x65xponential_buckets\x18\x02 \x01(\x0b\x32\x32.google.api.Distribution.BucketOptions.ExponentialH\x00\x12K\n\x10\x65xplicit_buckets\x18\x03 \x01(\x0b\x32/.google.api.Distribution.BucketOptions.ExplicitH\x00\x1a\x43\n\x06Linear\x12\x1a\n\x12num_finite_buckets\x18\x01 \x01(\x05\x12\r\n\x05width\x18\x02 \x01(\x01\x12\x0e\n\x06offset\x18\x03 \x01(\x01\x1aO\n\x0b\x45xponential\x12\x1a\n\x12num_finite_buckets\x18\x01 \x01(\x05\x12\x15\n\rgrowth_factor\x18\x02 \x01(\x01\x12\r\n\x05scale\x18\x03 \x01(\x01\x1a\x1a\n\x08\x45xplicit\x12\x0e\n\x06\x62ounds\x18\x01 \x03(\x01\x42\t\n\x07options\x1as\n\x08\x45xemplar\x12\r\n\x05value\x18\x01 \x01(\x01\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12)\n\x0b\x61ttachments\x18\x03 \x03(\x0b\x32\x14.google.protobuf.AnyBq\n\x0e\x63om.google.apiB\x11\x44istributionProtoP\x01ZCgoogle.golang.org/genproto/googleapis/api/distribution;distribution\xa2\x02\x04GAPIb\x06proto3' -) - - -_DISTRIBUTION = DESCRIPTOR.message_types_by_name["Distribution"] -_DISTRIBUTION_RANGE = _DISTRIBUTION.nested_types_by_name["Range"] -_DISTRIBUTION_BUCKETOPTIONS = _DISTRIBUTION.nested_types_by_name["BucketOptions"] -_DISTRIBUTION_BUCKETOPTIONS_LINEAR = _DISTRIBUTION_BUCKETOPTIONS.nested_types_by_name[ - "Linear" -] -_DISTRIBUTION_BUCKETOPTIONS_EXPONENTIAL = ( - _DISTRIBUTION_BUCKETOPTIONS.nested_types_by_name["Exponential"] -) -_DISTRIBUTION_BUCKETOPTIONS_EXPLICIT = _DISTRIBUTION_BUCKETOPTIONS.nested_types_by_name[ - "Explicit" -] -_DISTRIBUTION_EXEMPLAR = _DISTRIBUTION.nested_types_by_name["Exemplar"] -Distribution = _reflection.GeneratedProtocolMessageType( - "Distribution", - (_message.Message,), - { - "Range": _reflection.GeneratedProtocolMessageType( - "Range", - (_message.Message,), - { - "DESCRIPTOR": _DISTRIBUTION_RANGE, - "__module__": "google.api.distribution_pb2" - # @@protoc_insertion_point(class_scope:google.api.Distribution.Range) - }, - ), - "BucketOptions": _reflection.GeneratedProtocolMessageType( - "BucketOptions", - (_message.Message,), - { - "Linear": _reflection.GeneratedProtocolMessageType( - "Linear", - (_message.Message,), - { - "DESCRIPTOR": _DISTRIBUTION_BUCKETOPTIONS_LINEAR, - "__module__": "google.api.distribution_pb2" - # @@protoc_insertion_point(class_scope:google.api.Distribution.BucketOptions.Linear) - }, - ), - "Exponential": _reflection.GeneratedProtocolMessageType( - "Exponential", - (_message.Message,), - { - "DESCRIPTOR": _DISTRIBUTION_BUCKETOPTIONS_EXPONENTIAL, - "__module__": "google.api.distribution_pb2" - # @@protoc_insertion_point(class_scope:google.api.Distribution.BucketOptions.Exponential) - }, - ), - "Explicit": _reflection.GeneratedProtocolMessageType( - "Explicit", - (_message.Message,), - { - "DESCRIPTOR": _DISTRIBUTION_BUCKETOPTIONS_EXPLICIT, - "__module__": "google.api.distribution_pb2" - # @@protoc_insertion_point(class_scope:google.api.Distribution.BucketOptions.Explicit) - }, - ), - "DESCRIPTOR": _DISTRIBUTION_BUCKETOPTIONS, - "__module__": "google.api.distribution_pb2" - # @@protoc_insertion_point(class_scope:google.api.Distribution.BucketOptions) - }, - ), - "Exemplar": _reflection.GeneratedProtocolMessageType( - "Exemplar", - (_message.Message,), - { - "DESCRIPTOR": _DISTRIBUTION_EXEMPLAR, - "__module__": "google.api.distribution_pb2" - # @@protoc_insertion_point(class_scope:google.api.Distribution.Exemplar) - }, - ), - "DESCRIPTOR": _DISTRIBUTION, - "__module__": "google.api.distribution_pb2" - # @@protoc_insertion_point(class_scope:google.api.Distribution) - }, -) -_sym_db.RegisterMessage(Distribution) -_sym_db.RegisterMessage(Distribution.Range) -_sym_db.RegisterMessage(Distribution.BucketOptions) -_sym_db.RegisterMessage(Distribution.BucketOptions.Linear) -_sym_db.RegisterMessage(Distribution.BucketOptions.Exponential) -_sym_db.RegisterMessage(Distribution.BucketOptions.Explicit) -_sym_db.RegisterMessage(Distribution.Exemplar) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\021DistributionProtoP\001ZCgoogle.golang.org/genproto/googleapis/api/distribution;distribution\242\002\004GAPI" - _DISTRIBUTION._serialized_start = 106 - _DISTRIBUTION._serialized_end = 963 - _DISTRIBUTION_RANGE._serialized_start = 373 - _DISTRIBUTION_RANGE._serialized_end = 406 - _DISTRIBUTION_BUCKETOPTIONS._serialized_start = 409 - _DISTRIBUTION_BUCKETOPTIONS._serialized_end = 846 - _DISTRIBUTION_BUCKETOPTIONS_LINEAR._serialized_start = 659 - _DISTRIBUTION_BUCKETOPTIONS_LINEAR._serialized_end = 726 - _DISTRIBUTION_BUCKETOPTIONS_EXPONENTIAL._serialized_start = 728 - _DISTRIBUTION_BUCKETOPTIONS_EXPONENTIAL._serialized_end = 807 - _DISTRIBUTION_BUCKETOPTIONS_EXPLICIT._serialized_start = 809 - _DISTRIBUTION_BUCKETOPTIONS_EXPLICIT._serialized_end = 835 - _DISTRIBUTION_EXEMPLAR._serialized_start = 848 - _DISTRIBUTION_EXEMPLAR._serialized_end = 963 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/documentation.proto b/opensafely/_vendor/google/api/documentation.proto deleted file mode 100644 index 7288169b..00000000 --- a/opensafely/_vendor/google/api/documentation.proto +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "DocumentationProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Documentation` provides the information for describing a service. -// -// Example: -//
documentation:
-//   summary: >
-//     The Google Calendar API gives access
-//     to most calendar features.
-//   pages:
-//   - name: Overview
-//     content: (== include google/foo/overview.md ==)
-//   - name: Tutorial
-//     content: (== include google/foo/tutorial.md ==)
-//     subpages;
-//     - name: Java
-//       content: (== include google/foo/tutorial_java.md ==)
-//   rules:
-//   - selector: google.calendar.Calendar.Get
-//     description: >
-//       ...
-//   - selector: google.calendar.Calendar.Put
-//     description: >
-//       ...
-// 
-// Documentation is provided in markdown syntax. In addition to -// standard markdown features, definition lists, tables and fenced -// code blocks are supported. Section headers can be provided and are -// interpreted relative to the section nesting of the context where -// a documentation fragment is embedded. -// -// Documentation from the IDL is merged with documentation defined -// via the config at normalization time, where documentation provided -// by config rules overrides IDL provided. -// -// A number of constructs specific to the API platform are supported -// in documentation text. -// -// In order to reference a proto element, the following -// notation can be used: -//
[fully.qualified.proto.name][]
-// To override the display text used for the link, this can be used: -//
[display text][fully.qualified.proto.name]
-// Text can be excluded from doc using the following notation: -//
(-- internal comment --)
-// -// A few directives are available in documentation. Note that -// directives must appear on a single line to be properly -// identified. The `include` directive includes a markdown file from -// an external source: -//
(== include path/to/file ==)
-// The `resource_for` directive marks a message to be the resource of -// a collection in REST view. If it is not specified, tools attempt -// to infer the resource from the operations in a collection: -//
(== resource_for v1.shelves.books ==)
-// The directive `suppress_warning` does not directly affect documentation -// and is documented together with service config validation. -message Documentation { - // A short summary of what the service does. Can only be provided by - // plain text. - string summary = 1; - - // The top level pages for the documentation set. - repeated Page pages = 5; - - // A list of documentation rules that apply to individual API elements. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated DocumentationRule rules = 3; - - // The URL to the root of documentation. - string documentation_root_url = 4; - - // Specifies the service root url if the default one (the service name - // from the yaml file) is not suitable. This can be seen in any fully - // specified service urls as well as sections that show a base that other - // urls are relative to. - string service_root_url = 6; - - // Declares a single overview page. For example: - //
documentation:
-  //   summary: ...
-  //   overview: (== include overview.md ==)
-  // 
- // This is a shortcut for the following declaration (using pages style): - //
documentation:
-  //   summary: ...
-  //   pages:
-  //   - name: Overview
-  //     content: (== include overview.md ==)
-  // 
- // Note: you cannot specify both `overview` field and `pages` field. - string overview = 2; -} - -// A documentation rule provides information about individual API elements. -message DocumentationRule { - // The selector is a comma-separated list of patterns. Each pattern is a - // qualified name of the element which may end in "*", indicating a wildcard. - // Wildcards are only allowed at the end and for a whole component of the - // qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A - // wildcard will match one or more components. To specify a default for all - // applicable elements, the whole pattern "*" is used. - string selector = 1; - - // Description of the selected API(s). - string description = 2; - - // Deprecation description of the selected element(s). It can be provided if - // an element is marked as `deprecated`. - string deprecation_description = 3; -} - -// Represents a documentation page. A page can contain subpages to represent -// nested documentation set structure. -message Page { - // The name of the page. It will be used as an identity of the page to - // generate URI of the page, text of the link to this page in navigation, - // etc. The full page name (start from the root page name to this page - // concatenated with `.`) can be used as reference to the page in your - // documentation. For example: - //
pages:
-  // - name: Tutorial
-  //   content: (== include tutorial.md ==)
-  //   subpages:
-  //   - name: Java
-  //     content: (== include tutorial_java.md ==)
-  // 
- // You can reference `Java` page using Markdown reference link syntax: - // `[Java][Tutorial.Java]`. - string name = 1; - - // The Markdown content of the page. You can use (== include {path} - // ==) to include content from a Markdown file. - string content = 2; - - // Subpages of this page. The order of subpages specified here will be - // honored in the generated docset. - repeated Page subpages = 3; -} diff --git a/opensafely/_vendor/google/api/documentation_pb2.py b/opensafely/_vendor/google/api/documentation_pb2.py deleted file mode 100644 index 081b1a13..00000000 --- a/opensafely/_vendor/google/api/documentation_pb2.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/documentation.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1egoogle/api/documentation.proto\x12\ngoogle.api"\xbb\x01\n\rDocumentation\x12\x0f\n\x07summary\x18\x01 \x01(\t\x12\x1f\n\x05pages\x18\x05 \x03(\x0b\x32\x10.google.api.Page\x12,\n\x05rules\x18\x03 \x03(\x0b\x32\x1d.google.api.DocumentationRule\x12\x1e\n\x16\x64ocumentation_root_url\x18\x04 \x01(\t\x12\x18\n\x10service_root_url\x18\x06 \x01(\t\x12\x10\n\x08overview\x18\x02 \x01(\t"[\n\x11\x44ocumentationRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x1f\n\x17\x64\x65precation_description\x18\x03 \x01(\t"I\n\x04Page\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t\x12"\n\x08subpages\x18\x03 \x03(\x0b\x32\x10.google.api.PageBt\n\x0e\x63om.google.apiB\x12\x44ocumentationProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_DOCUMENTATION = DESCRIPTOR.message_types_by_name["Documentation"] -_DOCUMENTATIONRULE = DESCRIPTOR.message_types_by_name["DocumentationRule"] -_PAGE = DESCRIPTOR.message_types_by_name["Page"] -Documentation = _reflection.GeneratedProtocolMessageType( - "Documentation", - (_message.Message,), - { - "DESCRIPTOR": _DOCUMENTATION, - "__module__": "google.api.documentation_pb2" - # @@protoc_insertion_point(class_scope:google.api.Documentation) - }, -) -_sym_db.RegisterMessage(Documentation) - -DocumentationRule = _reflection.GeneratedProtocolMessageType( - "DocumentationRule", - (_message.Message,), - { - "DESCRIPTOR": _DOCUMENTATIONRULE, - "__module__": "google.api.documentation_pb2" - # @@protoc_insertion_point(class_scope:google.api.DocumentationRule) - }, -) -_sym_db.RegisterMessage(DocumentationRule) - -Page = _reflection.GeneratedProtocolMessageType( - "Page", - (_message.Message,), - { - "DESCRIPTOR": _PAGE, - "__module__": "google.api.documentation_pb2" - # @@protoc_insertion_point(class_scope:google.api.Page) - }, -) -_sym_db.RegisterMessage(Page) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\022DocumentationProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _DOCUMENTATION._serialized_start = 47 - _DOCUMENTATION._serialized_end = 234 - _DOCUMENTATIONRULE._serialized_start = 236 - _DOCUMENTATIONRULE._serialized_end = 327 - _PAGE._serialized_start = 329 - _PAGE._serialized_end = 402 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/endpoint.proto b/opensafely/_vendor/google/api/endpoint.proto deleted file mode 100644 index a434e8e7..00000000 --- a/opensafely/_vendor/google/api/endpoint.proto +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "EndpointProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Endpoint` describes a network endpoint of a service that serves a set of -// APIs. It is commonly known as a service endpoint. A service may expose -// any number of service endpoints, and all service endpoints share the same -// service definition, such as quota limits and monitoring metrics. -// -// Example service configuration: -// -// name: library-example.googleapis.com -// endpoints: -// # Below entry makes 'google.example.library.v1.Library' -// # API be served from endpoint address library-example.googleapis.com. -// # It also allows HTTP OPTIONS calls to be passed to the backend, for -// # it to decide whether the subsequent cross-origin request is -// # allowed to proceed. -// - name: library-example.googleapis.com -// allow_cors: true -message Endpoint { - // The canonical name of this endpoint. - string name = 1; - - // Unimplemented. Dot not use. - // - // DEPRECATED: This field is no longer supported. Instead of using aliases, - // please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended - // aliases. - // - // Additional names that this endpoint will be hosted on. - repeated string aliases = 2 [deprecated = true]; - - // The specification of an Internet routable address of API frontend that will - // handle requests to this [API - // Endpoint](https://cloud.google.com/apis/design/glossary). It should be - // either a valid IPv4 address or a fully-qualified domain name. For example, - // "8.8.8.8" or "myservice.appspot.com". - string target = 101; - - // Allowing - // [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka - // cross-domain traffic, would allow the backends served from this endpoint to - // receive and respond to HTTP OPTIONS requests. The response will be used by - // the browser to determine whether the subsequent cross-origin request is - // allowed to proceed. - bool allow_cors = 5; -} diff --git a/opensafely/_vendor/google/api/endpoint_pb2.py b/opensafely/_vendor/google/api/endpoint_pb2.py deleted file mode 100644 index ad81aba6..00000000 --- a/opensafely/_vendor/google/api/endpoint_pb2.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/endpoint.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x19google/api/endpoint.proto\x12\ngoogle.api"Q\n\x08\x45ndpoint\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x07\x61liases\x18\x02 \x03(\tB\x02\x18\x01\x12\x0e\n\x06target\x18\x65 \x01(\t\x12\x12\n\nallow_cors\x18\x05 \x01(\x08\x42o\n\x0e\x63om.google.apiB\rEndpointProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_ENDPOINT = DESCRIPTOR.message_types_by_name["Endpoint"] -Endpoint = _reflection.GeneratedProtocolMessageType( - "Endpoint", - (_message.Message,), - { - "DESCRIPTOR": _ENDPOINT, - "__module__": "google.api.endpoint_pb2" - # @@protoc_insertion_point(class_scope:google.api.Endpoint) - }, -) -_sym_db.RegisterMessage(Endpoint) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\rEndpointProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _ENDPOINT.fields_by_name["aliases"]._options = None - _ENDPOINT.fields_by_name["aliases"]._serialized_options = b"\030\001" - _ENDPOINT._serialized_start = 41 - _ENDPOINT._serialized_end = 122 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/error_reason.proto b/opensafely/_vendor/google/api/error_reason.proto deleted file mode 100644 index 393c808b..00000000 --- a/opensafely/_vendor/google/api/error_reason.proto +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright 2020 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/error_reason;error_reason"; -option java_multiple_files = true; -option java_outer_classname = "ErrorReasonProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Defines the supported values for `google.rpc.ErrorInfo.reason` for the -// `googleapis.com` error domain. This error domain is reserved for [Service -// Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview). -// For each error info of this domain, the metadata key "service" refers to the -// logical identifier of an API service, such as "pubsub.googleapis.com". The -// "consumer" refers to the entity that consumes an API Service. It typically is -// a Google project that owns the client application or the server resource, -// such as "projects/123". Other metadata keys are specific to each error -// reason. For more information, see the definition of the specific error -// reason. -enum ErrorReason { - // Do not use this default value. - ERROR_REASON_UNSPECIFIED = 0; - - // The request is calling a disabled service for a consumer. - // - // Example of an ErrorInfo when the consumer "projects/123" contacting - // "pubsub.googleapis.com" service which is disabled: - // - // { "reason": "SERVICE_DISABLED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "pubsub.googleapis.com" - // } - // } - // - // This response indicates the "pubsub.googleapis.com" has been disabled in - // "projects/123". - SERVICE_DISABLED = 1; - - // The request whose associated billing account is disabled. - // - // Example of an ErrorInfo when the consumer "projects/123" fails to contact - // "pubsub.googleapis.com" service because the associated billing account is - // disabled: - // - // { "reason": "BILLING_DISABLED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "pubsub.googleapis.com" - // } - // } - // - // This response indicates the billing account associated has been disabled. - BILLING_DISABLED = 2; - - // The request is denied because the provided [API - // key](https://cloud.google.com/docs/authentication/api-keys) is invalid. It - // may be in a bad format, cannot be found, or has been expired). - // - // Example of an ErrorInfo when the request is contacting - // "storage.googleapis.com" service with an invalid API key: - // - // { "reason": "API_KEY_INVALID", - // "domain": "googleapis.com", - // "metadata": { - // "service": "storage.googleapis.com", - // } - // } - API_KEY_INVALID = 3; - - // The request is denied because it violates [API key API - // restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_api_restrictions). - // - // Example of an ErrorInfo when the consumer "projects/123" fails to call the - // "storage.googleapis.com" service because this service is restricted in the - // API key: - // - // { "reason": "API_KEY_SERVICE_BLOCKED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com" - // } - // } - API_KEY_SERVICE_BLOCKED = 4; - - // The request is denied because it violates [API key HTTP - // restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_http_restrictions). - // - // Example of an ErrorInfo when the consumer "projects/123" fails to call - // "storage.googleapis.com" service because the http referrer of the request - // violates API key HTTP restrictions: - // - // { "reason": "API_KEY_HTTP_REFERRER_BLOCKED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com", - // } - // } - API_KEY_HTTP_REFERRER_BLOCKED = 7; - - // The request is denied because it violates [API key IP address - // restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions). - // - // Example of an ErrorInfo when the consumer "projects/123" fails to call - // "storage.googleapis.com" service because the caller IP of the request - // violates API key IP address restrictions: - // - // { "reason": "API_KEY_IP_ADDRESS_BLOCKED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com", - // } - // } - API_KEY_IP_ADDRESS_BLOCKED = 8; - - // The request is denied because it violates [API key Android application - // restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions). - // - // Example of an ErrorInfo when the consumer "projects/123" fails to call - // "storage.googleapis.com" service because the request from the Android apps - // violates the API key Android application restrictions: - // - // { "reason": "API_KEY_ANDROID_APP_BLOCKED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com" - // } - // } - API_KEY_ANDROID_APP_BLOCKED = 9; - - // The request is denied because it violates [API key iOS application - // restrictions](https://cloud.google.com/docs/authentication/api-keys#adding_application_restrictions). - // - // Example of an ErrorInfo when the consumer "projects/123" fails to call - // "storage.googleapis.com" service because the request from the iOS apps - // violates the API key iOS application restrictions: - // - // { "reason": "API_KEY_IOS_APP_BLOCKED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com" - // } - // } - API_KEY_IOS_APP_BLOCKED = 13; - - // The request is denied because there is not enough rate quota for the - // consumer. - // - // Example of an ErrorInfo when the consumer "projects/123" fails to contact - // "pubsub.googleapis.com" service because consumer's rate quota usage has - // reached the maximum value set for the quota limit - // "ReadsPerMinutePerProject" on the quota metric - // "pubsub.googleapis.com/read_requests": - // - // { "reason": "RATE_LIMIT_EXCEEDED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "pubsub.googleapis.com", - // "quota_metric": "pubsub.googleapis.com/read_requests", - // "quota_limit": "ReadsPerMinutePerProject" - // } - // } - // - // Example of an ErrorInfo when the consumer "projects/123" checks quota on - // the service "dataflow.googleapis.com" and hits the organization quota - // limit "DefaultRequestsPerMinutePerOrganization" on the metric - // "dataflow.googleapis.com/default_requests". - // - // { "reason": "RATE_LIMIT_EXCEEDED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "dataflow.googleapis.com", - // "quota_metric": "dataflow.googleapis.com/default_requests", - // "quota_limit": "DefaultRequestsPerMinutePerOrganization" - // } - // } - RATE_LIMIT_EXCEEDED = 5; - - // The request is denied because there is not enough resource quota for the - // consumer. - // - // Example of an ErrorInfo when the consumer "projects/123" fails to contact - // "compute.googleapis.com" service because consumer's resource quota usage - // has reached the maximum value set for the quota limit "VMsPerProject" - // on the quota metric "compute.googleapis.com/vms": - // - // { "reason": "RESOURCE_QUOTA_EXCEEDED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "compute.googleapis.com", - // "quota_metric": "compute.googleapis.com/vms", - // "quota_limit": "VMsPerProject" - // } - // } - // - // Example of an ErrorInfo when the consumer "projects/123" checks resource - // quota on the service "dataflow.googleapis.com" and hits the organization - // quota limit "jobs-per-organization" on the metric - // "dataflow.googleapis.com/job_count". - // - // { "reason": "RESOURCE_QUOTA_EXCEEDED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "dataflow.googleapis.com", - // "quota_metric": "dataflow.googleapis.com/job_count", - // "quota_limit": "jobs-per-organization" - // } - // } - RESOURCE_QUOTA_EXCEEDED = 6; - - // The request whose associated billing account address is in a tax restricted - // location, violates the local tax restrictions when creating resources in - // the restricted region. - // - // Example of an ErrorInfo when creating the Cloud Storage Bucket in the - // container "projects/123" under a tax restricted region - // "locations/asia-northeast3": - // - // { "reason": "LOCATION_TAX_POLICY_VIOLATED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com", - // "location": "locations/asia-northeast3" - // } - // } - // - // This response indicates creating the Cloud Storage Bucket in - // "locations/asia-northeast3" violates the location tax restriction. - LOCATION_TAX_POLICY_VIOLATED = 10; - - // The request is denied because the caller does not have required permission - // on the user project "projects/123" or the user project is invalid. For more - // information, check the [userProject System - // Parameters](https://cloud.google.com/apis/docs/system-parameters). - // - // Example of an ErrorInfo when the caller is calling Cloud Storage service - // with insufficient permissions on the user project: - // - // { "reason": "USER_PROJECT_DENIED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com" - // } - // } - USER_PROJECT_DENIED = 11; - - // The request is denied because the consumer "projects/123" is suspended due - // to Terms of Service(Tos) violations. Check [Project suspension - // guidelines](https://cloud.google.com/resource-manager/docs/project-suspension-guidelines) - // for more information. - // - // Example of an ErrorInfo when calling Cloud Storage service with the - // suspended consumer "projects/123": - // - // { "reason": "CONSUMER_SUSPENDED", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com" - // } - // } - CONSUMER_SUSPENDED = 12; - - // The request is denied because the associated consumer is invalid. It may be - // in a bad format, cannot be found, or have been deleted. - // - // Example of an ErrorInfo when calling Cloud Storage service with the - // invalid consumer "projects/123": - // - // { "reason": "CONSUMER_INVALID", - // "domain": "googleapis.com", - // "metadata": { - // "consumer": "projects/123", - // "service": "storage.googleapis.com" - // } - // } - CONSUMER_INVALID = 14; - - // The request is denied because it violates [VPC Service - // Controls](https://cloud.google.com/vpc-service-controls/docs/overview). - // The 'uid' field is a random generated identifier that customer can use it - // to search the audit log for a request rejected by VPC Service Controls. For - // more information, please refer [VPC Service Controls - // Troubleshooting](https://cloud.google.com/vpc-service-controls/docs/troubleshooting#unique-id) - // - // Example of an ErrorInfo when the consumer "projects/123" fails to call - // Cloud Storage service because the request is prohibited by the VPC Service - // Controls. - // - // { "reason": "SECURITY_POLICY_VIOLATED", - // "domain": "googleapis.com", - // "metadata": { - // "uid": "123456789abcde", - // "consumer": "projects/123", - // "service": "storage.googleapis.com" - // } - // } - SECURITY_POLICY_VIOLATED = 15; - - // The request is denied because the provided access token has expired. - // - // Example of an ErrorInfo when the request is calling Cloud Storage service - // with an expired access token: - // - // { "reason": "ACCESS_TOKEN_EXPIRED", - // "domain": "googleapis.com", - // "metadata": { - // "service": "storage.googleapis.com", - // "method": "google.storage.v1.Storage.GetObject" - // } - // } - ACCESS_TOKEN_EXPIRED = 16; - - // The request is denied because the provided access token doesn't have at - // least one of the acceptable scopes required for the API. Please check - // [OAuth 2.0 Scopes for Google - // APIs](https://developers.google.com/identity/protocols/oauth2/scopes) for - // the list of the OAuth 2.0 scopes that you might need to request to access - // the API. - // - // Example of an ErrorInfo when the request is calling Cloud Storage service - // with an access token that is missing required scopes: - // - // { "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT", - // "domain": "googleapis.com", - // "metadata": { - // "service": "storage.googleapis.com", - // "method": "google.storage.v1.Storage.GetObject" - // } - // } - ACCESS_TOKEN_SCOPE_INSUFFICIENT = 17; - - // The request is denied because the account associated with the provided - // access token is in an invalid state, such as disabled or deleted. - // For more information, see https://cloud.google.com/docs/authentication. - // - // Warning: For privacy reasons, the server may not be able to disclose the - // email address for some accounts. The client MUST NOT depend on the - // availability of the `email` attribute. - // - // Example of an ErrorInfo when the request is to the Cloud Storage API with - // an access token that is associated with a disabled or deleted [service - // account](http://cloud/iam/docs/service-accounts): - // - // { "reason": "ACCOUNT_STATE_INVALID", - // "domain": "googleapis.com", - // "metadata": { - // "service": "storage.googleapis.com", - // "method": "google.storage.v1.Storage.GetObject", - // "email": "user@123.iam.gserviceaccount.com" - // } - // } - ACCOUNT_STATE_INVALID = 18; - - // The request is denied because the type of the provided access token is not - // supported by the API being called. - // - // Example of an ErrorInfo when the request is to the Cloud Storage API with - // an unsupported token type. - // - // { "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED", - // "domain": "googleapis.com", - // "metadata": { - // "service": "storage.googleapis.com", - // "method": "google.storage.v1.Storage.GetObject" - // } - // } - ACCESS_TOKEN_TYPE_UNSUPPORTED = 19; -} diff --git a/opensafely/_vendor/google/api/error_reason_pb2.py b/opensafely/_vendor/google/api/error_reason_pb2.py deleted file mode 100644 index 43292a3d..00000000 --- a/opensafely/_vendor/google/api/error_reason_pb2.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/error_reason.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n\x1dgoogle/api/error_reason.proto\x12\ngoogle.api*\xc4\x04\n\x0b\x45rrorReason\x12\x1c\n\x18\x45RROR_REASON_UNSPECIFIED\x10\x00\x12\x14\n\x10SERVICE_DISABLED\x10\x01\x12\x14\n\x10\x42ILLING_DISABLED\x10\x02\x12\x13\n\x0f\x41PI_KEY_INVALID\x10\x03\x12\x1b\n\x17\x41PI_KEY_SERVICE_BLOCKED\x10\x04\x12!\n\x1d\x41PI_KEY_HTTP_REFERRER_BLOCKED\x10\x07\x12\x1e\n\x1a\x41PI_KEY_IP_ADDRESS_BLOCKED\x10\x08\x12\x1f\n\x1b\x41PI_KEY_ANDROID_APP_BLOCKED\x10\t\x12\x1b\n\x17\x41PI_KEY_IOS_APP_BLOCKED\x10\r\x12\x17\n\x13RATE_LIMIT_EXCEEDED\x10\x05\x12\x1b\n\x17RESOURCE_QUOTA_EXCEEDED\x10\x06\x12 \n\x1cLOCATION_TAX_POLICY_VIOLATED\x10\n\x12\x17\n\x13USER_PROJECT_DENIED\x10\x0b\x12\x16\n\x12\x43ONSUMER_SUSPENDED\x10\x0c\x12\x14\n\x10\x43ONSUMER_INVALID\x10\x0e\x12\x1c\n\x18SECURITY_POLICY_VIOLATED\x10\x0f\x12\x18\n\x14\x41\x43\x43\x45SS_TOKEN_EXPIRED\x10\x10\x12#\n\x1f\x41\x43\x43\x45SS_TOKEN_SCOPE_INSUFFICIENT\x10\x11\x12\x19\n\x15\x41\x43\x43OUNT_STATE_INVALID\x10\x12\x12!\n\x1d\x41\x43\x43\x45SS_TOKEN_TYPE_UNSUPPORTED\x10\x13\x42p\n\x0e\x63om.google.apiB\x10\x45rrorReasonProtoP\x01ZCgoogle.golang.org/genproto/googleapis/api/error_reason;error_reason\xa2\x02\x04GAPIb\x06proto3" -) - -_ERRORREASON = DESCRIPTOR.enum_types_by_name["ErrorReason"] -ErrorReason = enum_type_wrapper.EnumTypeWrapper(_ERRORREASON) -ERROR_REASON_UNSPECIFIED = 0 -SERVICE_DISABLED = 1 -BILLING_DISABLED = 2 -API_KEY_INVALID = 3 -API_KEY_SERVICE_BLOCKED = 4 -API_KEY_HTTP_REFERRER_BLOCKED = 7 -API_KEY_IP_ADDRESS_BLOCKED = 8 -API_KEY_ANDROID_APP_BLOCKED = 9 -API_KEY_IOS_APP_BLOCKED = 13 -RATE_LIMIT_EXCEEDED = 5 -RESOURCE_QUOTA_EXCEEDED = 6 -LOCATION_TAX_POLICY_VIOLATED = 10 -USER_PROJECT_DENIED = 11 -CONSUMER_SUSPENDED = 12 -CONSUMER_INVALID = 14 -SECURITY_POLICY_VIOLATED = 15 -ACCESS_TOKEN_EXPIRED = 16 -ACCESS_TOKEN_SCOPE_INSUFFICIENT = 17 -ACCOUNT_STATE_INVALID = 18 -ACCESS_TOKEN_TYPE_UNSUPPORTED = 19 - - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\020ErrorReasonProtoP\001ZCgoogle.golang.org/genproto/googleapis/api/error_reason;error_reason\242\002\004GAPI" - _ERRORREASON._serialized_start = 46 - _ERRORREASON._serialized_end = 626 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/field_behavior.proto b/opensafely/_vendor/google/api/field_behavior.proto deleted file mode 100644 index c4abe3b6..00000000 --- a/opensafely/_vendor/google/api/field_behavior.proto +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2018 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "FieldBehaviorProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.FieldOptions { - // A designation of a specific field behavior (required, output only, etc.) - // in protobuf messages. - // - // Examples: - // - // string name = 1 [(google.api.field_behavior) = REQUIRED]; - // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // google.protobuf.Duration ttl = 1 - // [(google.api.field_behavior) = INPUT_ONLY]; - // google.protobuf.Timestamp expire_time = 1 - // [(google.api.field_behavior) = OUTPUT_ONLY, - // (google.api.field_behavior) = IMMUTABLE]; - repeated google.api.FieldBehavior field_behavior = 1052; -} - -// An indicator of the behavior of a given field (for example, that a field -// is required in requests, or given as output but ignored as input). -// This **does not** change the behavior in protocol buffers itself; it only -// denotes the behavior and may affect how API tooling handles the field. -// -// Note: This enum **may** receive new values in the future. -enum FieldBehavior { - // Conventional default for enums. Do not use this. - FIELD_BEHAVIOR_UNSPECIFIED = 0; - - // Specifically denotes a field as optional. - // While all fields in protocol buffers are optional, this may be specified - // for emphasis if appropriate. - OPTIONAL = 1; - - // Denotes a field as required. - // This indicates that the field **must** be provided as part of the request, - // and failure to do so will cause an error (usually `INVALID_ARGUMENT`). - REQUIRED = 2; - - // Denotes a field as output only. - // This indicates that the field is provided in responses, but including the - // field in a request does nothing (the server *must* ignore it and - // *must not* throw an error as a result of the field's presence). - OUTPUT_ONLY = 3; - - // Denotes a field as input only. - // This indicates that the field is provided in requests, and the - // corresponding field is not included in output. - INPUT_ONLY = 4; - - // Denotes a field as immutable. - // This indicates that the field may be set once in a request to create a - // resource, but may not be changed thereafter. - IMMUTABLE = 5; - - // Denotes that a (repeated) field is an unordered list. - // This indicates that the service may provide the elements of the list - // in any arbitrary order, rather than the order the user originally - // provided. Additionally, the list's order may or may not be stable. - UNORDERED_LIST = 6; - - // Denotes that this field returns a non-empty default value if not set. - // This indicates that if the user provides the empty value in a request, - // a non-empty value will be returned. The user will not be aware of what - // non-empty value to expect. - NON_EMPTY_DEFAULT = 7; -} diff --git a/opensafely/_vendor/google/api/field_behavior_pb2.py b/opensafely/_vendor/google/api/field_behavior_pb2.py deleted file mode 100644 index ee12afdc..00000000 --- a/opensafely/_vendor/google/api/field_behavior_pb2.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/field_behavior.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n\x1fgoogle/api/field_behavior.proto\x12\ngoogle.api\x1a google/protobuf/descriptor.proto*\xa6\x01\n\rFieldBehavior\x12\x1e\n\x1a\x46IELD_BEHAVIOR_UNSPECIFIED\x10\x00\x12\x0c\n\x08OPTIONAL\x10\x01\x12\x0c\n\x08REQUIRED\x10\x02\x12\x0f\n\x0bOUTPUT_ONLY\x10\x03\x12\x0e\n\nINPUT_ONLY\x10\x04\x12\r\n\tIMMUTABLE\x10\x05\x12\x12\n\x0eUNORDERED_LIST\x10\x06\x12\x15\n\x11NON_EMPTY_DEFAULT\x10\x07:Q\n\x0e\x66ield_behavior\x12\x1d.google.protobuf.FieldOptions\x18\x9c\x08 \x03(\x0e\x32\x19.google.api.FieldBehaviorBp\n\x0e\x63om.google.apiB\x12\x46ieldBehaviorProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x04GAPIb\x06proto3" -) - -_FIELDBEHAVIOR = DESCRIPTOR.enum_types_by_name["FieldBehavior"] -FieldBehavior = enum_type_wrapper.EnumTypeWrapper(_FIELDBEHAVIOR) -FIELD_BEHAVIOR_UNSPECIFIED = 0 -OPTIONAL = 1 -REQUIRED = 2 -OUTPUT_ONLY = 3 -INPUT_ONLY = 4 -IMMUTABLE = 5 -UNORDERED_LIST = 6 -NON_EMPTY_DEFAULT = 7 - -FIELD_BEHAVIOR_FIELD_NUMBER = 1052 -field_behavior = DESCRIPTOR.extensions_by_name["field_behavior"] - -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.FieldOptions.RegisterExtension( - field_behavior - ) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\022FieldBehaviorProtoP\001ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\242\002\004GAPI" - _FIELDBEHAVIOR._serialized_start = 82 - _FIELDBEHAVIOR._serialized_end = 248 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/http.proto b/opensafely/_vendor/google/api/http.proto deleted file mode 100644 index 113fa936..00000000 --- a/opensafely/_vendor/google/api/http.proto +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "HttpProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Defines the HTTP configuration for an API service. It contains a list of -// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method -// to one or more HTTP REST API methods. -message Http { - // A list of HTTP configuration rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated HttpRule rules = 1; - - // When set to true, URL path parameters will be fully URI-decoded except in - // cases of single segment matches in reserved expansion, where "%2F" will be - // left encoded. - // - // The default behavior is to not decode RFC 6570 reserved characters in multi - // segment matches. - bool fully_decode_reserved_expansion = 2; -} - -// # gRPC Transcoding -// -// gRPC Transcoding is a feature for mapping between a gRPC method and one or -// more HTTP REST endpoints. It allows developers to build a single API service -// that supports both gRPC APIs and REST APIs. Many systems, including [Google -// APIs](https://github.com/googleapis/googleapis), -// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC -// Gateway](https://github.com/grpc-ecosystem/grpc-gateway), -// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature -// and use it for large scale production services. -// -// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies -// how different portions of the gRPC request message are mapped to the URL -// path, URL query parameters, and HTTP request body. It also controls how the -// gRPC response message is mapped to the HTTP response body. `HttpRule` is -// typically specified as an `google.api.http` annotation on the gRPC method. -// -// Each mapping specifies a URL path template and an HTTP method. The path -// template may refer to one or more fields in the gRPC request message, as long -// as each field is a non-repeated field with a primitive (non-message) type. -// The path template controls how fields of the request message are mapped to -// the URL path. -// -// Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/{name=messages/*}" -// }; -// } -// } -// message GetMessageRequest { -// string name = 1; // Mapped to URL path. -// } -// message Message { -// string text = 1; // The resource content. -// } -// -// This enables an HTTP REST to gRPC mapping as below: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` -// -// Any fields in the request message which are not bound by the path template -// automatically become HTTP query parameters if there is no HTTP request body. -// For example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get:"/v1/messages/{message_id}" -// }; -// } -// } -// message GetMessageRequest { -// message SubMessage { -// string subfield = 1; -// } -// string message_id = 1; // Mapped to URL path. -// int64 revision = 2; // Mapped to URL query parameter `revision`. -// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. -// } -// -// This enables a HTTP JSON to RPC mapping as below: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | -// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: -// "foo"))` -// -// Note that fields which are mapped to URL query parameters must have a -// primitive type or a repeated primitive type or a non-repeated message type. -// In the case of a repeated type, the parameter can be repeated in the URL -// as `...?param=A¶m=B`. In the case of a message type, each field of the -// message is mapped to a separate parameter, such as -// `...?foo.a=A&foo.b=B&foo.c=C`. -// -// For HTTP methods that allow a request body, the `body` field -// specifies the mapping. Consider a REST update method on the -// message resource collection: -// -// service Messaging { -// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { -// option (google.api.http) = { -// patch: "/v1/messages/{message_id}" -// body: "message" -// }; -// } -// } -// message UpdateMessageRequest { -// string message_id = 1; // mapped to the URL -// Message message = 2; // mapped to the body -// } -// -// The following HTTP JSON to RPC mapping is enabled, where the -// representation of the JSON in the request body is determined by -// protos JSON encoding: -// -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" message { text: "Hi!" })` -// -// The special name `*` can be used in the body mapping to define that -// every field not bound by the path template should be mapped to the -// request body. This enables the following alternative definition of -// the update method: -// -// service Messaging { -// rpc UpdateMessage(Message) returns (Message) { -// option (google.api.http) = { -// patch: "/v1/messages/{message_id}" -// body: "*" -// }; -// } -// } -// message Message { -// string message_id = 1; -// string text = 2; -// } -// -// -// The following HTTP JSON to RPC mapping is enabled: -// -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" text: "Hi!")` -// -// Note that when using `*` in the body mapping, it is not possible to -// have HTTP parameters, as all fields not bound by the path end in -// the body. This makes this option more rarely used in practice when -// defining REST APIs. The common usage of `*` is in custom methods -// which don't use the URL at all for transferring data. -// -// It is possible to define multiple HTTP methods for one RPC by using -// the `additional_bindings` option. Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/messages/{message_id}" -// additional_bindings { -// get: "/v1/users/{user_id}/messages/{message_id}" -// } -// }; -// } -// } -// message GetMessageRequest { -// string message_id = 1; -// string user_id = 2; -// } -// -// This enables the following two alternative HTTP JSON to RPC mappings: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` -// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: -// "123456")` -// -// ## Rules for HTTP mapping -// -// 1. Leaf request fields (recursive expansion nested messages in the request -// message) are classified into three categories: -// - Fields referred by the path template. They are passed via the URL path. -// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP -// request body. -// - All other fields are passed via the URL query parameters, and the -// parameter name is the field path in the request message. A repeated -// field can be represented as multiple query parameters under the same -// name. -// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields -// are passed via URL path and HTTP request body. -// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all -// fields are passed via URL path and URL query parameters. -// -// ### Path template syntax -// -// Template = "/" Segments [ Verb ] ; -// Segments = Segment { "/" Segment } ; -// Segment = "*" | "**" | LITERAL | Variable ; -// Variable = "{" FieldPath [ "=" Segments ] "}" ; -// FieldPath = IDENT { "." IDENT } ; -// Verb = ":" LITERAL ; -// -// The syntax `*` matches a single URL path segment. The syntax `**` matches -// zero or more URL path segments, which must be the last part of the URL path -// except the `Verb`. -// -// The syntax `Variable` matches part of the URL path as specified by its -// template. A variable template must not contain other variables. If a variable -// matches a single path segment, its template may be omitted, e.g. `{var}` -// is equivalent to `{var=*}`. -// -// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` -// contains any reserved character, such characters should be percent-encoded -// before the matching. -// -// If a variable contains exactly one path segment, such as `"{var}"` or -// `"{var=*}"`, when such a variable is expanded into a URL path on the client -// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The -// server side does the reverse decoding. Such variables show up in the -// [Discovery -// Document](https://developers.google.com/discovery/v1/reference/apis) as -// `{var}`. -// -// If a variable contains multiple path segments, such as `"{var=foo/*}"` -// or `"{var=**}"`, when such a variable is expanded into a URL path on the -// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. -// The server side does the reverse decoding, except "%2F" and "%2f" are left -// unchanged. Such variables show up in the -// [Discovery -// Document](https://developers.google.com/discovery/v1/reference/apis) as -// `{+var}`. -// -// ## Using gRPC API Service Configuration -// -// gRPC API Service Configuration (service config) is a configuration language -// for configuring a gRPC service to become a user-facing product. The -// service config is simply the YAML representation of the `google.api.Service` -// proto message. -// -// As an alternative to annotating your proto file, you can configure gRPC -// transcoding in your service config YAML files. You do this by specifying a -// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same -// effect as the proto annotation. This can be particularly useful if you -// have a proto that is reused in multiple services. Note that any transcoding -// specified in the service config will override any matching transcoding -// configuration in the proto. -// -// Example: -// -// http: -// rules: -// # Selects a gRPC method and applies HttpRule to it. -// - selector: example.v1.Messaging.GetMessage -// get: /v1/messages/{message_id}/{sub.subfield} -// -// ## Special notes -// -// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the -// proto to JSON conversion must follow the [proto3 -// specification](https://developers.google.com/protocol-buffers/docs/proto3#json). -// -// While the single segment variable follows the semantics of -// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String -// Expansion, the multi segment variable **does not** follow RFC 6570 Section -// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion -// does not expand special characters like `?` and `#`, which would lead -// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding -// for multi segment variables. -// -// The path variables **must not** refer to any repeated or mapped field, -// because client libraries are not capable of handling such variable expansion. -// -// The path variables **must not** capture the leading "/" character. The reason -// is that the most common use case "{var}" does not capture the leading "/" -// character. For consistency, all path variables must share the same behavior. -// -// Repeated message fields must not be mapped to URL query parameters, because -// no client library can support such complicated mapping. -// -// If an API needs to use a JSON array for request or response body, it can map -// the request or response body to a repeated field. However, some gRPC -// Transcoding implementations may not support this feature. -message HttpRule { - // Selects a method to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Determines the URL pattern is matched by this rules. This pattern can be - // used with any of the {get|put|post|delete|patch} methods. A custom method - // can be defined using the 'custom' field. - oneof pattern { - // Maps to HTTP GET. Used for listing and getting information about - // resources. - string get = 2; - - // Maps to HTTP PUT. Used for replacing a resource. - string put = 3; - - // Maps to HTTP POST. Used for creating a resource or performing an action. - string post = 4; - - // Maps to HTTP DELETE. Used for deleting a resource. - string delete = 5; - - // Maps to HTTP PATCH. Used for updating a resource. - string patch = 6; - - // The custom pattern is used for specifying an HTTP method that is not - // included in the `pattern` field, such as HEAD, or "*" to leave the - // HTTP method unspecified for this rule. The wild-card rule is useful - // for services that provide content to Web (HTML) clients. - CustomHttpPattern custom = 8; - } - - // The name of the request field whose value is mapped to the HTTP request - // body, or `*` for mapping all request fields not captured by the path - // pattern to the HTTP body, or omitted for not having any HTTP request body. - // - // NOTE: the referred field must be present at the top-level of the request - // message type. - string body = 7; - - // Optional. The name of the response field whose value is mapped to the HTTP - // response body. When omitted, the entire response message will be used - // as the HTTP response body. - // - // NOTE: The referred field must be present at the top-level of the response - // message type. - string response_body = 12; - - // Additional HTTP bindings for the selector. Nested bindings must - // not contain an `additional_bindings` field themselves (that is, - // the nesting may only be one level deep). - repeated HttpRule additional_bindings = 11; -} - -// A custom pattern is used for defining custom HTTP verb. -message CustomHttpPattern { - // The name of this custom HTTP verb. - string kind = 1; - - // The path matched by this custom verb. - string path = 2; -} diff --git a/opensafely/_vendor/google/api/http_pb2.py b/opensafely/_vendor/google/api/http_pb2.py deleted file mode 100644 index ab24ac49..00000000 --- a/opensafely/_vendor/google/api/http_pb2.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/http.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x15google/api/http.proto\x12\ngoogle.api"T\n\x04Http\x12#\n\x05rules\x18\x01 \x03(\x0b\x32\x14.google.api.HttpRule\x12\'\n\x1f\x66ully_decode_reserved_expansion\x18\x02 \x01(\x08"\x81\x02\n\x08HttpRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12\r\n\x03get\x18\x02 \x01(\tH\x00\x12\r\n\x03put\x18\x03 \x01(\tH\x00\x12\x0e\n\x04post\x18\x04 \x01(\tH\x00\x12\x10\n\x06\x64\x65lete\x18\x05 \x01(\tH\x00\x12\x0f\n\x05patch\x18\x06 \x01(\tH\x00\x12/\n\x06\x63ustom\x18\x08 \x01(\x0b\x32\x1d.google.api.CustomHttpPatternH\x00\x12\x0c\n\x04\x62ody\x18\x07 \x01(\t\x12\x15\n\rresponse_body\x18\x0c \x01(\t\x12\x31\n\x13\x61\x64\x64itional_bindings\x18\x0b \x03(\x0b\x32\x14.google.api.HttpRuleB\t\n\x07pattern"/\n\x11\x43ustomHttpPattern\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\tBj\n\x0e\x63om.google.apiB\tHttpProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3' -) - - -_HTTP = DESCRIPTOR.message_types_by_name["Http"] -_HTTPRULE = DESCRIPTOR.message_types_by_name["HttpRule"] -_CUSTOMHTTPPATTERN = DESCRIPTOR.message_types_by_name["CustomHttpPattern"] -Http = _reflection.GeneratedProtocolMessageType( - "Http", - (_message.Message,), - { - "DESCRIPTOR": _HTTP, - "__module__": "google.api.http_pb2" - # @@protoc_insertion_point(class_scope:google.api.Http) - }, -) -_sym_db.RegisterMessage(Http) - -HttpRule = _reflection.GeneratedProtocolMessageType( - "HttpRule", - (_message.Message,), - { - "DESCRIPTOR": _HTTPRULE, - "__module__": "google.api.http_pb2" - # @@protoc_insertion_point(class_scope:google.api.HttpRule) - }, -) -_sym_db.RegisterMessage(HttpRule) - -CustomHttpPattern = _reflection.GeneratedProtocolMessageType( - "CustomHttpPattern", - (_message.Message,), - { - "DESCRIPTOR": _CUSTOMHTTPPATTERN, - "__module__": "google.api.http_pb2" - # @@protoc_insertion_point(class_scope:google.api.CustomHttpPattern) - }, -) -_sym_db.RegisterMessage(CustomHttpPattern) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\tHttpProtoP\001ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\370\001\001\242\002\004GAPI" - _HTTP._serialized_start = 37 - _HTTP._serialized_end = 121 - _HTTPRULE._serialized_start = 124 - _HTTPRULE._serialized_end = 381 - _CUSTOMHTTPPATTERN._serialized_start = 383 - _CUSTOMHTTPPATTERN._serialized_end = 430 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/httpbody.proto b/opensafely/_vendor/google/api/httpbody.proto deleted file mode 100644 index 00c80aba..00000000 --- a/opensafely/_vendor/google/api/httpbody.proto +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/any.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; -option java_multiple_files = true; -option java_outer_classname = "HttpBodyProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Message that represents an arbitrary HTTP body. It should only be used for -// payload formats that can't be represented as JSON, such as raw binary or -// an HTML page. -// -// -// This message can be used both in streaming and non-streaming API methods in -// the request as well as the response. -// -// It can be used as a top-level request field, which is convenient if one -// wants to extract parameters from either the URL or HTTP template into the -// request fields and also want access to the raw HTTP body. -// -// Example: -// -// message GetResourceRequest { -// // A unique request id. -// string request_id = 1; -// -// // The raw HTTP body is bound to this field. -// google.api.HttpBody http_body = 2; -// -// } -// -// service ResourceService { -// rpc GetResource(GetResourceRequest) -// returns (google.api.HttpBody); -// rpc UpdateResource(google.api.HttpBody) -// returns (google.protobuf.Empty); -// -// } -// -// Example with streaming methods: -// -// service CaldavService { -// rpc GetCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// rpc UpdateCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// -// } -// -// Use of this type only changes how the request and response bodies are -// handled, all other features will continue to work unchanged. -message HttpBody { - // The HTTP Content-Type header value specifying the content type of the body. - string content_type = 1; - - // The HTTP request/response body as raw binary. - bytes data = 2; - - // Application specific response metadata. Must be set in the first response - // for streaming APIs. - repeated google.protobuf.Any extensions = 3; -} diff --git a/opensafely/_vendor/google/api/httpbody_pb2.py b/opensafely/_vendor/google/api/httpbody_pb2.py deleted file mode 100644 index a7f22767..00000000 --- a/opensafely/_vendor/google/api/httpbody_pb2.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/httpbody.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x19google/api/httpbody.proto\x12\ngoogle.api\x1a\x19google/protobuf/any.proto"X\n\x08HttpBody\x12\x14\n\x0c\x63ontent_type\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12(\n\nextensions\x18\x03 \x03(\x0b\x32\x14.google.protobuf.AnyBh\n\x0e\x63om.google.apiB\rHttpBodyProtoP\x01Z;google.golang.org/genproto/googleapis/api/httpbody;httpbody\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3' -) - - -_HTTPBODY = DESCRIPTOR.message_types_by_name["HttpBody"] -HttpBody = _reflection.GeneratedProtocolMessageType( - "HttpBody", - (_message.Message,), - { - "DESCRIPTOR": _HTTPBODY, - "__module__": "google.api.httpbody_pb2" - # @@protoc_insertion_point(class_scope:google.api.HttpBody) - }, -) -_sym_db.RegisterMessage(HttpBody) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\rHttpBodyProtoP\001Z;google.golang.org/genproto/googleapis/api/httpbody;httpbody\370\001\001\242\002\004GAPI" - _HTTPBODY._serialized_start = 68 - _HTTPBODY._serialized_end = 156 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/label.proto b/opensafely/_vendor/google/api/label.proto deleted file mode 100644 index af294c91..00000000 --- a/opensafely/_vendor/google/api/label.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/label;label"; -option java_multiple_files = true; -option java_outer_classname = "LabelProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// A description of a label. -message LabelDescriptor { - // Value types that can be used as label values. - enum ValueType { - // A variable-length string. This is the default. - STRING = 0; - - // Boolean; true or false. - BOOL = 1; - - // A 64-bit signed integer. - INT64 = 2; - } - - // The label key. - string key = 1; - - // The type of data that can be assigned to the label. - ValueType value_type = 2; - - // A human-readable description for the label. - string description = 3; -} diff --git a/opensafely/_vendor/google/api/label_pb2.py b/opensafely/_vendor/google/api/label_pb2.py deleted file mode 100644 index 01ec0c24..00000000 --- a/opensafely/_vendor/google/api/label_pb2.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/label.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x16google/api/label.proto\x12\ngoogle.api"\x9c\x01\n\x0fLabelDescriptor\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x39\n\nvalue_type\x18\x02 \x01(\x0e\x32%.google.api.LabelDescriptor.ValueType\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t",\n\tValueType\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x42OOL\x10\x01\x12\t\n\x05INT64\x10\x02\x42_\n\x0e\x63om.google.apiB\nLabelProtoP\x01Z5google.golang.org/genproto/googleapis/api/label;label\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3' -) - - -_LABELDESCRIPTOR = DESCRIPTOR.message_types_by_name["LabelDescriptor"] -_LABELDESCRIPTOR_VALUETYPE = _LABELDESCRIPTOR.enum_types_by_name["ValueType"] -LabelDescriptor = _reflection.GeneratedProtocolMessageType( - "LabelDescriptor", - (_message.Message,), - { - "DESCRIPTOR": _LABELDESCRIPTOR, - "__module__": "google.api.label_pb2" - # @@protoc_insertion_point(class_scope:google.api.LabelDescriptor) - }, -) -_sym_db.RegisterMessage(LabelDescriptor) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\nLabelProtoP\001Z5google.golang.org/genproto/googleapis/api/label;label\370\001\001\242\002\004GAPI" - _LABELDESCRIPTOR._serialized_start = 39 - _LABELDESCRIPTOR._serialized_end = 195 - _LABELDESCRIPTOR_VALUETYPE._serialized_start = 151 - _LABELDESCRIPTOR_VALUETYPE._serialized_end = 195 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/launch_stage.proto b/opensafely/_vendor/google/api/launch_stage.proto deleted file mode 100644 index cca8419a..00000000 --- a/opensafely/_vendor/google/api/launch_stage.proto +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api;api"; -option java_multiple_files = true; -option java_outer_classname = "LaunchStageProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// The launch stage as defined by [Google Cloud Platform -// Launch Stages](http://cloud.google.com/terms/launch-stages). -enum LaunchStage { - // Do not use this default value. - LAUNCH_STAGE_UNSPECIFIED = 0; - - // The feature is not yet implemented. Users can not use it. - UNIMPLEMENTED = 6; - - // Prelaunch features are hidden from users and are only visible internally. - PRELAUNCH = 7; - - // Early Access features are limited to a closed group of testers. To use - // these features, you must sign up in advance and sign a Trusted Tester - // agreement (which includes confidentiality provisions). These features may - // be unstable, changed in backward-incompatible ways, and are not - // guaranteed to be released. - EARLY_ACCESS = 1; - - // Alpha is a limited availability test for releases before they are cleared - // for widespread use. By Alpha, all significant design issues are resolved - // and we are in the process of verifying functionality. Alpha customers - // need to apply for access, agree to applicable terms, and have their - // projects allowlisted. Alpha releases don’t have to be feature complete, - // no SLAs are provided, and there are no technical support obligations, but - // they will be far enough along that customers can actually use them in - // test environments or for limited-use tests -- just like they would in - // normal production cases. - ALPHA = 2; - - // Beta is the point at which we are ready to open a release for any - // customer to use. There are no SLA or technical support obligations in a - // Beta release. Products will be complete from a feature perspective, but - // may have some open outstanding issues. Beta releases are suitable for - // limited production use cases. - BETA = 3; - - // GA features are open to all developers and are considered stable and - // fully qualified for production use. - GA = 4; - - // Deprecated features are scheduled to be shut down and removed. For more - // information, see the “Deprecation Policy” section of our [Terms of - // Service](https://cloud.google.com/terms/) - // and the [Google Cloud Platform Subject to the Deprecation - // Policy](https://cloud.google.com/terms/deprecation) documentation. - DEPRECATED = 5; -} diff --git a/opensafely/_vendor/google/api/launch_stage_pb2.py b/opensafely/_vendor/google/api/launch_stage_pb2.py deleted file mode 100644 index a6371072..00000000 --- a/opensafely/_vendor/google/api/launch_stage_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/launch_stage.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n\x1dgoogle/api/launch_stage.proto\x12\ngoogle.api*\x8c\x01\n\x0bLaunchStage\x12\x1c\n\x18LAUNCH_STAGE_UNSPECIFIED\x10\x00\x12\x11\n\rUNIMPLEMENTED\x10\x06\x12\r\n\tPRELAUNCH\x10\x07\x12\x10\n\x0c\x45\x41RLY_ACCESS\x10\x01\x12\t\n\x05\x41LPHA\x10\x02\x12\x08\n\x04\x42\x45TA\x10\x03\x12\x06\n\x02GA\x10\x04\x12\x0e\n\nDEPRECATED\x10\x05\x42Z\n\x0e\x63om.google.apiB\x10LaunchStageProtoP\x01Z-google.golang.org/genproto/googleapis/api;api\xa2\x02\x04GAPIb\x06proto3" -) - -_LAUNCHSTAGE = DESCRIPTOR.enum_types_by_name["LaunchStage"] -LaunchStage = enum_type_wrapper.EnumTypeWrapper(_LAUNCHSTAGE) -LAUNCH_STAGE_UNSPECIFIED = 0 -UNIMPLEMENTED = 6 -PRELAUNCH = 7 -EARLY_ACCESS = 1 -ALPHA = 2 -BETA = 3 -GA = 4 -DEPRECATED = 5 - - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\020LaunchStageProtoP\001Z-google.golang.org/genproto/googleapis/api;api\242\002\004GAPI" - _LAUNCHSTAGE._serialized_start = 46 - _LAUNCHSTAGE._serialized_end = 186 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/log.proto b/opensafely/_vendor/google/api/log.proto deleted file mode 100644 index 22ee2893..00000000 --- a/opensafely/_vendor/google/api/log.proto +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/api/label.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "LogProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// A description of a log type. Example in YAML format: -// -// - name: library.googleapis.com/activity_history -// description: The history of borrowing and returning library items. -// display_name: Activity -// labels: -// - key: /customer_id -// description: Identifier of a library customer -message LogDescriptor { - // The name of the log. It must be less than 512 characters long and can - // include the following characters: upper- and lower-case alphanumeric - // characters [A-Za-z0-9], and punctuation characters including - // slash, underscore, hyphen, period [/_-.]. - string name = 1; - - // The set of labels that are available to describe a specific log entry. - // Runtime requests that contain labels not specified here are - // considered invalid. - repeated LabelDescriptor labels = 2; - - // A human-readable description of this log. This information appears in - // the documentation and can contain details. - string description = 3; - - // The human-readable name for this log. This information appears on - // the user interface and should be concise. - string display_name = 4; -} diff --git a/opensafely/_vendor/google/api/log_pb2.py b/opensafely/_vendor/google/api/log_pb2.py deleted file mode 100644 index 1ded00d8..00000000 --- a/opensafely/_vendor/google/api/log_pb2.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/log.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.api import label_pb2 as google_dot_api_dot_label__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x14google/api/log.proto\x12\ngoogle.api\x1a\x16google/api/label.proto"u\n\rLogDescriptor\x12\x0c\n\x04name\x18\x01 \x01(\t\x12+\n\x06labels\x18\x02 \x03(\x0b\x32\x1b.google.api.LabelDescriptor\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x04 \x01(\tBj\n\x0e\x63om.google.apiB\x08LogProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_LOGDESCRIPTOR = DESCRIPTOR.message_types_by_name["LogDescriptor"] -LogDescriptor = _reflection.GeneratedProtocolMessageType( - "LogDescriptor", - (_message.Message,), - { - "DESCRIPTOR": _LOGDESCRIPTOR, - "__module__": "google.api.log_pb2" - # @@protoc_insertion_point(class_scope:google.api.LogDescriptor) - }, -) -_sym_db.RegisterMessage(LogDescriptor) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\010LogProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _LOGDESCRIPTOR._serialized_start = 60 - _LOGDESCRIPTOR._serialized_end = 177 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/logging.proto b/opensafely/_vendor/google/api/logging.proto deleted file mode 100644 index e60f77ca..00000000 --- a/opensafely/_vendor/google/api/logging.proto +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "LoggingProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Logging configuration of the service. -// -// The following example shows how to configure logs to be sent to the -// producer and consumer projects. In the example, the `activity_history` -// log is sent to both the producer and consumer projects, whereas the -// `purchase_history` log is only sent to the producer project. -// -// monitored_resources: -// - type: library.googleapis.com/branch -// labels: -// - key: /city -// description: The city where the library branch is located in. -// - key: /name -// description: The name of the branch. -// logs: -// - name: activity_history -// labels: -// - key: /customer_id -// - name: purchase_history -// logging: -// producer_destinations: -// - monitored_resource: library.googleapis.com/branch -// logs: -// - activity_history -// - purchase_history -// consumer_destinations: -// - monitored_resource: library.googleapis.com/branch -// logs: -// - activity_history -message Logging { - // Configuration of a specific logging destination (the producer project - // or the consumer project). - message LoggingDestination { - // The monitored resource type. The type must be defined in the - // [Service.monitored_resources][google.api.Service.monitored_resources] section. - string monitored_resource = 3; - - // Names of the logs to be sent to this destination. Each name must - // be defined in the [Service.logs][google.api.Service.logs] section. If the log name is - // not a domain scoped name, it will be automatically prefixed with - // the service name followed by "/". - repeated string logs = 1; - } - - // Logging configurations for sending logs to the producer project. - // There can be multiple producer destinations, each one must have a - // different monitored resource type. A log can be used in at most - // one producer destination. - repeated LoggingDestination producer_destinations = 1; - - // Logging configurations for sending logs to the consumer project. - // There can be multiple consumer destinations, each one must have a - // different monitored resource type. A log can be used in at most - // one consumer destination. - repeated LoggingDestination consumer_destinations = 2; -} diff --git a/opensafely/_vendor/google/api/logging_pb2.py b/opensafely/_vendor/google/api/logging_pb2.py deleted file mode 100644 index 25917332..00000000 --- a/opensafely/_vendor/google/api/logging_pb2.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/logging.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x18google/api/logging.proto\x12\ngoogle.api"\xd7\x01\n\x07Logging\x12\x45\n\x15producer_destinations\x18\x01 \x03(\x0b\x32&.google.api.Logging.LoggingDestination\x12\x45\n\x15\x63onsumer_destinations\x18\x02 \x03(\x0b\x32&.google.api.Logging.LoggingDestination\x1a>\n\x12LoggingDestination\x12\x1a\n\x12monitored_resource\x18\x03 \x01(\t\x12\x0c\n\x04logs\x18\x01 \x03(\tBn\n\x0e\x63om.google.apiB\x0cLoggingProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_LOGGING = DESCRIPTOR.message_types_by_name["Logging"] -_LOGGING_LOGGINGDESTINATION = _LOGGING.nested_types_by_name["LoggingDestination"] -Logging = _reflection.GeneratedProtocolMessageType( - "Logging", - (_message.Message,), - { - "LoggingDestination": _reflection.GeneratedProtocolMessageType( - "LoggingDestination", - (_message.Message,), - { - "DESCRIPTOR": _LOGGING_LOGGINGDESTINATION, - "__module__": "google.api.logging_pb2" - # @@protoc_insertion_point(class_scope:google.api.Logging.LoggingDestination) - }, - ), - "DESCRIPTOR": _LOGGING, - "__module__": "google.api.logging_pb2" - # @@protoc_insertion_point(class_scope:google.api.Logging) - }, -) -_sym_db.RegisterMessage(Logging) -_sym_db.RegisterMessage(Logging.LoggingDestination) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\014LoggingProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _LOGGING._serialized_start = 41 - _LOGGING._serialized_end = 256 - _LOGGING_LOGGINGDESTINATION._serialized_start = 194 - _LOGGING_LOGGINGDESTINATION._serialized_end = 256 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/metric.proto b/opensafely/_vendor/google/api/metric.proto deleted file mode 100644 index aadc1967..00000000 --- a/opensafely/_vendor/google/api/metric.proto +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/api/label.proto"; -import "google/api/launch_stage.proto"; -import "google/protobuf/duration.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/metric;metric"; -option java_multiple_files = true; -option java_outer_classname = "MetricProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Defines a metric type and its schema. Once a metric descriptor is created, -// deleting or altering it stops data collection and makes the metric type's -// existing data unusable. -// -message MetricDescriptor { - // Additional annotations that can be used to guide the usage of a metric. - message MetricDescriptorMetadata { - // Deprecated. Must use the [MetricDescriptor.launch_stage][google.api.MetricDescriptor.launch_stage] instead. - LaunchStage launch_stage = 1 [deprecated = true]; - - // The sampling period of metric data points. For metrics which are written - // periodically, consecutive data points are stored at this time interval, - // excluding data loss due to errors. Metrics with a higher granularity have - // a smaller sampling period. - google.protobuf.Duration sample_period = 2; - - // The delay of data points caused by ingestion. Data points older than this - // age are guaranteed to be ingested and available to be read, excluding - // data loss due to errors. - google.protobuf.Duration ingest_delay = 3; - } - - // The kind of measurement. It describes how the data is reported. - // For information on setting the start time and end time based on - // the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval]. - enum MetricKind { - // Do not use this default value. - METRIC_KIND_UNSPECIFIED = 0; - - // An instantaneous measurement of a value. - GAUGE = 1; - - // The change in a value during a time interval. - DELTA = 2; - - // A value accumulated over a time interval. Cumulative - // measurements in a time series should have the same start time - // and increasing end times, until an event resets the cumulative - // value to zero and sets a new start time for the following - // points. - CUMULATIVE = 3; - } - - // The value type of a metric. - enum ValueType { - // Do not use this default value. - VALUE_TYPE_UNSPECIFIED = 0; - - // The value is a boolean. - // This value type can be used only if the metric kind is `GAUGE`. - BOOL = 1; - - // The value is a signed 64-bit integer. - INT64 = 2; - - // The value is a double precision floating point number. - DOUBLE = 3; - - // The value is a text string. - // This value type can be used only if the metric kind is `GAUGE`. - STRING = 4; - - // The value is a [`Distribution`][google.api.Distribution]. - DISTRIBUTION = 5; - - // The value is money. - MONEY = 6; - } - - // The resource name of the metric descriptor. - string name = 1; - - // The metric type, including its DNS name prefix. The type is not - // URL-encoded. All user-defined metric types have the DNS name - // `custom.googleapis.com` or `external.googleapis.com`. Metric types should - // use a natural hierarchical grouping. For example: - // - // "custom.googleapis.com/invoice/paid/amount" - // "external.googleapis.com/prometheus/up" - // "appengine.googleapis.com/http/server/response_latencies" - string type = 8; - - // The set of labels that can be used to describe a specific - // instance of this metric type. For example, the - // `appengine.googleapis.com/http/server/response_latencies` metric - // type has a label for the HTTP response code, `response_code`, so - // you can look at latencies for successful responses or just - // for responses that failed. - repeated LabelDescriptor labels = 2; - - // Whether the metric records instantaneous values, changes to a value, etc. - // Some combinations of `metric_kind` and `value_type` might not be supported. - MetricKind metric_kind = 3; - - // Whether the measurement is an integer, a floating-point number, etc. - // Some combinations of `metric_kind` and `value_type` might not be supported. - ValueType value_type = 4; - - // The units in which the metric value is reported. It is only applicable - // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` - // defines the representation of the stored metric values. - // - // Different systems might scale the values to be more easily displayed (so a - // value of `0.02kBy` _might_ be displayed as `20By`, and a value of - // `3523kBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is - // `kBy`, then the value of the metric is always in thousands of bytes, no - // matter how it might be displayed. - // - // If you want a custom metric to record the exact number of CPU-seconds used - // by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is - // `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005 - // CPU-seconds, then the value is written as `12005`. - // - // Alternatively, if you want a custom metric to record data in a more - // granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is - // `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`), - // or use `Kis{CPU}` and write `11.723` (which is `12005/1024`). - // - // The supported units are a subset of [The Unified Code for Units of - // Measure](https://unitsofmeasure.org/ucum.html) standard: - // - // **Basic units (UNIT)** - // - // * `bit` bit - // * `By` byte - // * `s` second - // * `min` minute - // * `h` hour - // * `d` day - // * `1` dimensionless - // - // **Prefixes (PREFIX)** - // - // * `k` kilo (10^3) - // * `M` mega (10^6) - // * `G` giga (10^9) - // * `T` tera (10^12) - // * `P` peta (10^15) - // * `E` exa (10^18) - // * `Z` zetta (10^21) - // * `Y` yotta (10^24) - // - // * `m` milli (10^-3) - // * `u` micro (10^-6) - // * `n` nano (10^-9) - // * `p` pico (10^-12) - // * `f` femto (10^-15) - // * `a` atto (10^-18) - // * `z` zepto (10^-21) - // * `y` yocto (10^-24) - // - // * `Ki` kibi (2^10) - // * `Mi` mebi (2^20) - // * `Gi` gibi (2^30) - // * `Ti` tebi (2^40) - // * `Pi` pebi (2^50) - // - // **Grammar** - // - // The grammar also includes these connectors: - // - // * `/` division or ratio (as an infix operator). For examples, - // `kBy/{email}` or `MiBy/10ms` (although you should almost never - // have `/s` in a metric `unit`; rates should always be computed at - // query time from the underlying cumulative or delta value). - // * `.` multiplication or composition (as an infix operator). For - // examples, `GBy.d` or `k{watt}.h`. - // - // The grammar for a unit is as follows: - // - // Expression = Component { "." Component } { "/" Component } ; - // - // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] - // | Annotation - // | "1" - // ; - // - // Annotation = "{" NAME "}" ; - // - // Notes: - // - // * `Annotation` is just a comment if it follows a `UNIT`. If the annotation - // is used alone, then the unit is equivalent to `1`. For examples, - // `{request}/s == 1/s`, `By{transmitted}/s == By/s`. - // * `NAME` is a sequence of non-blank printable ASCII characters not - // containing `{` or `}`. - // * `1` represents a unitary [dimensionless - // unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such - // as in `1/s`. It is typically used when none of the basic units are - // appropriate. For example, "new users per day" can be represented as - // `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new - // users). Alternatively, "thousands of page views per day" would be - // represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric - // value of `5.3` would mean "5300 page views per day"). - // * `%` represents dimensionless value of 1/100, and annotates values giving - // a percentage (so the metric values are typically in the range of 0..100, - // and a metric value `3` means "3 percent"). - // * `10^2.%` indicates a metric contains a ratio, typically in the range - // 0..1, that will be multiplied by 100 and displayed as a percentage - // (so a metric value `0.03` means "3 percent"). - string unit = 5; - - // A detailed description of the metric, which can be used in documentation. - string description = 6; - - // A concise name for the metric, which can be displayed in user interfaces. - // Use sentence case without an ending period, for example "Request count". - // This field is optional but it is recommended to be set for any metrics - // associated with user-visible concepts, such as Quota. - string display_name = 7; - - // Optional. Metadata which can be used to guide usage of the metric. - MetricDescriptorMetadata metadata = 10; - - // Optional. The launch stage of the metric definition. - LaunchStage launch_stage = 12; - - // Read-only. If present, then a [time - // series][google.monitoring.v3.TimeSeries], which is identified partially by - // a metric type and a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor], that is associated - // with this metric type can only be associated with one of the monitored - // resource types listed here. - repeated string monitored_resource_types = 13; -} - -// A specific metric, identified by specifying values for all of the -// labels of a [`MetricDescriptor`][google.api.MetricDescriptor]. -message Metric { - // An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. - // For example, `custom.googleapis.com/invoice/paid/amount`. - string type = 3; - - // The set of label values that uniquely identify this metric. All - // labels listed in the `MetricDescriptor` must be assigned values. - map labels = 2; -} diff --git a/opensafely/_vendor/google/api/metric_pb2.py b/opensafely/_vendor/google/api/metric_pb2.py deleted file mode 100644 index efbea191..00000000 --- a/opensafely/_vendor/google/api/metric_pb2.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/metric.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.api import label_pb2 as google_dot_api_dot_label__pb2 -from opensafely._vendor.google.api import launch_stage_pb2 as google_dot_api_dot_launch__stage__pb2 -from opensafely._vendor.google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x17google/api/metric.proto\x12\ngoogle.api\x1a\x16google/api/label.proto\x1a\x1dgoogle/api/launch_stage.proto\x1a\x1egoogle/protobuf/duration.proto"\x9f\x06\n\x10MetricDescriptor\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x08 \x01(\t\x12+\n\x06labels\x18\x02 \x03(\x0b\x32\x1b.google.api.LabelDescriptor\x12<\n\x0bmetric_kind\x18\x03 \x01(\x0e\x32\'.google.api.MetricDescriptor.MetricKind\x12:\n\nvalue_type\x18\x04 \x01(\x0e\x32&.google.api.MetricDescriptor.ValueType\x12\x0c\n\x04unit\x18\x05 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x06 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x07 \x01(\t\x12G\n\x08metadata\x18\n \x01(\x0b\x32\x35.google.api.MetricDescriptor.MetricDescriptorMetadata\x12-\n\x0claunch_stage\x18\x0c \x01(\x0e\x32\x17.google.api.LaunchStage\x12 \n\x18monitored_resource_types\x18\r \x03(\t\x1a\xb0\x01\n\x18MetricDescriptorMetadata\x12\x31\n\x0claunch_stage\x18\x01 \x01(\x0e\x32\x17.google.api.LaunchStageB\x02\x18\x01\x12\x30\n\rsample_period\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12/\n\x0cingest_delay\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration"O\n\nMetricKind\x12\x1b\n\x17METRIC_KIND_UNSPECIFIED\x10\x00\x12\t\n\x05GAUGE\x10\x01\x12\t\n\x05\x44\x45LTA\x10\x02\x12\x0e\n\nCUMULATIVE\x10\x03"q\n\tValueType\x12\x1a\n\x16VALUE_TYPE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x42OOL\x10\x01\x12\t\n\x05INT64\x10\x02\x12\n\n\x06\x44OUBLE\x10\x03\x12\n\n\x06STRING\x10\x04\x12\x10\n\x0c\x44ISTRIBUTION\x10\x05\x12\t\n\x05MONEY\x10\x06"u\n\x06Metric\x12\x0c\n\x04type\x18\x03 \x01(\t\x12.\n\x06labels\x18\x02 \x03(\x0b\x32\x1e.google.api.Metric.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42_\n\x0e\x63om.google.apiB\x0bMetricProtoP\x01Z7google.golang.org/genproto/googleapis/api/metric;metric\xa2\x02\x04GAPIb\x06proto3' -) - - -_METRICDESCRIPTOR = DESCRIPTOR.message_types_by_name["MetricDescriptor"] -_METRICDESCRIPTOR_METRICDESCRIPTORMETADATA = _METRICDESCRIPTOR.nested_types_by_name[ - "MetricDescriptorMetadata" -] -_METRIC = DESCRIPTOR.message_types_by_name["Metric"] -_METRIC_LABELSENTRY = _METRIC.nested_types_by_name["LabelsEntry"] -_METRICDESCRIPTOR_METRICKIND = _METRICDESCRIPTOR.enum_types_by_name["MetricKind"] -_METRICDESCRIPTOR_VALUETYPE = _METRICDESCRIPTOR.enum_types_by_name["ValueType"] -MetricDescriptor = _reflection.GeneratedProtocolMessageType( - "MetricDescriptor", - (_message.Message,), - { - "MetricDescriptorMetadata": _reflection.GeneratedProtocolMessageType( - "MetricDescriptorMetadata", - (_message.Message,), - { - "DESCRIPTOR": _METRICDESCRIPTOR_METRICDESCRIPTORMETADATA, - "__module__": "google.api.metric_pb2" - # @@protoc_insertion_point(class_scope:google.api.MetricDescriptor.MetricDescriptorMetadata) - }, - ), - "DESCRIPTOR": _METRICDESCRIPTOR, - "__module__": "google.api.metric_pb2" - # @@protoc_insertion_point(class_scope:google.api.MetricDescriptor) - }, -) -_sym_db.RegisterMessage(MetricDescriptor) -_sym_db.RegisterMessage(MetricDescriptor.MetricDescriptorMetadata) - -Metric = _reflection.GeneratedProtocolMessageType( - "Metric", - (_message.Message,), - { - "LabelsEntry": _reflection.GeneratedProtocolMessageType( - "LabelsEntry", - (_message.Message,), - { - "DESCRIPTOR": _METRIC_LABELSENTRY, - "__module__": "google.api.metric_pb2" - # @@protoc_insertion_point(class_scope:google.api.Metric.LabelsEntry) - }, - ), - "DESCRIPTOR": _METRIC, - "__module__": "google.api.metric_pb2" - # @@protoc_insertion_point(class_scope:google.api.Metric) - }, -) -_sym_db.RegisterMessage(Metric) -_sym_db.RegisterMessage(Metric.LabelsEntry) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\013MetricProtoP\001Z7google.golang.org/genproto/googleapis/api/metric;metric\242\002\004GAPI" - _METRICDESCRIPTOR_METRICDESCRIPTORMETADATA.fields_by_name[ - "launch_stage" - ]._options = None - _METRICDESCRIPTOR_METRICDESCRIPTORMETADATA.fields_by_name[ - "launch_stage" - ]._serialized_options = b"\030\001" - _METRIC_LABELSENTRY._options = None - _METRIC_LABELSENTRY._serialized_options = b"8\001" - _METRICDESCRIPTOR._serialized_start = 127 - _METRICDESCRIPTOR._serialized_end = 926 - _METRICDESCRIPTOR_METRICDESCRIPTORMETADATA._serialized_start = 554 - _METRICDESCRIPTOR_METRICDESCRIPTORMETADATA._serialized_end = 730 - _METRICDESCRIPTOR_METRICKIND._serialized_start = 732 - _METRICDESCRIPTOR_METRICKIND._serialized_end = 811 - _METRICDESCRIPTOR_VALUETYPE._serialized_start = 813 - _METRICDESCRIPTOR_VALUETYPE._serialized_end = 926 - _METRIC._serialized_start = 928 - _METRIC._serialized_end = 1045 - _METRIC_LABELSENTRY._serialized_start = 1000 - _METRIC_LABELSENTRY._serialized_end = 1045 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/monitored_resource.proto b/opensafely/_vendor/google/api/monitored_resource.proto deleted file mode 100644 index bd5be4e4..00000000 --- a/opensafely/_vendor/google/api/monitored_resource.proto +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/api/label.proto"; -import "google/api/launch_stage.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres"; -option java_multiple_files = true; -option java_outer_classname = "MonitoredResourceProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a -// type name and a set of labels. For example, the monitored resource -// descriptor for Google Compute Engine VM instances has a type of -// `"gce_instance"` and specifies the use of the labels `"instance_id"` and -// `"zone"` to identify particular VM instances. -// -// Different APIs can support different monitored resource types. APIs generally -// provide a `list` method that returns the monitored resource descriptors used -// by the API. -// -message MonitoredResourceDescriptor { - // Optional. The resource name of the monitored resource descriptor: - // `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where - // {type} is the value of the `type` field in this object and - // {project_id} is a project ID that provides API-specific context for - // accessing the type. APIs that do not use project information can use the - // resource name format `"monitoredResourceDescriptors/{type}"`. - string name = 5; - - // Required. The monitored resource type. For example, the type - // `"cloudsql_database"` represents databases in Google Cloud SQL. - string type = 1; - - // Optional. A concise name for the monitored resource type that might be - // displayed in user interfaces. It should be a Title Cased Noun Phrase, - // without any article or other determiners. For example, - // `"Google Cloud SQL Database"`. - string display_name = 2; - - // Optional. A detailed description of the monitored resource type that might - // be used in documentation. - string description = 3; - - // Required. A set of labels used to describe instances of this monitored - // resource type. For example, an individual Google Cloud SQL database is - // identified by values for the labels `"database_id"` and `"zone"`. - repeated LabelDescriptor labels = 4; - - // Optional. The launch stage of the monitored resource definition. - LaunchStage launch_stage = 7; -} - -// An object representing a resource that can be used for monitoring, logging, -// billing, or other purposes. Examples include virtual machine instances, -// databases, and storage devices such as disks. The `type` field identifies a -// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's -// schema. Information in the `labels` field identifies the actual resource and -// its attributes according to the schema. For example, a particular Compute -// Engine VM instance could be represented by the following object, because the -// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels -// `"instance_id"` and `"zone"`: -// -// { "type": "gce_instance", -// "labels": { "instance_id": "12345678901234", -// "zone": "us-central1-a" }} -message MonitoredResource { - // Required. The monitored resource type. This field must match - // the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For - // example, the type of a Compute Engine VM instance is `gce_instance`. - string type = 1; - - // Required. Values for all of the labels listed in the associated monitored - // resource descriptor. For example, Compute Engine VM instances use the - // labels `"project_id"`, `"instance_id"`, and `"zone"`. - map labels = 2; -} - -// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource] object. -// [MonitoredResource][google.api.MonitoredResource] objects contain the minimum set of information to -// uniquely identify a monitored resource instance. There is some other useful -// auxiliary metadata. Monitoring and Logging use an ingestion -// pipeline to extract metadata for cloud resources of all types, and store -// the metadata in this message. -message MonitoredResourceMetadata { - // Output only. Values for predefined system metadata labels. - // System labels are a kind of metadata extracted by Google, including - // "machine_image", "vpc", "subnet_id", - // "security_group", "name", etc. - // System label values can be only strings, Boolean values, or a list of - // strings. For example: - // - // { "name": "my-test-instance", - // "security_group": ["a", "b", "c"], - // "spot_instance": false } - google.protobuf.Struct system_labels = 1; - - // Output only. A map of user-defined metadata labels. - map user_labels = 2; -} diff --git a/opensafely/_vendor/google/api/monitored_resource_pb2.py b/opensafely/_vendor/google/api/monitored_resource_pb2.py deleted file mode 100644 index e8fadac3..00000000 --- a/opensafely/_vendor/google/api/monitored_resource_pb2.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/monitored_resource.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.api import label_pb2 as google_dot_api_dot_label__pb2 -from opensafely._vendor.google.api import launch_stage_pb2 as google_dot_api_dot_launch__stage__pb2 -from opensafely._vendor.google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n#google/api/monitored_resource.proto\x12\ngoogle.api\x1a\x16google/api/label.proto\x1a\x1dgoogle/api/launch_stage.proto\x1a\x1cgoogle/protobuf/struct.proto"\xc0\x01\n\x1bMonitoredResourceDescriptor\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12+\n\x06labels\x18\x04 \x03(\x0b\x32\x1b.google.api.LabelDescriptor\x12-\n\x0claunch_stage\x18\x07 \x01(\x0e\x32\x17.google.api.LaunchStage"\x8b\x01\n\x11MonitoredResource\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x39\n\x06labels\x18\x02 \x03(\x0b\x32).google.api.MonitoredResource.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xca\x01\n\x19MonitoredResourceMetadata\x12.\n\rsystem_labels\x18\x01 \x01(\x0b\x32\x17.google.protobuf.Struct\x12J\n\x0buser_labels\x18\x02 \x03(\x0b\x32\x35.google.api.MonitoredResourceMetadata.UserLabelsEntry\x1a\x31\n\x0fUserLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42y\n\x0e\x63om.google.apiB\x16MonitoredResourceProtoP\x01ZCgoogle.golang.org/genproto/googleapis/api/monitoredres;monitoredres\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3' -) - - -_MONITOREDRESOURCEDESCRIPTOR = DESCRIPTOR.message_types_by_name[ - "MonitoredResourceDescriptor" -] -_MONITOREDRESOURCE = DESCRIPTOR.message_types_by_name["MonitoredResource"] -_MONITOREDRESOURCE_LABELSENTRY = _MONITOREDRESOURCE.nested_types_by_name["LabelsEntry"] -_MONITOREDRESOURCEMETADATA = DESCRIPTOR.message_types_by_name[ - "MonitoredResourceMetadata" -] -_MONITOREDRESOURCEMETADATA_USERLABELSENTRY = ( - _MONITOREDRESOURCEMETADATA.nested_types_by_name["UserLabelsEntry"] -) -MonitoredResourceDescriptor = _reflection.GeneratedProtocolMessageType( - "MonitoredResourceDescriptor", - (_message.Message,), - { - "DESCRIPTOR": _MONITOREDRESOURCEDESCRIPTOR, - "__module__": "google.api.monitored_resource_pb2" - # @@protoc_insertion_point(class_scope:google.api.MonitoredResourceDescriptor) - }, -) -_sym_db.RegisterMessage(MonitoredResourceDescriptor) - -MonitoredResource = _reflection.GeneratedProtocolMessageType( - "MonitoredResource", - (_message.Message,), - { - "LabelsEntry": _reflection.GeneratedProtocolMessageType( - "LabelsEntry", - (_message.Message,), - { - "DESCRIPTOR": _MONITOREDRESOURCE_LABELSENTRY, - "__module__": "google.api.monitored_resource_pb2" - # @@protoc_insertion_point(class_scope:google.api.MonitoredResource.LabelsEntry) - }, - ), - "DESCRIPTOR": _MONITOREDRESOURCE, - "__module__": "google.api.monitored_resource_pb2" - # @@protoc_insertion_point(class_scope:google.api.MonitoredResource) - }, -) -_sym_db.RegisterMessage(MonitoredResource) -_sym_db.RegisterMessage(MonitoredResource.LabelsEntry) - -MonitoredResourceMetadata = _reflection.GeneratedProtocolMessageType( - "MonitoredResourceMetadata", - (_message.Message,), - { - "UserLabelsEntry": _reflection.GeneratedProtocolMessageType( - "UserLabelsEntry", - (_message.Message,), - { - "DESCRIPTOR": _MONITOREDRESOURCEMETADATA_USERLABELSENTRY, - "__module__": "google.api.monitored_resource_pb2" - # @@protoc_insertion_point(class_scope:google.api.MonitoredResourceMetadata.UserLabelsEntry) - }, - ), - "DESCRIPTOR": _MONITOREDRESOURCEMETADATA, - "__module__": "google.api.monitored_resource_pb2" - # @@protoc_insertion_point(class_scope:google.api.MonitoredResourceMetadata) - }, -) -_sym_db.RegisterMessage(MonitoredResourceMetadata) -_sym_db.RegisterMessage(MonitoredResourceMetadata.UserLabelsEntry) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\026MonitoredResourceProtoP\001ZCgoogle.golang.org/genproto/googleapis/api/monitoredres;monitoredres\370\001\001\242\002\004GAPI" - _MONITOREDRESOURCE_LABELSENTRY._options = None - _MONITOREDRESOURCE_LABELSENTRY._serialized_options = b"8\001" - _MONITOREDRESOURCEMETADATA_USERLABELSENTRY._options = None - _MONITOREDRESOURCEMETADATA_USERLABELSENTRY._serialized_options = b"8\001" - _MONITOREDRESOURCEDESCRIPTOR._serialized_start = 137 - _MONITOREDRESOURCEDESCRIPTOR._serialized_end = 329 - _MONITOREDRESOURCE._serialized_start = 332 - _MONITOREDRESOURCE._serialized_end = 471 - _MONITOREDRESOURCE_LABELSENTRY._serialized_start = 426 - _MONITOREDRESOURCE_LABELSENTRY._serialized_end = 471 - _MONITOREDRESOURCEMETADATA._serialized_start = 474 - _MONITOREDRESOURCEMETADATA._serialized_end = 676 - _MONITOREDRESOURCEMETADATA_USERLABELSENTRY._serialized_start = 627 - _MONITOREDRESOURCEMETADATA_USERLABELSENTRY._serialized_end = 676 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/monitoring.proto b/opensafely/_vendor/google/api/monitoring.proto deleted file mode 100644 index 60770ec5..00000000 --- a/opensafely/_vendor/google/api/monitoring.proto +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "MonitoringProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Monitoring configuration of the service. -// -// The example below shows how to configure monitored resources and metrics -// for monitoring. In the example, a monitored resource and two metrics are -// defined. The `library.googleapis.com/book/returned_count` metric is sent -// to both producer and consumer projects, whereas the -// `library.googleapis.com/book/num_overdue` metric is only sent to the -// consumer project. -// -// monitored_resources: -// - type: library.googleapis.com/Branch -// display_name: "Library Branch" -// description: "A branch of a library." -// launch_stage: GA -// labels: -// - key: resource_container -// description: "The Cloud container (ie. project id) for the Branch." -// - key: location -// description: "The location of the library branch." -// - key: branch_id -// description: "The id of the branch." -// metrics: -// - name: library.googleapis.com/book/returned_count -// display_name: "Books Returned" -// description: "The count of books that have been returned." -// launch_stage: GA -// metric_kind: DELTA -// value_type: INT64 -// unit: "1" -// labels: -// - key: customer_id -// description: "The id of the customer." -// - name: library.googleapis.com/book/num_overdue -// display_name: "Books Overdue" -// description: "The current number of overdue books." -// launch_stage: GA -// metric_kind: GAUGE -// value_type: INT64 -// unit: "1" -// labels: -// - key: customer_id -// description: "The id of the customer." -// monitoring: -// producer_destinations: -// - monitored_resource: library.googleapis.com/Branch -// metrics: -// - library.googleapis.com/book/returned_count -// consumer_destinations: -// - monitored_resource: library.googleapis.com/Branch -// metrics: -// - library.googleapis.com/book/returned_count -// - library.googleapis.com/book/num_overdue -message Monitoring { - // Configuration of a specific monitoring destination (the producer project - // or the consumer project). - message MonitoringDestination { - // The monitored resource type. The type must be defined in - // [Service.monitored_resources][google.api.Service.monitored_resources] section. - string monitored_resource = 1; - - // Types of the metrics to report to this monitoring destination. - // Each type must be defined in [Service.metrics][google.api.Service.metrics] section. - repeated string metrics = 2; - } - - // Monitoring configurations for sending metrics to the producer project. - // There can be multiple producer destinations. A monitored resource type may - // appear in multiple monitoring destinations if different aggregations are - // needed for different sets of metrics associated with that monitored - // resource type. A monitored resource and metric pair may only be used once - // in the Monitoring configuration. - repeated MonitoringDestination producer_destinations = 1; - - // Monitoring configurations for sending metrics to the consumer project. - // There can be multiple consumer destinations. A monitored resource type may - // appear in multiple monitoring destinations if different aggregations are - // needed for different sets of metrics associated with that monitored - // resource type. A monitored resource and metric pair may only be used once - // in the Monitoring configuration. - repeated MonitoringDestination consumer_destinations = 2; -} diff --git a/opensafely/_vendor/google/api/monitoring_pb2.py b/opensafely/_vendor/google/api/monitoring_pb2.py deleted file mode 100644 index 5c3bf08a..00000000 --- a/opensafely/_vendor/google/api/monitoring_pb2.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/monitoring.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1bgoogle/api/monitoring.proto\x12\ngoogle.api"\xec\x01\n\nMonitoring\x12K\n\x15producer_destinations\x18\x01 \x03(\x0b\x32,.google.api.Monitoring.MonitoringDestination\x12K\n\x15\x63onsumer_destinations\x18\x02 \x03(\x0b\x32,.google.api.Monitoring.MonitoringDestination\x1a\x44\n\x15MonitoringDestination\x12\x1a\n\x12monitored_resource\x18\x01 \x01(\t\x12\x0f\n\x07metrics\x18\x02 \x03(\tBq\n\x0e\x63om.google.apiB\x0fMonitoringProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_MONITORING = DESCRIPTOR.message_types_by_name["Monitoring"] -_MONITORING_MONITORINGDESTINATION = _MONITORING.nested_types_by_name[ - "MonitoringDestination" -] -Monitoring = _reflection.GeneratedProtocolMessageType( - "Monitoring", - (_message.Message,), - { - "MonitoringDestination": _reflection.GeneratedProtocolMessageType( - "MonitoringDestination", - (_message.Message,), - { - "DESCRIPTOR": _MONITORING_MONITORINGDESTINATION, - "__module__": "google.api.monitoring_pb2" - # @@protoc_insertion_point(class_scope:google.api.Monitoring.MonitoringDestination) - }, - ), - "DESCRIPTOR": _MONITORING, - "__module__": "google.api.monitoring_pb2" - # @@protoc_insertion_point(class_scope:google.api.Monitoring) - }, -) -_sym_db.RegisterMessage(Monitoring) -_sym_db.RegisterMessage(Monitoring.MonitoringDestination) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\017MonitoringProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _MONITORING._serialized_start = 44 - _MONITORING._serialized_end = 280 - _MONITORING_MONITORINGDESTINATION._serialized_start = 212 - _MONITORING_MONITORINGDESTINATION._serialized_end = 280 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/quota.proto b/opensafely/_vendor/google/api/quota.proto deleted file mode 100644 index dae89de3..00000000 --- a/opensafely/_vendor/google/api/quota.proto +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "QuotaProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Quota configuration helps to achieve fairness and budgeting in service -// usage. -// -// The metric based quota configuration works this way: -// - The service configuration defines a set of metrics. -// - For API calls, the quota.metric_rules maps methods to metrics with -// corresponding costs. -// - The quota.limits defines limits on the metrics, which will be used for -// quota checks at runtime. -// -// An example quota configuration in yaml format: -// -// quota: -// limits: -// -// - name: apiWriteQpsPerProject -// metric: library.googleapis.com/write_calls -// unit: "1/min/{project}" # rate limit for consumer projects -// values: -// STANDARD: 10000 -// -// -// # The metric rules bind all methods to the read_calls metric, -// # except for the UpdateBook and DeleteBook methods. These two methods -// # are mapped to the write_calls metric, with the UpdateBook method -// # consuming at twice rate as the DeleteBook method. -// metric_rules: -// - selector: "*" -// metric_costs: -// library.googleapis.com/read_calls: 1 -// - selector: google.example.library.v1.LibraryService.UpdateBook -// metric_costs: -// library.googleapis.com/write_calls: 2 -// - selector: google.example.library.v1.LibraryService.DeleteBook -// metric_costs: -// library.googleapis.com/write_calls: 1 -// -// Corresponding Metric definition: -// -// metrics: -// - name: library.googleapis.com/read_calls -// display_name: Read requests -// metric_kind: DELTA -// value_type: INT64 -// -// - name: library.googleapis.com/write_calls -// display_name: Write requests -// metric_kind: DELTA -// value_type: INT64 -// -// -message Quota { - // List of `QuotaLimit` definitions for the service. - repeated QuotaLimit limits = 3; - - // List of `MetricRule` definitions, each one mapping a selected method to one - // or more metrics. - repeated MetricRule metric_rules = 4; -} - -// Bind API methods to metrics. Binding a method to a metric causes that -// metric's configured quota behaviors to apply to the method call. -message MetricRule { - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Metrics to update when the selected methods are called, and the associated - // cost applied to each metric. - // - // The key of the map is the metric name, and the values are the amount - // increased for the metric against which the quota limits are defined. - // The value must not be negative. - map metric_costs = 2; -} - -// `QuotaLimit` defines a specific limit that applies over a specified duration -// for a limit type. There can be at most one limit for a duration and limit -// type combination defined within a `QuotaGroup`. -message QuotaLimit { - // Name of the quota limit. - // - // The name must be provided, and it must be unique within the service. The - // name can only include alphanumeric characters as well as '-'. - // - // The maximum length of the limit name is 64 characters. - string name = 6; - - // Optional. User-visible, extended description for this quota limit. - // Should be used only when more context is needed to understand this limit - // than provided by the limit's display name (see: `display_name`). - string description = 2; - - // Default number of tokens that can be consumed during the specified - // duration. This is the number of tokens assigned when a client - // application developer activates the service for his/her project. - // - // Specifying a value of 0 will block all requests. This can be used if you - // are provisioning quota to selected consumers and blocking others. - // Similarly, a value of -1 will indicate an unlimited quota. No other - // negative values are allowed. - // - // Used by group-based quotas only. - int64 default_limit = 3; - - // Maximum number of tokens that can be consumed during the specified - // duration. Client application developers can override the default limit up - // to this maximum. If specified, this value cannot be set to a value less - // than the default limit. If not specified, it is set to the default limit. - // - // To allow clients to apply overrides with no upper bound, set this to -1, - // indicating unlimited maximum quota. - // - // Used by group-based quotas only. - int64 max_limit = 4; - - // Free tier value displayed in the Developers Console for this limit. - // The free tier is the number of tokens that will be subtracted from the - // billed amount when billing is enabled. - // This field can only be set on a limit with duration "1d", in a billable - // group; it is invalid on any other limit. If this field is not set, it - // defaults to 0, indicating that there is no free tier for this service. - // - // Used by group-based quotas only. - int64 free_tier = 7; - - // Duration of this limit in textual notation. Must be "100s" or "1d". - // - // Used by group-based quotas only. - string duration = 5; - - // The name of the metric this quota limit applies to. The quota limits with - // the same metric will be checked together during runtime. The metric must be - // defined within the service config. - string metric = 8; - - // Specify the unit of the quota limit. It uses the same syntax as - // [Metric.unit][]. The supported unit kinds are determined by the quota - // backend system. - // - // Here are some examples: - // * "1/min/{project}" for quota per minute per project. - // - // Note: the order of unit components is insignificant. - // The "1" at the beginning is required to follow the metric unit syntax. - string unit = 9; - - // Tiered limit values. You must specify this as a key:value pair, with an - // integer value that is the maximum number of requests allowed for the - // specified unit. Currently only STANDARD is supported. - map values = 10; - - // User-visible display name for this limit. - // Optional. If not set, the UI will provide a default display name based on - // the quota configuration. This field can be used to override the default - // display name generated from the configuration. - string display_name = 12; -} diff --git a/opensafely/_vendor/google/api/quota_pb2.py b/opensafely/_vendor/google/api/quota_pb2.py deleted file mode 100644 index 76738219..00000000 --- a/opensafely/_vendor/google/api/quota_pb2.py +++ /dev/null @@ -1,112 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/quota.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x16google/api/quota.proto\x12\ngoogle.api"]\n\x05Quota\x12&\n\x06limits\x18\x03 \x03(\x0b\x32\x16.google.api.QuotaLimit\x12,\n\x0cmetric_rules\x18\x04 \x03(\x0b\x32\x16.google.api.MetricRule"\x91\x01\n\nMetricRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12=\n\x0cmetric_costs\x18\x02 \x03(\x0b\x32\'.google.api.MetricRule.MetricCostsEntry\x1a\x32\n\x10MetricCostsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01"\x95\x02\n\nQuotaLimit\x12\x0c\n\x04name\x18\x06 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x15\n\rdefault_limit\x18\x03 \x01(\x03\x12\x11\n\tmax_limit\x18\x04 \x01(\x03\x12\x11\n\tfree_tier\x18\x07 \x01(\x03\x12\x10\n\x08\x64uration\x18\x05 \x01(\t\x12\x0e\n\x06metric\x18\x08 \x01(\t\x12\x0c\n\x04unit\x18\t \x01(\t\x12\x32\n\x06values\x18\n \x03(\x0b\x32".google.api.QuotaLimit.ValuesEntry\x12\x14\n\x0c\x64isplay_name\x18\x0c \x01(\t\x1a-\n\x0bValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\x42l\n\x0e\x63om.google.apiB\nQuotaProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_QUOTA = DESCRIPTOR.message_types_by_name["Quota"] -_METRICRULE = DESCRIPTOR.message_types_by_name["MetricRule"] -_METRICRULE_METRICCOSTSENTRY = _METRICRULE.nested_types_by_name["MetricCostsEntry"] -_QUOTALIMIT = DESCRIPTOR.message_types_by_name["QuotaLimit"] -_QUOTALIMIT_VALUESENTRY = _QUOTALIMIT.nested_types_by_name["ValuesEntry"] -Quota = _reflection.GeneratedProtocolMessageType( - "Quota", - (_message.Message,), - { - "DESCRIPTOR": _QUOTA, - "__module__": "google.api.quota_pb2" - # @@protoc_insertion_point(class_scope:google.api.Quota) - }, -) -_sym_db.RegisterMessage(Quota) - -MetricRule = _reflection.GeneratedProtocolMessageType( - "MetricRule", - (_message.Message,), - { - "MetricCostsEntry": _reflection.GeneratedProtocolMessageType( - "MetricCostsEntry", - (_message.Message,), - { - "DESCRIPTOR": _METRICRULE_METRICCOSTSENTRY, - "__module__": "google.api.quota_pb2" - # @@protoc_insertion_point(class_scope:google.api.MetricRule.MetricCostsEntry) - }, - ), - "DESCRIPTOR": _METRICRULE, - "__module__": "google.api.quota_pb2" - # @@protoc_insertion_point(class_scope:google.api.MetricRule) - }, -) -_sym_db.RegisterMessage(MetricRule) -_sym_db.RegisterMessage(MetricRule.MetricCostsEntry) - -QuotaLimit = _reflection.GeneratedProtocolMessageType( - "QuotaLimit", - (_message.Message,), - { - "ValuesEntry": _reflection.GeneratedProtocolMessageType( - "ValuesEntry", - (_message.Message,), - { - "DESCRIPTOR": _QUOTALIMIT_VALUESENTRY, - "__module__": "google.api.quota_pb2" - # @@protoc_insertion_point(class_scope:google.api.QuotaLimit.ValuesEntry) - }, - ), - "DESCRIPTOR": _QUOTALIMIT, - "__module__": "google.api.quota_pb2" - # @@protoc_insertion_point(class_scope:google.api.QuotaLimit) - }, -) -_sym_db.RegisterMessage(QuotaLimit) -_sym_db.RegisterMessage(QuotaLimit.ValuesEntry) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\nQuotaProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _METRICRULE_METRICCOSTSENTRY._options = None - _METRICRULE_METRICCOSTSENTRY._serialized_options = b"8\001" - _QUOTALIMIT_VALUESENTRY._options = None - _QUOTALIMIT_VALUESENTRY._serialized_options = b"8\001" - _QUOTA._serialized_start = 38 - _QUOTA._serialized_end = 131 - _METRICRULE._serialized_start = 134 - _METRICRULE._serialized_end = 279 - _METRICRULE_METRICCOSTSENTRY._serialized_start = 229 - _METRICRULE_METRICCOSTSENTRY._serialized_end = 279 - _QUOTALIMIT._serialized_start = 282 - _QUOTALIMIT._serialized_end = 559 - _QUOTALIMIT_VALUESENTRY._serialized_start = 514 - _QUOTALIMIT_VALUESENTRY._serialized_end = 559 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/resource.proto b/opensafely/_vendor/google/api/resource.proto deleted file mode 100644 index 0ce0344f..00000000 --- a/opensafely/_vendor/google/api/resource.proto +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright 2018 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/descriptor.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.FieldOptions { - // An annotation that describes a resource reference, see - // [ResourceReference][]. - google.api.ResourceReference resource_reference = 1055; -} - -extend google.protobuf.FileOptions { - // An annotation that describes a resource definition without a corresponding - // message; see [ResourceDescriptor][]. - repeated google.api.ResourceDescriptor resource_definition = 1053; -} - -extend google.protobuf.MessageOptions { - // An annotation that describes a resource definition, see - // [ResourceDescriptor][]. - google.api.ResourceDescriptor resource = 1053; -} - -// A simple descriptor of a resource type. -// -// ResourceDescriptor annotates a resource message (either by means of a -// protobuf annotation or use in the service config), and associates the -// resource's schema, the resource type, and the pattern of the resource name. -// -// Example: -// -// message Topic { -// // Indicates this message defines a resource schema. -// // Declares the resource type in the format of {service}/{kind}. -// // For Kubernetes resources, the format is {api group}/{kind}. -// option (google.api.resource) = { -// type: "pubsub.googleapis.com/Topic" -// pattern: "projects/{project}/topics/{topic}" -// }; -// } -// -// The ResourceDescriptor Yaml config will look like: -// -// resources: -// - type: "pubsub.googleapis.com/Topic" -// pattern: "projects/{project}/topics/{topic}" -// -// Sometimes, resources have multiple patterns, typically because they can -// live under multiple parents. -// -// Example: -// -// message LogEntry { -// option (google.api.resource) = { -// type: "logging.googleapis.com/LogEntry" -// pattern: "projects/{project}/logs/{log}" -// pattern: "folders/{folder}/logs/{log}" -// pattern: "organizations/{organization}/logs/{log}" -// pattern: "billingAccounts/{billing_account}/logs/{log}" -// }; -// } -// -// The ResourceDescriptor Yaml config will look like: -// -// resources: -// - type: 'logging.googleapis.com/LogEntry' -// pattern: "projects/{project}/logs/{log}" -// pattern: "folders/{folder}/logs/{log}" -// pattern: "organizations/{organization}/logs/{log}" -// pattern: "billingAccounts/{billing_account}/logs/{log}" -message ResourceDescriptor { - // A description of the historical or future-looking state of the - // resource pattern. - enum History { - // The "unset" value. - HISTORY_UNSPECIFIED = 0; - - // The resource originally had one pattern and launched as such, and - // additional patterns were added later. - ORIGINALLY_SINGLE_PATTERN = 1; - - // The resource has one pattern, but the API owner expects to add more - // later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents - // that from being necessary once there are multiple patterns.) - FUTURE_MULTI_PATTERN = 2; - } - - // A flag representing a specific style that a resource claims to conform to. - enum Style { - // The unspecified value. Do not use. - STYLE_UNSPECIFIED = 0; - - // This resource is intended to be "declarative-friendly". - // - // Declarative-friendly resources must be more strictly consistent, and - // setting this to true communicates to tools that this resource should - // adhere to declarative-friendly expectations. - // - // Note: This is used by the API linter (linter.aip.dev) to enable - // additional checks. - DECLARATIVE_FRIENDLY = 1; - } - - // The resource type. It must be in the format of - // {service_name}/{resource_type_kind}. The `resource_type_kind` must be - // singular and must not include version numbers. - // - // Example: `storage.googleapis.com/Bucket` - // - // The value of the resource_type_kind must follow the regular expression - // /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and - // should use PascalCase (UpperCamelCase). The maximum number of - // characters allowed for the `resource_type_kind` is 100. - string type = 1; - - // Optional. The relative resource name pattern associated with this resource - // type. The DNS prefix of the full resource name shouldn't be specified here. - // - // The path pattern must follow the syntax, which aligns with HTTP binding - // syntax: - // - // Template = Segment { "/" Segment } ; - // Segment = LITERAL | Variable ; - // Variable = "{" LITERAL "}" ; - // - // Examples: - // - // - "projects/{project}/topics/{topic}" - // - "projects/{project}/knowledgeBases/{knowledge_base}" - // - // The components in braces correspond to the IDs for each resource in the - // hierarchy. It is expected that, if multiple patterns are provided, - // the same component name (e.g. "project") refers to IDs of the same - // type of resource. - repeated string pattern = 2; - - // Optional. The field on the resource that designates the resource name - // field. If omitted, this is assumed to be "name". - string name_field = 3; - - // Optional. The historical or future-looking state of the resource pattern. - // - // Example: - // - // // The InspectTemplate message originally only supported resource - // // names with organization, and project was added later. - // message InspectTemplate { - // option (google.api.resource) = { - // type: "dlp.googleapis.com/InspectTemplate" - // pattern: - // "organizations/{organization}/inspectTemplates/{inspect_template}" - // pattern: "projects/{project}/inspectTemplates/{inspect_template}" - // history: ORIGINALLY_SINGLE_PATTERN - // }; - // } - History history = 4; - - // The plural name used in the resource name and permission names, such as - // 'projects' for the resource name of 'projects/{project}' and the permission - // name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same - // concept of the `plural` field in k8s CRD spec - // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - // - // Note: The plural form is required even for singleton resources. See - // https://aip.dev/156 - string plural = 5; - - // The same concept of the `singular` field in k8s CRD spec - // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - // Such as "project" for the `resourcemanager.googleapis.com/Project` type. - string singular = 6; - - // Style flag(s) for this resource. - // These indicate that a resource is expected to conform to a given - // style. See the specific style flags for additional information. - repeated Style style = 10; -} - -// Defines a proto annotation that describes a string field that refers to -// an API resource. -message ResourceReference { - // The resource type that the annotated field references. - // - // Example: - // - // message Subscription { - // string topic = 2 [(google.api.resource_reference) = { - // type: "pubsub.googleapis.com/Topic" - // }]; - // } - // - // Occasionally, a field may reference an arbitrary resource. In this case, - // APIs use the special value * in their resource reference. - // - // Example: - // - // message GetIamPolicyRequest { - // string resource = 2 [(google.api.resource_reference) = { - // type: "*" - // }]; - // } - string type = 1; - - // The resource type of a child collection that the annotated field - // references. This is useful for annotating the `parent` field that - // doesn't have a fixed resource type. - // - // Example: - // - // message ListLogEntriesRequest { - // string parent = 1 [(google.api.resource_reference) = { - // child_type: "logging.googleapis.com/LogEntry" - // }; - // } - string child_type = 2; -} diff --git a/opensafely/_vendor/google/api/resource_pb2.py b/opensafely/_vendor/google/api/resource_pb2.py deleted file mode 100644 index 2fb5019a..00000000 --- a/opensafely/_vendor/google/api/resource_pb2.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/resource.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x19google/api/resource.proto\x12\ngoogle.api\x1a google/protobuf/descriptor.proto"\xee\x02\n\x12ResourceDescriptor\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0f\n\x07pattern\x18\x02 \x03(\t\x12\x12\n\nname_field\x18\x03 \x01(\t\x12\x37\n\x07history\x18\x04 \x01(\x0e\x32&.google.api.ResourceDescriptor.History\x12\x0e\n\x06plural\x18\x05 \x01(\t\x12\x10\n\x08singular\x18\x06 \x01(\t\x12\x33\n\x05style\x18\n \x03(\x0e\x32$.google.api.ResourceDescriptor.Style"[\n\x07History\x12\x17\n\x13HISTORY_UNSPECIFIED\x10\x00\x12\x1d\n\x19ORIGINALLY_SINGLE_PATTERN\x10\x01\x12\x18\n\x14\x46UTURE_MULTI_PATTERN\x10\x02"8\n\x05Style\x12\x15\n\x11STYLE_UNSPECIFIED\x10\x00\x12\x18\n\x14\x44\x45\x43LARATIVE_FRIENDLY\x10\x01"5\n\x11ResourceReference\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x12\n\nchild_type\x18\x02 \x01(\t:Y\n\x12resource_reference\x12\x1d.google.protobuf.FieldOptions\x18\x9f\x08 \x01(\x0b\x32\x1d.google.api.ResourceReference:Z\n\x13resource_definition\x12\x1c.google.protobuf.FileOptions\x18\x9d\x08 \x03(\x0b\x32\x1e.google.api.ResourceDescriptor:R\n\x08resource\x12\x1f.google.protobuf.MessageOptions\x18\x9d\x08 \x01(\x0b\x32\x1e.google.api.ResourceDescriptorBn\n\x0e\x63om.google.apiB\rResourceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3' -) - - -RESOURCE_REFERENCE_FIELD_NUMBER = 1055 -resource_reference = DESCRIPTOR.extensions_by_name["resource_reference"] -RESOURCE_DEFINITION_FIELD_NUMBER = 1053 -resource_definition = DESCRIPTOR.extensions_by_name["resource_definition"] -RESOURCE_FIELD_NUMBER = 1053 -resource = DESCRIPTOR.extensions_by_name["resource"] - -_RESOURCEDESCRIPTOR = DESCRIPTOR.message_types_by_name["ResourceDescriptor"] -_RESOURCEREFERENCE = DESCRIPTOR.message_types_by_name["ResourceReference"] -_RESOURCEDESCRIPTOR_HISTORY = _RESOURCEDESCRIPTOR.enum_types_by_name["History"] -_RESOURCEDESCRIPTOR_STYLE = _RESOURCEDESCRIPTOR.enum_types_by_name["Style"] -ResourceDescriptor = _reflection.GeneratedProtocolMessageType( - "ResourceDescriptor", - (_message.Message,), - { - "DESCRIPTOR": _RESOURCEDESCRIPTOR, - "__module__": "google.api.resource_pb2" - # @@protoc_insertion_point(class_scope:google.api.ResourceDescriptor) - }, -) -_sym_db.RegisterMessage(ResourceDescriptor) - -ResourceReference = _reflection.GeneratedProtocolMessageType( - "ResourceReference", - (_message.Message,), - { - "DESCRIPTOR": _RESOURCEREFERENCE, - "__module__": "google.api.resource_pb2" - # @@protoc_insertion_point(class_scope:google.api.ResourceReference) - }, -) -_sym_db.RegisterMessage(ResourceReference) - -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.FieldOptions.RegisterExtension( - resource_reference - ) - google_dot_protobuf_dot_descriptor__pb2.FileOptions.RegisterExtension( - resource_definition - ) - google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(resource) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\rResourceProtoP\001ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\370\001\001\242\002\004GAPI" - _RESOURCEDESCRIPTOR._serialized_start = 76 - _RESOURCEDESCRIPTOR._serialized_end = 442 - _RESOURCEDESCRIPTOR_HISTORY._serialized_start = 293 - _RESOURCEDESCRIPTOR_HISTORY._serialized_end = 384 - _RESOURCEDESCRIPTOR_STYLE._serialized_start = 386 - _RESOURCEDESCRIPTOR_STYLE._serialized_end = 442 - _RESOURCEREFERENCE._serialized_start = 444 - _RESOURCEREFERENCE._serialized_end = 497 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/routing.proto b/opensafely/_vendor/google/api/routing.proto deleted file mode 100644 index 01382838..00000000 --- a/opensafely/_vendor/google/api/routing.proto +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "RoutingProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // See RoutingRule. - google.api.RoutingRule routing = 72295729; -} - -// Specifies the routing information that should be sent along with the request -// in the form of routing header. -// **NOTE:** All service configuration rules follow the "last one wins" order. -// -// The examples below will apply to an RPC which has the following request type: -// -// Message Definition: -// -// message Request { -// // The name of the Table -// // Values can be of the following formats: -// // - `projects//tables/` -// // - `projects//instances//tables/
` -// // - `region//zones//tables/
` -// string table_name = 1; -// -// // This value specifies routing for replication. -// // It can be in the following formats: -// // - `profiles/` -// // - a legacy `profile_id` that can be any string -// string app_profile_id = 2; -// } -// -// Example message: -// -// { -// table_name: projects/proj_foo/instances/instance_bar/table/table_baz, -// app_profile_id: profiles/prof_qux -// } -// -// The routing header consists of one or multiple key-value pairs. Every key -// and value must be percent-encoded, and joined together in the format of -// `key1=value1&key2=value2`. -// In the examples below I am skipping the percent-encoding for readablity. -// -// Example 1 -// -// Extracting a field from the request to put into the routing header -// unchanged, with the key equal to the field name. -// -// annotation: -// -// option (google.api.routing) = { -// // Take the `app_profile_id`. -// routing_parameters { -// field: "app_profile_id" -// } -// }; -// -// result: -// -// x-goog-request-params: app_profile_id=profiles/prof_qux -// -// Example 2 -// -// Extracting a field from the request to put into the routing header -// unchanged, with the key different from the field name. -// -// annotation: -// -// option (google.api.routing) = { -// // Take the `app_profile_id`, but name it `routing_id` in the header. -// routing_parameters { -// field: "app_profile_id" -// path_template: "{routing_id=**}" -// } -// }; -// -// result: -// -// x-goog-request-params: routing_id=profiles/prof_qux -// -// Example 3 -// -// Extracting a field from the request to put into the routing -// header, while matching a path template syntax on the field's value. -// -// NB: it is more useful to send nothing than to send garbage for the purpose -// of dynamic routing, since garbage pollutes cache. Thus the matching. -// -// Sub-example 3a -// -// The field matches the template. -// -// annotation: -// -// option (google.api.routing) = { -// // Take the `table_name`, if it's well-formed (with project-based -// // syntax). -// routing_parameters { -// field: "table_name" -// path_template: "{table_name=projects/*/instances/*/**}" -// } -// }; -// -// result: -// -// x-goog-request-params: -// table_name=projects/proj_foo/instances/instance_bar/table/table_baz -// -// Sub-example 3b -// -// The field does not match the template. -// -// annotation: -// -// option (google.api.routing) = { -// // Take the `table_name`, if it's well-formed (with region-based -// // syntax). -// routing_parameters { -// field: "table_name" -// path_template: "{table_name=regions/*/zones/*/**}" -// } -// }; -// -// result: -// -// -// -// Sub-example 3c -// -// Multiple alternative conflictingly named path templates are -// specified. The one that matches is used to construct the header. -// -// annotation: -// -// option (google.api.routing) = { -// // Take the `table_name`, if it's well-formed, whether -// // using the region- or projects-based syntax. -// -// routing_parameters { -// field: "table_name" -// path_template: "{table_name=regions/*/zones/*/**}" -// } -// routing_parameters { -// field: "table_name" -// path_template: "{table_name=projects/*/instances/*/**}" -// } -// }; -// -// result: -// -// x-goog-request-params: -// table_name=projects/proj_foo/instances/instance_bar/table/table_baz -// -// Example 4 -// -// Extracting a single routing header key-value pair by matching a -// template syntax on (a part of) a single request field. -// -// annotation: -// -// option (google.api.routing) = { -// // Take just the project id from the `table_name` field. -// routing_parameters { -// field: "table_name" -// path_template: "{routing_id=projects/*}/**" -// } -// }; -// -// result: -// -// x-goog-request-params: routing_id=projects/proj_foo -// -// Example 5 -// -// Extracting a single routing header key-value pair by matching -// several conflictingly named path templates on (parts of) a single request -// field. The last template to match "wins" the conflict. -// -// annotation: -// -// option (google.api.routing) = { -// // If the `table_name` does not have instances information, -// // take just the project id for routing. -// // Otherwise take project + instance. -// -// routing_parameters { -// field: "table_name" -// path_template: "{routing_id=projects/*}/**" -// } -// routing_parameters { -// field: "table_name" -// path_template: "{routing_id=projects/*/instances/*}/**" -// } -// }; -// -// result: -// -// x-goog-request-params: -// routing_id=projects/proj_foo/instances/instance_bar -// -// Example 6 -// -// Extracting multiple routing header key-value pairs by matching -// several non-conflicting path templates on (parts of) a single request field. -// -// Sub-example 6a -// -// Make the templates strict, so that if the `table_name` does not -// have an instance information, nothing is sent. -// -// annotation: -// -// option (google.api.routing) = { -// // The routing code needs two keys instead of one composite -// // but works only for the tables with the "project-instance" name -// // syntax. -// -// routing_parameters { -// field: "table_name" -// path_template: "{project_id=projects/*}/instances/*/**" -// } -// routing_parameters { -// field: "table_name" -// path_template: "projects/*/{instance_id=instances/*}/**" -// } -// }; -// -// result: -// -// x-goog-request-params: -// project_id=projects/proj_foo&instance_id=instances/instance_bar -// -// Sub-example 6b -// -// Make the templates loose, so that if the `table_name` does not -// have an instance information, just the project id part is sent. -// -// annotation: -// -// option (google.api.routing) = { -// // The routing code wants two keys instead of one composite -// // but will work with just the `project_id` for tables without -// // an instance in the `table_name`. -// -// routing_parameters { -// field: "table_name" -// path_template: "{project_id=projects/*}/**" -// } -// routing_parameters { -// field: "table_name" -// path_template: "projects/*/{instance_id=instances/*}/**" -// } -// }; -// -// result (is the same as 6a for our example message because it has the instance -// information): -// -// x-goog-request-params: -// project_id=projects/proj_foo&instance_id=instances/instance_bar -// -// Example 7 -// -// Extracting multiple routing header key-value pairs by matching -// several path templates on multiple request fields. -// -// NB: note that here there is no way to specify sending nothing if one of the -// fields does not match its template. E.g. if the `table_name` is in the wrong -// format, the `project_id` will not be sent, but the `routing_id` will be. -// The backend routing code has to be aware of that and be prepared to not -// receive a full complement of keys if it expects multiple. -// -// annotation: -// -// option (google.api.routing) = { -// // The routing needs both `project_id` and `routing_id` -// // (from the `app_profile_id` field) for routing. -// -// routing_parameters { -// field: "table_name" -// path_template: "{project_id=projects/*}/**" -// } -// routing_parameters { -// field: "app_profile_id" -// path_template: "{routing_id=**}" -// } -// }; -// -// result: -// -// x-goog-request-params: -// project_id=projects/proj_foo&routing_id=profiles/prof_qux -// -// Example 8 -// -// Extracting a single routing header key-value pair by matching -// several conflictingly named path templates on several request fields. The -// last template to match "wins" the conflict. -// -// annotation: -// -// option (google.api.routing) = { -// // The `routing_id` can be a project id or a region id depending on -// // the table name format, but only if the `app_profile_id` is not set. -// // If `app_profile_id` is set it should be used instead. -// -// routing_parameters { -// field: "table_name" -// path_template: "{routing_id=projects/*}/**" -// } -// routing_parameters { -// field: "table_name" -// path_template: "{routing_id=regions/*}/**" -// } -// routing_parameters { -// field: "app_profile_id" -// path_template: "{routing_id=**}" -// } -// }; -// -// result: -// -// x-goog-request-params: routing_id=profiles/prof_qux -// -// Example 9 -// -// Bringing it all together. -// -// annotation: -// -// option (google.api.routing) = { -// // For routing both `table_location` and a `routing_id` are needed. -// // -// // table_location can be either an instance id or a region+zone id. -// // -// // For `routing_id`, take the value of `app_profile_id` -// // - If it's in the format `profiles/`, send -// // just the `` part. -// // - If it's any other literal, send it as is. -// // If the `app_profile_id` is empty, and the `table_name` starts with -// // the project_id, send that instead. -// -// routing_parameters { -// field: "table_name" -// path_template: "projects/*/{table_location=instances/*}/tables/*" -// } -// routing_parameters { -// field: "table_name" -// path_template: "{table_location=regions/*/zones/*}/tables/*" -// } -// routing_parameters { -// field: "table_name" -// path_template: "{routing_id=projects/*}/**" -// } -// routing_parameters { -// field: "app_profile_id" -// path_template: "{routing_id=**}" -// } -// routing_parameters { -// field: "app_profile_id" -// path_template: "profiles/{routing_id=*}" -// } -// }; -// -// result: -// -// x-goog-request-params: -// table_location=instances/instance_bar&routing_id=prof_qux -message RoutingRule { - // A collection of Routing Parameter specifications. - // **NOTE:** If multiple Routing Parameters describe the same key - // (via the `path_template` field or via the `field` field when - // `path_template` is not provided), "last one wins" rule - // determines which Parameter gets used. - // See the examples for more details. - repeated RoutingParameter routing_parameters = 2; -} - -// A projection from an input message to the GRPC or REST header. -message RoutingParameter { - // A request field to extract the header key-value pair from. - string field = 1; - - // A pattern matching the key-value field. Optional. - // If not specified, the whole field specified in the `field` field will be - // taken as value, and its name used as key. If specified, it MUST contain - // exactly one named segment (along with any number of unnamed segments) The - // pattern will be matched over the field specified in the `field` field, then - // if the match is successful: - // - the name of the single named segment will be used as a header name, - // - the match value of the segment will be used as a header value; - // if the match is NOT successful, nothing will be sent. - // - // Example: - // - // -- This is a field in the request message - // | that the header value will be extracted from. - // | - // | -- This is the key name in the - // | | routing header. - // V | - // field: "table_name" v - // path_template: "projects/*/{table_location=instances/*}/tables/*" - // ^ ^ - // | | - // In the {} brackets is the pattern that -- | - // specifies what to extract from the | - // field as a value to be sent. | - // | - // The string in the field must match the whole pattern -- - // before brackets, inside brackets, after brackets. - // - // When looking at this specific example, we can see that: - // - A key-value pair with the key `table_location` - // and the value matching `instances/*` should be added - // to the x-goog-request-params routing header. - // - The value is extracted from the request message's `table_name` field - // if it matches the full pattern specified: - // `projects/*/instances/*/tables/*`. - // - // **NB:** If the `path_template` field is not provided, the key name is - // equal to the field name, and the whole field should be sent as a value. - // This makes the pattern for the field and the value functionally equivalent - // to `**`, and the configuration - // - // { - // field: "table_name" - // } - // - // is a functionally equivalent shorthand to: - // - // { - // field: "table_name" - // path_template: "{table_name=**}" - // } - // - // See Example 1 for more details. - string path_template = 2; -} diff --git a/opensafely/_vendor/google/api/routing_pb2.py b/opensafely/_vendor/google/api/routing_pb2.py deleted file mode 100644 index 7a3651ce..00000000 --- a/opensafely/_vendor/google/api/routing_pb2.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/routing.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x18google/api/routing.proto\x12\ngoogle.api\x1a google/protobuf/descriptor.proto"G\n\x0bRoutingRule\x12\x38\n\x12routing_parameters\x18\x02 \x03(\x0b\x32\x1c.google.api.RoutingParameter"8\n\x10RoutingParameter\x12\r\n\x05\x66ield\x18\x01 \x01(\t\x12\x15\n\rpath_template\x18\x02 \x01(\t:K\n\x07routing\x12\x1e.google.protobuf.MethodOptions\x18\xb1\xca\xbc" \x01(\x0b\x32\x17.google.api.RoutingRuleBj\n\x0e\x63om.google.apiB\x0cRoutingProtoP\x01ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\xa2\x02\x04GAPIb\x06proto3' -) - - -ROUTING_FIELD_NUMBER = 72295729 -routing = DESCRIPTOR.extensions_by_name["routing"] - -_ROUTINGRULE = DESCRIPTOR.message_types_by_name["RoutingRule"] -_ROUTINGPARAMETER = DESCRIPTOR.message_types_by_name["RoutingParameter"] -RoutingRule = _reflection.GeneratedProtocolMessageType( - "RoutingRule", - (_message.Message,), - { - "DESCRIPTOR": _ROUTINGRULE, - "__module__": "google.api.routing_pb2" - # @@protoc_insertion_point(class_scope:google.api.RoutingRule) - }, -) -_sym_db.RegisterMessage(RoutingRule) - -RoutingParameter = _reflection.GeneratedProtocolMessageType( - "RoutingParameter", - (_message.Message,), - { - "DESCRIPTOR": _ROUTINGPARAMETER, - "__module__": "google.api.routing_pb2" - # @@protoc_insertion_point(class_scope:google.api.RoutingParameter) - }, -) -_sym_db.RegisterMessage(RoutingParameter) - -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension(routing) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\014RoutingProtoP\001ZAgoogle.golang.org/genproto/googleapis/api/annotations;annotations\242\002\004GAPI" - _ROUTINGRULE._serialized_start = 74 - _ROUTINGRULE._serialized_end = 145 - _ROUTINGPARAMETER._serialized_start = 147 - _ROUTINGPARAMETER._serialized_end = 203 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/service.proto b/opensafely/_vendor/google/api/service.proto deleted file mode 100644 index 7cae8a94..00000000 --- a/opensafely/_vendor/google/api/service.proto +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/api/auth.proto"; -import "google/api/backend.proto"; -import "google/api/billing.proto"; -import "google/api/context.proto"; -import "google/api/control.proto"; -import "google/api/documentation.proto"; -import "google/api/endpoint.proto"; -import "google/api/http.proto"; -import "google/api/log.proto"; -import "google/api/logging.proto"; -import "google/api/metric.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/monitoring.proto"; -import "google/api/quota.proto"; -import "google/api/source_info.proto"; -import "google/api/system_parameter.proto"; -import "google/api/usage.proto"; -import "google/protobuf/api.proto"; -import "google/protobuf/type.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Service` is the root object of Google service configuration schema. It -// describes basic information about a service, such as the name and the -// title, and delegates other aspects to sub-sections. Each sub-section is -// either a proto message or a repeated proto message that configures a -// specific aspect, such as auth. See each proto message definition for details. -// -// Example: -// -// type: google.api.Service -// name: calendar.googleapis.com -// title: Google Calendar API -// apis: -// - name: google.calendar.v3.Calendar -// authentication: -// providers: -// - id: google_calendar_auth -// jwks_uri: https://www.googleapis.com/oauth2/v1/certs -// issuer: https://securetoken.google.com -// rules: -// - selector: "*" -// requirements: -// provider_id: google_calendar_auth -message Service { - // The service name, which is a DNS-like logical identifier for the - // service, such as `calendar.googleapis.com`. The service name - // typically goes through DNS verification to make sure the owner - // of the service also owns the DNS name. - string name = 1; - - // The product title for this service. - string title = 2; - - // The Google project that owns this service. - string producer_project_id = 22; - - // A unique ID for a specific instance of this message, typically assigned - // by the client for tracking purpose. Must be no longer than 63 characters - // and only lower case letters, digits, '.', '_' and '-' are allowed. If - // empty, the server may choose to generate one instead. - string id = 33; - - // A list of API interfaces exported by this service. Only the `name` field - // of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration - // author, as the remaining fields will be derived from the IDL during the - // normalization process. It is an error to specify an API interface here - // which cannot be resolved against the associated IDL files. - repeated google.protobuf.Api apis = 3; - - // A list of all proto message types included in this API service. - // Types referenced directly or indirectly by the `apis` are - // automatically included. Messages which are not referenced but - // shall be included, such as types used by the `google.protobuf.Any` type, - // should be listed here by name. Example: - // - // types: - // - name: google.protobuf.Int32 - repeated google.protobuf.Type types = 4; - - // A list of all enum types included in this API service. Enums - // referenced directly or indirectly by the `apis` are automatically - // included. Enums which are not referenced but shall be included - // should be listed here by name. Example: - // - // enums: - // - name: google.someapi.v1.SomeEnum - repeated google.protobuf.Enum enums = 5; - - // Additional API documentation. - Documentation documentation = 6; - - // API backend configuration. - Backend backend = 8; - - // HTTP configuration. - Http http = 9; - - // Quota configuration. - Quota quota = 10; - - // Auth configuration. - Authentication authentication = 11; - - // Context configuration. - Context context = 12; - - // Configuration controlling usage of this service. - Usage usage = 15; - - // Configuration for network endpoints. If this is empty, then an endpoint - // with the same name as the service is automatically generated to service all - // defined APIs. - repeated Endpoint endpoints = 18; - - // Configuration for the service control plane. - Control control = 21; - - // Defines the logs used by this service. - repeated LogDescriptor logs = 23; - - // Defines the metrics used by this service. - repeated MetricDescriptor metrics = 24; - - // Defines the monitored resources used by this service. This is required - // by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. - repeated MonitoredResourceDescriptor monitored_resources = 25; - - // Billing configuration. - Billing billing = 26; - - // Logging configuration. - Logging logging = 27; - - // Monitoring configuration. - Monitoring monitoring = 28; - - // System parameter configuration. - SystemParameters system_parameters = 29; - - // Output only. The source information for this configuration if available. - SourceInfo source_info = 37; - - // Obsolete. Do not use. - // - // This field has no semantic meaning. The service config compiler always - // sets this field to `3`. - google.protobuf.UInt32Value config_version = 20 [deprecated = true]; -} diff --git a/opensafely/_vendor/google/api/service_pb2.py b/opensafely/_vendor/google/api/service_pb2.py deleted file mode 100644 index 1e077ba2..00000000 --- a/opensafely/_vendor/google/api/service_pb2.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/service.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.api import auth_pb2 as google_dot_api_dot_auth__pb2 -from opensafely._vendor.google.api import backend_pb2 as google_dot_api_dot_backend__pb2 -from opensafely._vendor.google.api import billing_pb2 as google_dot_api_dot_billing__pb2 -from opensafely._vendor.google.api import context_pb2 as google_dot_api_dot_context__pb2 -from opensafely._vendor.google.api import control_pb2 as google_dot_api_dot_control__pb2 -from opensafely._vendor.google.api import documentation_pb2 as google_dot_api_dot_documentation__pb2 -from opensafely._vendor.google.api import endpoint_pb2 as google_dot_api_dot_endpoint__pb2 -from opensafely._vendor.google.api import http_pb2 as google_dot_api_dot_http__pb2 -from opensafely._vendor.google.api import log_pb2 as google_dot_api_dot_log__pb2 -from opensafely._vendor.google.api import logging_pb2 as google_dot_api_dot_logging__pb2 -from opensafely._vendor.google.api import metric_pb2 as google_dot_api_dot_metric__pb2 -from opensafely._vendor.google.api import ( - monitored_resource_pb2 as google_dot_api_dot_monitored__resource__pb2, -) -from opensafely._vendor.google.api import monitoring_pb2 as google_dot_api_dot_monitoring__pb2 -from opensafely._vendor.google.api import quota_pb2 as google_dot_api_dot_quota__pb2 -from opensafely._vendor.google.api import source_info_pb2 as google_dot_api_dot_source__info__pb2 -from opensafely._vendor.google.api import system_parameter_pb2 as google_dot_api_dot_system__parameter__pb2 -from opensafely._vendor.google.api import usage_pb2 as google_dot_api_dot_usage__pb2 -from opensafely._vendor.google.protobuf import api_pb2 as google_dot_protobuf_dot_api__pb2 -from opensafely._vendor.google.protobuf import type_pb2 as google_dot_protobuf_dot_type__pb2 -from opensafely._vendor.google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n\x18google/api/service.proto\x12\ngoogle.api\x1a\x15google/api/auth.proto\x1a\x18google/api/backend.proto\x1a\x18google/api/billing.proto\x1a\x18google/api/context.proto\x1a\x18google/api/control.proto\x1a\x1egoogle/api/documentation.proto\x1a\x19google/api/endpoint.proto\x1a\x15google/api/http.proto\x1a\x14google/api/log.proto\x1a\x18google/api/logging.proto\x1a\x17google/api/metric.proto\x1a#google/api/monitored_resource.proto\x1a\x1bgoogle/api/monitoring.proto\x1a\x16google/api/quota.proto\x1a\x1cgoogle/api/source_info.proto\x1a!google/api/system_parameter.proto\x1a\x16google/api/usage.proto\x1a\x19google/protobuf/api.proto\x1a\x1agoogle/protobuf/type.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xda\x07\n\x07Service\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12\x1b\n\x13producer_project_id\x18\x16 \x01(\t\x12\n\n\x02id\x18! \x01(\t\x12\"\n\x04\x61pis\x18\x03 \x03(\x0b\x32\x14.google.protobuf.Api\x12$\n\x05types\x18\x04 \x03(\x0b\x32\x15.google.protobuf.Type\x12$\n\x05\x65nums\x18\x05 \x03(\x0b\x32\x15.google.protobuf.Enum\x12\x30\n\rdocumentation\x18\x06 \x01(\x0b\x32\x19.google.api.Documentation\x12$\n\x07\x62\x61\x63kend\x18\x08 \x01(\x0b\x32\x13.google.api.Backend\x12\x1e\n\x04http\x18\t \x01(\x0b\x32\x10.google.api.Http\x12 \n\x05quota\x18\n \x01(\x0b\x32\x11.google.api.Quota\x12\x32\n\x0e\x61uthentication\x18\x0b \x01(\x0b\x32\x1a.google.api.Authentication\x12$\n\x07\x63ontext\x18\x0c \x01(\x0b\x32\x13.google.api.Context\x12 \n\x05usage\x18\x0f \x01(\x0b\x32\x11.google.api.Usage\x12'\n\tendpoints\x18\x12 \x03(\x0b\x32\x14.google.api.Endpoint\x12$\n\x07\x63ontrol\x18\x15 \x01(\x0b\x32\x13.google.api.Control\x12'\n\x04logs\x18\x17 \x03(\x0b\x32\x19.google.api.LogDescriptor\x12-\n\x07metrics\x18\x18 \x03(\x0b\x32\x1c.google.api.MetricDescriptor\x12\x44\n\x13monitored_resources\x18\x19 \x03(\x0b\x32'.google.api.MonitoredResourceDescriptor\x12$\n\x07\x62illing\x18\x1a \x01(\x0b\x32\x13.google.api.Billing\x12$\n\x07logging\x18\x1b \x01(\x0b\x32\x13.google.api.Logging\x12*\n\nmonitoring\x18\x1c \x01(\x0b\x32\x16.google.api.Monitoring\x12\x37\n\x11system_parameters\x18\x1d \x01(\x0b\x32\x1c.google.api.SystemParameters\x12+\n\x0bsource_info\x18% \x01(\x0b\x32\x16.google.api.SourceInfo\x12\x38\n\x0e\x63onfig_version\x18\x14 \x01(\x0b\x32\x1c.google.protobuf.UInt32ValueB\x02\x18\x01\x42n\n\x0e\x63om.google.apiB\x0cServiceProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3" -) - - -_SERVICE = DESCRIPTOR.message_types_by_name["Service"] -Service = _reflection.GeneratedProtocolMessageType( - "Service", - (_message.Message,), - { - "DESCRIPTOR": _SERVICE, - "__module__": "google.api.service_pb2" - # @@protoc_insertion_point(class_scope:google.api.Service) - }, -) -_sym_db.RegisterMessage(Service) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\014ServiceProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _SERVICE.fields_by_name["config_version"]._options = None - _SERVICE.fields_by_name["config_version"]._serialized_options = b"\030\001" - _SERVICE._serialized_start = 589 - _SERVICE._serialized_end = 1575 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/source_info.proto b/opensafely/_vendor/google/api/source_info.proto deleted file mode 100644 index cbdd625c..00000000 --- a/opensafely/_vendor/google/api/source_info.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/any.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "SourceInfoProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Source information used to create a Service Config -message SourceInfo { - // All files used during config generation. - repeated google.protobuf.Any source_files = 1; -} diff --git a/opensafely/_vendor/google/api/source_info_pb2.py b/opensafely/_vendor/google/api/source_info_pb2.py deleted file mode 100644 index b19ebb82..00000000 --- a/opensafely/_vendor/google/api/source_info_pb2.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/source_info.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1cgoogle/api/source_info.proto\x12\ngoogle.api\x1a\x19google/protobuf/any.proto"8\n\nSourceInfo\x12*\n\x0csource_files\x18\x01 \x03(\x0b\x32\x14.google.protobuf.AnyBq\n\x0e\x63om.google.apiB\x0fSourceInfoProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_SOURCEINFO = DESCRIPTOR.message_types_by_name["SourceInfo"] -SourceInfo = _reflection.GeneratedProtocolMessageType( - "SourceInfo", - (_message.Message,), - { - "DESCRIPTOR": _SOURCEINFO, - "__module__": "google.api.source_info_pb2" - # @@protoc_insertion_point(class_scope:google.api.SourceInfo) - }, -) -_sym_db.RegisterMessage(SourceInfo) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\017SourceInfoProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _SOURCEINFO._serialized_start = 71 - _SOURCEINFO._serialized_end = 127 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/system_parameter.proto b/opensafely/_vendor/google/api/system_parameter.proto deleted file mode 100644 index 7d0b1d57..00000000 --- a/opensafely/_vendor/google/api/system_parameter.proto +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "SystemParameterProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// ### System parameter configuration -// -// A system parameter is a special kind of parameter defined by the API -// system, not by an individual API. It is typically mapped to an HTTP header -// and/or a URL query parameter. This configuration specifies which methods -// change the names of the system parameters. -message SystemParameters { - // Define system parameters. - // - // The parameters defined here will override the default parameters - // implemented by the system. If this field is missing from the service - // config, default system parameters will be used. Default system parameters - // and names is implementation-dependent. - // - // Example: define api key for all methods - // - // system_parameters - // rules: - // - selector: "*" - // parameters: - // - name: api_key - // url_query_parameter: api_key - // - // - // Example: define 2 api key names for a specific method. - // - // system_parameters - // rules: - // - selector: "/ListShelves" - // parameters: - // - name: api_key - // http_header: Api-Key1 - // - name: api_key - // http_header: Api-Key2 - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated SystemParameterRule rules = 1; -} - -// Define a system parameter rule mapping system parameter definitions to -// methods. -message SystemParameterRule { - // Selects the methods to which this rule applies. Use '*' to indicate all - // methods in all APIs. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Define parameters. Multiple names may be defined for a parameter. - // For a given method call, only one of them should be used. If multiple - // names are used the behavior is implementation-dependent. - // If none of the specified names are present the behavior is - // parameter-dependent. - repeated SystemParameter parameters = 2; -} - -// Define a parameter's name and location. The parameter may be passed as either -// an HTTP header or a URL query parameter, and if both are passed the behavior -// is implementation-dependent. -message SystemParameter { - // Define the name of the parameter, such as "api_key" . It is case sensitive. - string name = 1; - - // Define the HTTP header name to use for the parameter. It is case - // insensitive. - string http_header = 2; - - // Define the URL query parameter name to use for the parameter. It is case - // sensitive. - string url_query_parameter = 3; -} diff --git a/opensafely/_vendor/google/api/system_parameter_pb2.py b/opensafely/_vendor/google/api/system_parameter_pb2.py deleted file mode 100644 index c352f84c..00000000 --- a/opensafely/_vendor/google/api/system_parameter_pb2.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/system_parameter.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n!google/api/system_parameter.proto\x12\ngoogle.api"B\n\x10SystemParameters\x12.\n\x05rules\x18\x01 \x03(\x0b\x32\x1f.google.api.SystemParameterRule"X\n\x13SystemParameterRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12/\n\nparameters\x18\x02 \x03(\x0b\x32\x1b.google.api.SystemParameter"Q\n\x0fSystemParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0bhttp_header\x18\x02 \x01(\t\x12\x1b\n\x13url_query_parameter\x18\x03 \x01(\tBv\n\x0e\x63om.google.apiB\x14SystemParameterProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_SYSTEMPARAMETERS = DESCRIPTOR.message_types_by_name["SystemParameters"] -_SYSTEMPARAMETERRULE = DESCRIPTOR.message_types_by_name["SystemParameterRule"] -_SYSTEMPARAMETER = DESCRIPTOR.message_types_by_name["SystemParameter"] -SystemParameters = _reflection.GeneratedProtocolMessageType( - "SystemParameters", - (_message.Message,), - { - "DESCRIPTOR": _SYSTEMPARAMETERS, - "__module__": "google.api.system_parameter_pb2" - # @@protoc_insertion_point(class_scope:google.api.SystemParameters) - }, -) -_sym_db.RegisterMessage(SystemParameters) - -SystemParameterRule = _reflection.GeneratedProtocolMessageType( - "SystemParameterRule", - (_message.Message,), - { - "DESCRIPTOR": _SYSTEMPARAMETERRULE, - "__module__": "google.api.system_parameter_pb2" - # @@protoc_insertion_point(class_scope:google.api.SystemParameterRule) - }, -) -_sym_db.RegisterMessage(SystemParameterRule) - -SystemParameter = _reflection.GeneratedProtocolMessageType( - "SystemParameter", - (_message.Message,), - { - "DESCRIPTOR": _SYSTEMPARAMETER, - "__module__": "google.api.system_parameter_pb2" - # @@protoc_insertion_point(class_scope:google.api.SystemParameter) - }, -) -_sym_db.RegisterMessage(SystemParameter) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\024SystemParameterProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _SYSTEMPARAMETERS._serialized_start = 49 - _SYSTEMPARAMETERS._serialized_end = 115 - _SYSTEMPARAMETERRULE._serialized_start = 117 - _SYSTEMPARAMETERRULE._serialized_end = 205 - _SYSTEMPARAMETER._serialized_start = 207 - _SYSTEMPARAMETER._serialized_end = 288 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/usage.proto b/opensafely/_vendor/google/api/usage.proto deleted file mode 100644 index ad2764c9..00000000 --- a/opensafely/_vendor/google/api/usage.proto +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2015 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "UsageProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Configuration controlling usage of a service. -message Usage { - // Requirements that must be satisfied before a consumer project can use the - // service. Each requirement is of the form /; - // for example 'serviceusage.googleapis.com/billing-enabled'. - // - // For Google APIs, a Terms of Service requirement must be included here. - // Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud". - // Other Google APIs should include - // "serviceusage.googleapis.com/tos/universal". Additional ToS can be - // included based on the business needs. - repeated string requirements = 1; - - // A list of usage rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated UsageRule rules = 6; - - // The full resource name of a channel used for sending notifications to the - // service producer. - // - // Google Service Management currently only supports - // [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification - // channel. To use Google Cloud Pub/Sub as the channel, this must be the name - // of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format - // documented in https://cloud.google.com/pubsub/docs/overview. - string producer_notification_channel = 7; -} - -// Usage configuration rules for the service. -// -// NOTE: Under development. -// -// -// Use this rule to configure unregistered calls for the service. Unregistered -// calls are calls that do not contain consumer project identity. -// (Example: calls that do not contain an API key). -// By default, API methods do not allow unregistered calls, and each method call -// must be identified by a consumer project identity. Use this rule to -// allow/disallow unregistered calls. -// -// Example of an API that wants to allow unregistered calls for entire service. -// -// usage: -// rules: -// - selector: "*" -// allow_unregistered_calls: true -// -// Example of a method that wants to allow unregistered calls. -// -// usage: -// rules: -// - selector: "google.example.library.v1.LibraryService.CreateBook" -// allow_unregistered_calls: true -message UsageRule { - // Selects the methods to which this rule applies. Use '*' to indicate all - // methods in all APIs. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // If true, the selected method allows unregistered calls, e.g. calls - // that don't identify any user or application. - bool allow_unregistered_calls = 2; - - // If true, the selected method should skip service control and the control - // plane features, such as quota and billing, will not be available. - // This flag is used by Google Cloud Endpoints to bypass checks for internal - // methods, such as service health check methods. - bool skip_service_control = 3; -} diff --git a/opensafely/_vendor/google/api/usage_pb2.py b/opensafely/_vendor/google/api/usage_pb2.py deleted file mode 100644 index a985f97e..00000000 --- a/opensafely/_vendor/google/api/usage_pb2.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/usage.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x16google/api/usage.proto\x12\ngoogle.api"j\n\x05Usage\x12\x14\n\x0crequirements\x18\x01 \x03(\t\x12$\n\x05rules\x18\x06 \x03(\x0b\x32\x15.google.api.UsageRule\x12%\n\x1dproducer_notification_channel\x18\x07 \x01(\t"]\n\tUsageRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12 \n\x18\x61llow_unregistered_calls\x18\x02 \x01(\x08\x12\x1c\n\x14skip_service_control\x18\x03 \x01(\x08\x42l\n\x0e\x63om.google.apiB\nUsageProtoP\x01ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\xa2\x02\x04GAPIb\x06proto3' -) - - -_USAGE = DESCRIPTOR.message_types_by_name["Usage"] -_USAGERULE = DESCRIPTOR.message_types_by_name["UsageRule"] -Usage = _reflection.GeneratedProtocolMessageType( - "Usage", - (_message.Message,), - { - "DESCRIPTOR": _USAGE, - "__module__": "google.api.usage_pb2" - # @@protoc_insertion_point(class_scope:google.api.Usage) - }, -) -_sym_db.RegisterMessage(Usage) - -UsageRule = _reflection.GeneratedProtocolMessageType( - "UsageRule", - (_message.Message,), - { - "DESCRIPTOR": _USAGERULE, - "__module__": "google.api.usage_pb2" - # @@protoc_insertion_point(class_scope:google.api.UsageRule) - }, -) -_sym_db.RegisterMessage(UsageRule) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\nUsageProtoP\001ZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig\242\002\004GAPI" - _USAGE._serialized_start = 38 - _USAGE._serialized_end = 144 - _USAGERULE._serialized_start = 146 - _USAGERULE._serialized_end = 239 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/api/visibility.proto b/opensafely/_vendor/google/api/visibility.proto deleted file mode 100644 index bde48dd2..00000000 --- a/opensafely/_vendor/google/api/visibility.proto +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/descriptor.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/visibility;visibility"; -option java_multiple_files = true; -option java_outer_classname = "VisibilityProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.EnumOptions { - // See `VisibilityRule`. - google.api.VisibilityRule enum_visibility = 72295727; -} - -extend google.protobuf.EnumValueOptions { - // See `VisibilityRule`. - google.api.VisibilityRule value_visibility = 72295727; -} - -extend google.protobuf.FieldOptions { - // See `VisibilityRule`. - google.api.VisibilityRule field_visibility = 72295727; -} - -extend google.protobuf.MessageOptions { - // See `VisibilityRule`. - google.api.VisibilityRule message_visibility = 72295727; -} - -extend google.protobuf.MethodOptions { - // See `VisibilityRule`. - google.api.VisibilityRule method_visibility = 72295727; -} - -extend google.protobuf.ServiceOptions { - // See `VisibilityRule`. - google.api.VisibilityRule api_visibility = 72295727; -} - -// `Visibility` defines restrictions for the visibility of service -// elements. Restrictions are specified using visibility labels -// (e.g., PREVIEW) that are elsewhere linked to users and projects. -// -// Users and projects can have access to more than one visibility label. The -// effective visibility for multiple labels is the union of each label's -// elements, plus any unrestricted elements. -// -// If an element and its parents have no restrictions, visibility is -// unconditionally granted. -// -// Example: -// -// visibility: -// rules: -// - selector: google.calendar.Calendar.EnhancedSearch -// restriction: PREVIEW -// - selector: google.calendar.Calendar.Delegate -// restriction: INTERNAL -// -// Here, all methods are publicly visible except for the restricted methods -// EnhancedSearch and Delegate. -message Visibility { - // A list of visibility rules that apply to individual API elements. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated VisibilityRule rules = 1; -} - -// A visibility rule provides visibility configuration for an individual API -// element. -message VisibilityRule { - // Selects methods, messages, fields, enums, etc. to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // A comma-separated list of visibility labels that apply to the `selector`. - // Any of the listed labels can be used to grant the visibility. - // - // If a rule has multiple labels, removing one of the labels but not all of - // them can break clients. - // - // Example: - // - // visibility: - // rules: - // - selector: google.calendar.Calendar.EnhancedSearch - // restriction: INTERNAL, PREVIEW - // - // Removing INTERNAL from this restriction will break clients that rely on - // this method and only had access to it through INTERNAL. - string restriction = 2; -} diff --git a/opensafely/_vendor/google/api/visibility_pb2.py b/opensafely/_vendor/google/api/visibility_pb2.py deleted file mode 100644 index f5b2bc16..00000000 --- a/opensafely/_vendor/google/api/visibility_pb2.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/api/visibility.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1bgoogle/api/visibility.proto\x12\ngoogle.api\x1a google/protobuf/descriptor.proto"7\n\nVisibility\x12)\n\x05rules\x18\x01 \x03(\x0b\x32\x1a.google.api.VisibilityRule"7\n\x0eVisibilityRule\x12\x10\n\x08selector\x18\x01 \x01(\t\x12\x13\n\x0brestriction\x18\x02 \x01(\t:T\n\x0f\x65num_visibility\x12\x1c.google.protobuf.EnumOptions\x18\xaf\xca\xbc" \x01(\x0b\x32\x1a.google.api.VisibilityRule:Z\n\x10value_visibility\x12!.google.protobuf.EnumValueOptions\x18\xaf\xca\xbc" \x01(\x0b\x32\x1a.google.api.VisibilityRule:V\n\x10\x66ield_visibility\x12\x1d.google.protobuf.FieldOptions\x18\xaf\xca\xbc" \x01(\x0b\x32\x1a.google.api.VisibilityRule:Z\n\x12message_visibility\x12\x1f.google.protobuf.MessageOptions\x18\xaf\xca\xbc" \x01(\x0b\x32\x1a.google.api.VisibilityRule:X\n\x11method_visibility\x12\x1e.google.protobuf.MethodOptions\x18\xaf\xca\xbc" \x01(\x0b\x32\x1a.google.api.VisibilityRule:V\n\x0e\x61pi_visibility\x12\x1f.google.protobuf.ServiceOptions\x18\xaf\xca\xbc" \x01(\x0b\x32\x1a.google.api.VisibilityRuleBn\n\x0e\x63om.google.apiB\x0fVisibilityProtoP\x01Z?google.golang.org/genproto/googleapis/api/visibility;visibility\xf8\x01\x01\xa2\x02\x04GAPIb\x06proto3' -) - - -ENUM_VISIBILITY_FIELD_NUMBER = 72295727 -enum_visibility = DESCRIPTOR.extensions_by_name["enum_visibility"] -VALUE_VISIBILITY_FIELD_NUMBER = 72295727 -value_visibility = DESCRIPTOR.extensions_by_name["value_visibility"] -FIELD_VISIBILITY_FIELD_NUMBER = 72295727 -field_visibility = DESCRIPTOR.extensions_by_name["field_visibility"] -MESSAGE_VISIBILITY_FIELD_NUMBER = 72295727 -message_visibility = DESCRIPTOR.extensions_by_name["message_visibility"] -METHOD_VISIBILITY_FIELD_NUMBER = 72295727 -method_visibility = DESCRIPTOR.extensions_by_name["method_visibility"] -API_VISIBILITY_FIELD_NUMBER = 72295727 -api_visibility = DESCRIPTOR.extensions_by_name["api_visibility"] - -_VISIBILITY = DESCRIPTOR.message_types_by_name["Visibility"] -_VISIBILITYRULE = DESCRIPTOR.message_types_by_name["VisibilityRule"] -Visibility = _reflection.GeneratedProtocolMessageType( - "Visibility", - (_message.Message,), - { - "DESCRIPTOR": _VISIBILITY, - "__module__": "google.api.visibility_pb2" - # @@protoc_insertion_point(class_scope:google.api.Visibility) - }, -) -_sym_db.RegisterMessage(Visibility) - -VisibilityRule = _reflection.GeneratedProtocolMessageType( - "VisibilityRule", - (_message.Message,), - { - "DESCRIPTOR": _VISIBILITYRULE, - "__module__": "google.api.visibility_pb2" - # @@protoc_insertion_point(class_scope:google.api.VisibilityRule) - }, -) -_sym_db.RegisterMessage(VisibilityRule) - -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.EnumOptions.RegisterExtension( - enum_visibility - ) - google_dot_protobuf_dot_descriptor__pb2.EnumValueOptions.RegisterExtension( - value_visibility - ) - google_dot_protobuf_dot_descriptor__pb2.FieldOptions.RegisterExtension( - field_visibility - ) - google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension( - message_visibility - ) - google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension( - method_visibility - ) - google_dot_protobuf_dot_descriptor__pb2.ServiceOptions.RegisterExtension( - api_visibility - ) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.apiB\017VisibilityProtoP\001Z?google.golang.org/genproto/googleapis/api/visibility;visibility\370\001\001\242\002\004GAPI" - _VISIBILITY._serialized_start = 77 - _VISIBILITY._serialized_end = 132 - _VISIBILITYRULE._serialized_start = 134 - _VISIBILITYRULE._serialized_end = 189 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/cloud/extended_operations.proto b/opensafely/_vendor/google/cloud/extended_operations.proto deleted file mode 100644 index 1477d2d6..00000000 --- a/opensafely/_vendor/google/cloud/extended_operations.proto +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2021 Google LLC. -// -// 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. - -// This file contains custom annotations that are used by GAPIC generators to -// handle Long Running Operation methods (LRO) that are NOT compliant with -// https://google.aip.dev/151. These annotations are public for technical -// reasons only. Please DO NOT USE them in your protos. -syntax = "proto3"; - -package google.cloud; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/extendedops;extendedops"; -option java_multiple_files = true; -option java_outer_classname = "ExtendedOperationsProto"; -option java_package = "com.google.cloud"; -option objc_class_prefix = "GAPI"; - -// FieldOptions to match corresponding fields in the initial request, -// polling request and operation response messages. -// -// Example: -// -// In an API-specific operation message: -// -// message MyOperation { -// string http_error_message = 1 [(operation_field) = ERROR_MESSAGE]; -// int32 http_error_status_code = 2 [(operation_field) = ERROR_CODE]; -// string id = 3 [(operation_field) = NAME]; -// Status status = 4 [(operation_field) = STATUS]; -// } -// -// In a polling request message (the one which is used to poll for an LRO -// status): -// -// message MyPollingRequest { -// string operation = 1 [(operation_response_field) = "id"]; -// string project = 2; -// string region = 3; -// } -// -// In an initial request message (the one which starts an LRO): -// -// message MyInitialRequest { -// string my_project = 2 [(operation_request_field) = "project"]; -// string my_region = 3 [(operation_request_field) = "region"]; -// } -// -extend google.protobuf.FieldOptions { - // A field annotation that maps fields in an API-specific Operation object to - // their standard counterparts in google.longrunning.Operation. See - // OperationResponseMapping enum definition. - OperationResponseMapping operation_field = 1149; - - // A field annotation that maps fields in the initial request message - // (the one which started the LRO) to their counterparts in the polling - // request message. For non-standard LRO, the polling response may be missing - // some of the information needed to make a subsequent polling request. The - // missing information (for example, project or region ID) is contained in the - // fields of the initial request message that this annotation must be applied - // to. The string value of the annotation corresponds to the name of the - // counterpart field in the polling request message that the annotated field's - // value will be copied to. - string operation_request_field = 1150; - - // A field annotation that maps fields in the polling request message to their - // counterparts in the initial and/or polling response message. The initial - // and the polling methods return an API-specific Operation object. Some of - // the fields from that response object must be reused in the subsequent - // request (like operation name/ID) to fully identify the polled operation. - // This annotation must be applied to the fields in the polling request - // message, the string value of the annotation must correspond to the name of - // the counterpart field in the Operation response object whose value will be - // copied to the annotated field. - string operation_response_field = 1151; -} - -// MethodOptions to identify the actual service and method used for operation -// status polling. -// -// Example: -// -// In a method, which starts an LRO: -// -// service MyService { -// rpc Foo(MyInitialRequest) returns (MyOperation) { -// option (operation_service) = "MyPollingService"; -// } -// } -// -// In a polling method: -// -// service MyPollingService { -// rpc Get(MyPollingRequest) returns (MyOperation) { -// option (operation_polling_method) = true; -// } -// } -extend google.protobuf.MethodOptions { - // A method annotation that maps an LRO method (the one which starts an LRO) - // to the service, which will be used to poll for the operation status. The - // annotation must be applied to the method which starts an LRO, the string - // value of the annotation must correspond to the name of the service used to - // poll for the operation status. - string operation_service = 1249; - - // A method annotation that marks methods that can be used for polling - // operation status (e.g. the MyPollingService.Get(MyPollingRequest) method). - bool operation_polling_method = 1250; -} - -// An enum to be used to mark the essential (for polling) fields in an -// API-specific Operation object. A custom Operation object may contain many -// different fields, but only few of them are essential to conduct a successful -// polling process. -enum OperationResponseMapping { - // Do not use. - UNDEFINED = 0; - - // A field in an API-specific (custom) Operation object which carries the same - // meaning as google.longrunning.Operation.name. - NAME = 1; - - // A field in an API-specific (custom) Operation object which carries the same - // meaning as google.longrunning.Operation.done. If the annotated field is of - // an enum type, `annotated_field_name == EnumType.DONE` semantics should be - // equivalent to `Operation.done == true`. If the annotated field is of type - // boolean, then it should follow the same semantics as Operation.done. - // Otherwise, a non-empty value should be treated as `Operation.done == true`. - STATUS = 2; - - // A field in an API-specific (custom) Operation object which carries the same - // meaning as google.longrunning.Operation.error.code. - ERROR_CODE = 3; - - // A field in an API-specific (custom) Operation object which carries the same - // meaning as google.longrunning.Operation.error.message. - ERROR_MESSAGE = 4; -} \ No newline at end of file diff --git a/opensafely/_vendor/google/cloud/extended_operations_pb2.py b/opensafely/_vendor/google/cloud/extended_operations_pb2.py deleted file mode 100644 index 0a910cfb..00000000 --- a/opensafely/_vendor/google/cloud/extended_operations_pb2.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/extended_operations.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n&google/cloud/extended_operations.proto\x12\x0cgoogle.cloud\x1a google/protobuf/descriptor.proto*b\n\x18OperationResponseMapping\x12\r\n\tUNDEFINED\x10\x00\x12\x08\n\x04NAME\x10\x01\x12\n\n\x06STATUS\x10\x02\x12\x0e\n\nERROR_CODE\x10\x03\x12\x11\n\rERROR_MESSAGE\x10\x04:_\n\x0foperation_field\x12\x1d.google.protobuf.FieldOptions\x18\xfd\x08 \x01(\x0e\x32&.google.cloud.OperationResponseMapping:?\n\x17operation_request_field\x12\x1d.google.protobuf.FieldOptions\x18\xfe\x08 \x01(\t:@\n\x18operation_response_field\x12\x1d.google.protobuf.FieldOptions\x18\xff\x08 \x01(\t::\n\x11operation_service\x12\x1e.google.protobuf.MethodOptions\x18\xe1\t \x01(\t:A\n\x18operation_polling_method\x12\x1e.google.protobuf.MethodOptions\x18\xe2\t \x01(\x08\x42y\n\x10\x63om.google.cloudB\x17\x45xtendedOperationsProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/extendedops;extendedops\xa2\x02\x04GAPIb\x06proto3" -) - -_OPERATIONRESPONSEMAPPING = DESCRIPTOR.enum_types_by_name["OperationResponseMapping"] -OperationResponseMapping = enum_type_wrapper.EnumTypeWrapper(_OPERATIONRESPONSEMAPPING) -UNDEFINED = 0 -NAME = 1 -STATUS = 2 -ERROR_CODE = 3 -ERROR_MESSAGE = 4 - -OPERATION_FIELD_FIELD_NUMBER = 1149 -operation_field = DESCRIPTOR.extensions_by_name["operation_field"] -OPERATION_REQUEST_FIELD_FIELD_NUMBER = 1150 -operation_request_field = DESCRIPTOR.extensions_by_name["operation_request_field"] -OPERATION_RESPONSE_FIELD_FIELD_NUMBER = 1151 -operation_response_field = DESCRIPTOR.extensions_by_name["operation_response_field"] -OPERATION_SERVICE_FIELD_NUMBER = 1249 -operation_service = DESCRIPTOR.extensions_by_name["operation_service"] -OPERATION_POLLING_METHOD_FIELD_NUMBER = 1250 -operation_polling_method = DESCRIPTOR.extensions_by_name["operation_polling_method"] - -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.FieldOptions.RegisterExtension( - operation_field - ) - google_dot_protobuf_dot_descriptor__pb2.FieldOptions.RegisterExtension( - operation_request_field - ) - google_dot_protobuf_dot_descriptor__pb2.FieldOptions.RegisterExtension( - operation_response_field - ) - google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension( - operation_service - ) - google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension( - operation_polling_method - ) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\020com.google.cloudB\027ExtendedOperationsProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/extendedops;extendedops\242\002\004GAPI" - _OPERATIONRESPONSEMAPPING._serialized_start = 90 - _OPERATIONRESPONSEMAPPING._serialized_end = 188 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/cloud/location/locations.proto b/opensafely/_vendor/google/cloud/location/locations.proto deleted file mode 100644 index a91766c9..00000000 --- a/opensafely/_vendor/google/cloud/location/locations.proto +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2020 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.cloud.location; - -import "google/api/annotations.proto"; -import "google/protobuf/any.proto"; -import "google/api/client.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/location;location"; -option java_multiple_files = true; -option java_outer_classname = "LocationsProto"; -option java_package = "com.google.cloud.location"; - -// An abstract interface that provides location-related information for -// a service. Service-specific metadata is provided through the -// [Location.metadata][google.cloud.location.Location.metadata] field. -service Locations { - option (google.api.default_host) = "cloud.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists information about the supported locations for this service. - rpc ListLocations(ListLocationsRequest) returns (ListLocationsResponse) { - option (google.api.http) = { - get: "/v1/{name=locations}" - additional_bindings { - get: "/v1/{name=projects/*}/locations" - } - }; - } - - // Gets information about a location. - rpc GetLocation(GetLocationRequest) returns (Location) { - option (google.api.http) = { - get: "/v1/{name=locations/*}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*}" - } - }; - } -} - -// The request message for [Locations.ListLocations][google.cloud.location.Locations.ListLocations]. -message ListLocationsRequest { - // The resource that owns the locations collection, if applicable. - string name = 1; - - // The standard list filter. - string filter = 2; - - // The standard list page size. - int32 page_size = 3; - - // The standard list page token. - string page_token = 4; -} - -// The response message for [Locations.ListLocations][google.cloud.location.Locations.ListLocations]. -message ListLocationsResponse { - // A list of locations that matches the specified filter in the request. - repeated Location locations = 1; - - // The standard List next-page token. - string next_page_token = 2; -} - -// The request message for [Locations.GetLocation][google.cloud.location.Locations.GetLocation]. -message GetLocationRequest { - // Resource name for the location. - string name = 1; -} - -// A resource that represents Google Cloud Platform location. -message Location { - // Resource name for the location, which may vary between implementations. - // For example: `"projects/example-project/locations/us-east1"` - string name = 1; - - // The canonical id for this location. For example: `"us-east1"`. - string location_id = 4; - - // The friendly name for this location, typically a nearby city name. - // For example, "Tokyo". - string display_name = 5; - - // Cross-service attributes for the location. For example - // - // {"cloud.googleapis.com/region": "us-east1"} - map labels = 2; - - // Service-specific metadata. For example the available capacity at the given - // location. - google.protobuf.Any metadata = 3; -} diff --git a/opensafely/_vendor/google/cloud/location/locations_pb2.py b/opensafely/_vendor/google/cloud/location/locations_pb2.py deleted file mode 100644 index 48ab0ccf..00000000 --- a/opensafely/_vendor/google/cloud/location/locations_pb2.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/location/locations.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from opensafely._vendor.google.api import client_pb2 as google_dot_api_dot_client__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n%google/cloud/location/locations.proto\x12\x15google.cloud.location\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/protobuf/any.proto\x1a\x17google/api/client.proto"[\n\x14ListLocationsRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"d\n\x15ListLocationsResponse\x12\x32\n\tlocations\x18\x01 \x03(\x0b\x32\x1f.google.cloud.location.Location\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t""\n\x12GetLocationRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\xd7\x01\n\x08Location\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0blocation_id\x18\x04 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x05 \x01(\t\x12;\n\x06labels\x18\x02 \x03(\x0b\x32+.google.cloud.location.Location.LabelsEntry\x12&\n\x08metadata\x18\x03 \x01(\x0b\x32\x14.google.protobuf.Any\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x32\xa4\x03\n\tLocations\x12\xab\x01\n\rListLocations\x12+.google.cloud.location.ListLocationsRequest\x1a,.google.cloud.location.ListLocationsResponse"?\x82\xd3\xe4\x93\x02\x39\x12\x14/v1/{name=locations}Z!\x12\x1f/v1/{name=projects/*}/locations\x12\x9e\x01\n\x0bGetLocation\x12).google.cloud.location.GetLocationRequest\x1a\x1f.google.cloud.location.Location"C\x82\xd3\xe4\x93\x02=\x12\x16/v1/{name=locations/*}Z#\x12!/v1/{name=projects/*/locations/*}\x1aH\xca\x41\x14\x63loud.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformBo\n\x19\x63om.google.cloud.locationB\x0eLocationsProtoP\x01Z=google.golang.org/genproto/googleapis/cloud/location;location\xf8\x01\x01\x62\x06proto3' -) - - -_LISTLOCATIONSREQUEST = DESCRIPTOR.message_types_by_name["ListLocationsRequest"] -_LISTLOCATIONSRESPONSE = DESCRIPTOR.message_types_by_name["ListLocationsResponse"] -_GETLOCATIONREQUEST = DESCRIPTOR.message_types_by_name["GetLocationRequest"] -_LOCATION = DESCRIPTOR.message_types_by_name["Location"] -_LOCATION_LABELSENTRY = _LOCATION.nested_types_by_name["LabelsEntry"] -ListLocationsRequest = _reflection.GeneratedProtocolMessageType( - "ListLocationsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTLOCATIONSREQUEST, - "__module__": "google.cloud.location.locations_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.location.ListLocationsRequest) - }, -) -_sym_db.RegisterMessage(ListLocationsRequest) - -ListLocationsResponse = _reflection.GeneratedProtocolMessageType( - "ListLocationsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTLOCATIONSRESPONSE, - "__module__": "google.cloud.location.locations_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.location.ListLocationsResponse) - }, -) -_sym_db.RegisterMessage(ListLocationsResponse) - -GetLocationRequest = _reflection.GeneratedProtocolMessageType( - "GetLocationRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETLOCATIONREQUEST, - "__module__": "google.cloud.location.locations_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.location.GetLocationRequest) - }, -) -_sym_db.RegisterMessage(GetLocationRequest) - -Location = _reflection.GeneratedProtocolMessageType( - "Location", - (_message.Message,), - { - "LabelsEntry": _reflection.GeneratedProtocolMessageType( - "LabelsEntry", - (_message.Message,), - { - "DESCRIPTOR": _LOCATION_LABELSENTRY, - "__module__": "google.cloud.location.locations_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.location.Location.LabelsEntry) - }, - ), - "DESCRIPTOR": _LOCATION, - "__module__": "google.cloud.location.locations_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.location.Location) - }, -) -_sym_db.RegisterMessage(Location) -_sym_db.RegisterMessage(Location.LabelsEntry) - -_LOCATIONS = DESCRIPTOR.services_by_name["Locations"] -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\031com.google.cloud.locationB\016LocationsProtoP\001Z=google.golang.org/genproto/googleapis/cloud/location;location\370\001\001" - _LOCATION_LABELSENTRY._options = None - _LOCATION_LABELSENTRY._serialized_options = b"8\001" - _LOCATIONS._options = None - _LOCATIONS._serialized_options = b"\312A\024cloud.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" - _LOCATIONS.methods_by_name["ListLocations"]._options = None - _LOCATIONS.methods_by_name[ - "ListLocations" - ]._serialized_options = b"\202\323\344\223\0029\022\024/v1/{name=locations}Z!\022\037/v1/{name=projects/*}/locations" - _LOCATIONS.methods_by_name["GetLocation"]._options = None - _LOCATIONS.methods_by_name[ - "GetLocation" - ]._serialized_options = b"\202\323\344\223\002=\022\026/v1/{name=locations/*}Z#\022!/v1/{name=projects/*/locations/*}" - _LISTLOCATIONSREQUEST._serialized_start = 146 - _LISTLOCATIONSREQUEST._serialized_end = 237 - _LISTLOCATIONSRESPONSE._serialized_start = 239 - _LISTLOCATIONSRESPONSE._serialized_end = 339 - _GETLOCATIONREQUEST._serialized_start = 341 - _GETLOCATIONREQUEST._serialized_end = 375 - _LOCATION._serialized_start = 378 - _LOCATION._serialized_end = 593 - _LOCATION_LABELSENTRY._serialized_start = 548 - _LOCATION_LABELSENTRY._serialized_end = 593 - _LOCATIONS._serialized_start = 596 - _LOCATIONS._serialized_end = 1016 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/gapic/metadata/__init__.py b/opensafely/_vendor/google/gapic/metadata/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/gapic/metadata/gapic_metadata.proto b/opensafely/_vendor/google/gapic/metadata/gapic_metadata.proto deleted file mode 100644 index 16090ede..00000000 --- a/opensafely/_vendor/google/gapic/metadata/gapic_metadata.proto +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2020 Google LLC. -// -// 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. -// - -syntax = "proto3"; - -package google.gapic.metadata; - -option csharp_namespace = "Google.Gapic.Metadata"; -option go_package = "google.golang.org/genproto/googleapis/gapic/metadata;metadata"; -option java_multiple_files = true; -option java_outer_classname = "GapicMetadataProto"; -option java_package = "com.google.gapic.metadata"; -option php_namespace = "Google\\Gapic\\Metadata"; -option ruby_package = "Google::Gapic::Metadata"; - -// Metadata about a GAPIC library for a specific combination of API, version, and -// computer language. -message GapicMetadata { - // Schema version of this proto. Current value: 1.0 - string schema = 1; - - // Any human-readable comments to be included in this file. - string comment = 2; - - // Computer language of this generated language. This must be - // spelled out as it spoken in English, with no capitalization or - // separators (e.g. "csharp", "nodejs"). - string language = 3; - - // The proto package containing the API definition for which this - // GAPIC library was generated. - string proto_package = 4; - - // The language-specific library package for this GAPIC library. - string library_package = 5; - - // A map from each proto-defined service to ServiceForTransports, - // which allows listing information about transport-specific - // implementations of the service. - // - // The key is the name of the service as it appears in the .proto - // file. - map services = 6; - - // A map from a transport name to ServiceAsClient, which allows - // listing information about the client objects that implement the - // parent RPC service for the specified transport. - // - // The key name is the transport, lower-cased with no separators - // (e.g. "grpc", "rest"). - message ServiceForTransport { - map clients = 1; - } - - // Information about a specific client implementing a proto-defined service. - message ServiceAsClient { - // The name of the library client formatted as it appears in the source code - string library_client = 1; - - // A mapping from each proto-defined RPC name to the the list of - // methods in library_client that implement it. There can be more - // than one library_client method for each RPC. RPCs with no - // library_client methods need not be included. - // - // The key name is the name of the RPC as defined and formated in - // the proto file. - map rpcs = 2; - } - - // List of GAPIC client methods implementing the proto-defined RPC - // for the transport and service specified in the containing - // structures. - message MethodList { - // List of methods for a specific proto-service client in the - // GAPIC. These names should be formatted as they appear in the - // source code. - repeated string methods = 1; - } - -} diff --git a/opensafely/_vendor/google/gapic/metadata/gapic_metadata_pb2.py b/opensafely/_vendor/google/gapic/metadata/gapic_metadata_pb2.py deleted file mode 100644 index 285c1140..00000000 --- a/opensafely/_vendor/google/gapic/metadata/gapic_metadata_pb2.py +++ /dev/null @@ -1,144 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/gapic/metadata/gapic_metadata.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n*google/gapic/metadata/gapic_metadata.proto\x12\x15google.gapic.metadata"\xf0\x05\n\rGapicMetadata\x12\x0e\n\x06schema\x18\x01 \x01(\t\x12\x0f\n\x07\x63omment\x18\x02 \x01(\t\x12\x10\n\x08language\x18\x03 \x01(\t\x12\x15\n\rproto_package\x18\x04 \x01(\t\x12\x17\n\x0flibrary_package\x18\x05 \x01(\t\x12\x44\n\x08services\x18\x06 \x03(\x0b\x32\x32.google.gapic.metadata.GapicMetadata.ServicesEntry\x1ai\n\rServicesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.gapic.metadata.GapicMetadata.ServiceForTransport:\x02\x38\x01\x1a\xd3\x01\n\x13ServiceForTransport\x12V\n\x07\x63lients\x18\x01 \x03(\x0b\x32\x45.google.gapic.metadata.GapicMetadata.ServiceForTransport.ClientsEntry\x1a\x64\n\x0c\x43lientsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x43\n\x05value\x18\x02 \x01(\x0b\x32\x34.google.gapic.metadata.GapicMetadata.ServiceAsClient:\x02\x38\x01\x1a\xd5\x01\n\x0fServiceAsClient\x12\x16\n\x0elibrary_client\x18\x01 \x01(\t\x12L\n\x04rpcs\x18\x02 \x03(\x0b\x32>.google.gapic.metadata.GapicMetadata.ServiceAsClient.RpcsEntry\x1a\\\n\tRpcsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.google.gapic.metadata.GapicMetadata.MethodList:\x02\x38\x01\x1a\x1d\n\nMethodList\x12\x0f\n\x07methods\x18\x01 \x03(\tB\xba\x01\n\x19\x63om.google.gapic.metadataB\x12GapicMetadataProtoP\x01Z=google.golang.org/genproto/googleapis/gapic/metadata;metadata\xaa\x02\x15Google.Gapic.Metadata\xca\x02\x15Google\\Gapic\\Metadata\xea\x02\x17Google::Gapic::Metadatab\x06proto3' -) - - -_GAPICMETADATA = DESCRIPTOR.message_types_by_name["GapicMetadata"] -_GAPICMETADATA_SERVICESENTRY = _GAPICMETADATA.nested_types_by_name["ServicesEntry"] -_GAPICMETADATA_SERVICEFORTRANSPORT = _GAPICMETADATA.nested_types_by_name[ - "ServiceForTransport" -] -_GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY = ( - _GAPICMETADATA_SERVICEFORTRANSPORT.nested_types_by_name["ClientsEntry"] -) -_GAPICMETADATA_SERVICEASCLIENT = _GAPICMETADATA.nested_types_by_name["ServiceAsClient"] -_GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY = ( - _GAPICMETADATA_SERVICEASCLIENT.nested_types_by_name["RpcsEntry"] -) -_GAPICMETADATA_METHODLIST = _GAPICMETADATA.nested_types_by_name["MethodList"] -GapicMetadata = _reflection.GeneratedProtocolMessageType( - "GapicMetadata", - (_message.Message,), - { - "ServicesEntry": _reflection.GeneratedProtocolMessageType( - "ServicesEntry", - (_message.Message,), - { - "DESCRIPTOR": _GAPICMETADATA_SERVICESENTRY, - "__module__": "google.gapic.metadata.gapic_metadata_pb2" - # @@protoc_insertion_point(class_scope:google.gapic.metadata.GapicMetadata.ServicesEntry) - }, - ), - "ServiceForTransport": _reflection.GeneratedProtocolMessageType( - "ServiceForTransport", - (_message.Message,), - { - "ClientsEntry": _reflection.GeneratedProtocolMessageType( - "ClientsEntry", - (_message.Message,), - { - "DESCRIPTOR": _GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY, - "__module__": "google.gapic.metadata.gapic_metadata_pb2" - # @@protoc_insertion_point(class_scope:google.gapic.metadata.GapicMetadata.ServiceForTransport.ClientsEntry) - }, - ), - "DESCRIPTOR": _GAPICMETADATA_SERVICEFORTRANSPORT, - "__module__": "google.gapic.metadata.gapic_metadata_pb2" - # @@protoc_insertion_point(class_scope:google.gapic.metadata.GapicMetadata.ServiceForTransport) - }, - ), - "ServiceAsClient": _reflection.GeneratedProtocolMessageType( - "ServiceAsClient", - (_message.Message,), - { - "RpcsEntry": _reflection.GeneratedProtocolMessageType( - "RpcsEntry", - (_message.Message,), - { - "DESCRIPTOR": _GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY, - "__module__": "google.gapic.metadata.gapic_metadata_pb2" - # @@protoc_insertion_point(class_scope:google.gapic.metadata.GapicMetadata.ServiceAsClient.RpcsEntry) - }, - ), - "DESCRIPTOR": _GAPICMETADATA_SERVICEASCLIENT, - "__module__": "google.gapic.metadata.gapic_metadata_pb2" - # @@protoc_insertion_point(class_scope:google.gapic.metadata.GapicMetadata.ServiceAsClient) - }, - ), - "MethodList": _reflection.GeneratedProtocolMessageType( - "MethodList", - (_message.Message,), - { - "DESCRIPTOR": _GAPICMETADATA_METHODLIST, - "__module__": "google.gapic.metadata.gapic_metadata_pb2" - # @@protoc_insertion_point(class_scope:google.gapic.metadata.GapicMetadata.MethodList) - }, - ), - "DESCRIPTOR": _GAPICMETADATA, - "__module__": "google.gapic.metadata.gapic_metadata_pb2" - # @@protoc_insertion_point(class_scope:google.gapic.metadata.GapicMetadata) - }, -) -_sym_db.RegisterMessage(GapicMetadata) -_sym_db.RegisterMessage(GapicMetadata.ServicesEntry) -_sym_db.RegisterMessage(GapicMetadata.ServiceForTransport) -_sym_db.RegisterMessage(GapicMetadata.ServiceForTransport.ClientsEntry) -_sym_db.RegisterMessage(GapicMetadata.ServiceAsClient) -_sym_db.RegisterMessage(GapicMetadata.ServiceAsClient.RpcsEntry) -_sym_db.RegisterMessage(GapicMetadata.MethodList) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\031com.google.gapic.metadataB\022GapicMetadataProtoP\001Z=google.golang.org/genproto/googleapis/gapic/metadata;metadata\252\002\025Google.Gapic.Metadata\312\002\025Google\\Gapic\\Metadata\352\002\027Google::Gapic::Metadata" - _GAPICMETADATA_SERVICESENTRY._options = None - _GAPICMETADATA_SERVICESENTRY._serialized_options = b"8\001" - _GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY._options = None - _GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY._serialized_options = b"8\001" - _GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY._options = None - _GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY._serialized_options = b"8\001" - _GAPICMETADATA._serialized_start = 70 - _GAPICMETADATA._serialized_end = 822 - _GAPICMETADATA_SERVICESENTRY._serialized_start = 256 - _GAPICMETADATA_SERVICESENTRY._serialized_end = 361 - _GAPICMETADATA_SERVICEFORTRANSPORT._serialized_start = 364 - _GAPICMETADATA_SERVICEFORTRANSPORT._serialized_end = 575 - _GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY._serialized_start = 475 - _GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY._serialized_end = 575 - _GAPICMETADATA_SERVICEASCLIENT._serialized_start = 578 - _GAPICMETADATA_SERVICEASCLIENT._serialized_end = 791 - _GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY._serialized_start = 699 - _GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY._serialized_end = 791 - _GAPICMETADATA_METHODLIST._serialized_start = 793 - _GAPICMETADATA_METHODLIST._serialized_end = 822 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/logging/type/__init__.py b/opensafely/_vendor/google/logging/type/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/logging/type/http_request.proto b/opensafely/_vendor/google/logging/type/http_request.proto deleted file mode 100644 index b878d60d..00000000 --- a/opensafely/_vendor/google/logging/type/http_request.proto +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.logging.type; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "HttpRequestProto"; -option java_package = "com.google.logging.type"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// A common proto for logging HTTP requests. Only contains semantics -// defined by the HTTP specification. Product-specific logging -// information MUST be defined in a separate message. -message HttpRequest { - // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. - string request_method = 1; - - // The scheme (http, https), the host name, the path and the query - // portion of the URL that was requested. - // Example: `"http://example.com/some/info?color=red"`. - string request_url = 2; - - // The size of the HTTP request message in bytes, including the request - // headers and the request body. - int64 request_size = 3; - - // The response code indicating the status of response. - // Examples: 200, 404. - int32 status = 4; - - // The size of the HTTP response message sent back to the client, in bytes, - // including the response headers and the response body. - int64 response_size = 5; - - // The user agent sent by the client. Example: - // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET - // CLR 1.0.3705)"`. - string user_agent = 6; - - // The IP address (IPv4 or IPv6) of the client that issued the HTTP - // request. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string remote_ip = 7; - - // The IP address (IPv4 or IPv6) of the origin server that the request was - // sent to. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string server_ip = 13; - - // The referer URL of the request, as defined in - // [HTTP/1.1 Header Field - // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). - string referer = 8; - - // The request processing latency on the server, from the time the request was - // received until the response was sent. - google.protobuf.Duration latency = 14; - - // Whether or not a cache lookup was attempted. - bool cache_lookup = 11; - - // Whether or not an entity was served from cache - // (with or without validation). - bool cache_hit = 9; - - // Whether or not the response was validated with the origin server before - // being served from cache. This field is only meaningful if `cache_hit` is - // True. - bool cache_validated_with_origin_server = 10; - - // The number of HTTP response bytes inserted into cache. Set only when a - // cache fill was attempted. - int64 cache_fill_bytes = 12; - - // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" - string protocol = 15; -} diff --git a/opensafely/_vendor/google/logging/type/http_request_pb2.py b/opensafely/_vendor/google/logging/type/http_request_pb2.py deleted file mode 100644 index 5ad64c53..00000000 --- a/opensafely/_vendor/google/logging/type/http_request_pb2.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/logging/type/http_request.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n&google/logging/type/http_request.proto\x12\x13google.logging.type\x1a\x1egoogle/protobuf/duration.proto"\xef\x02\n\x0bHttpRequest\x12\x16\n\x0erequest_method\x18\x01 \x01(\t\x12\x13\n\x0brequest_url\x18\x02 \x01(\t\x12\x14\n\x0crequest_size\x18\x03 \x01(\x03\x12\x0e\n\x06status\x18\x04 \x01(\x05\x12\x15\n\rresponse_size\x18\x05 \x01(\x03\x12\x12\n\nuser_agent\x18\x06 \x01(\t\x12\x11\n\tremote_ip\x18\x07 \x01(\t\x12\x11\n\tserver_ip\x18\r \x01(\t\x12\x0f\n\x07referer\x18\x08 \x01(\t\x12*\n\x07latency\x18\x0e \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x14\n\x0c\x63\x61\x63he_lookup\x18\x0b \x01(\x08\x12\x11\n\tcache_hit\x18\t \x01(\x08\x12*\n"cache_validated_with_origin_server\x18\n \x01(\x08\x12\x18\n\x10\x63\x61\x63he_fill_bytes\x18\x0c \x01(\x03\x12\x10\n\x08protocol\x18\x0f \x01(\tB\xbe\x01\n\x17\x63om.google.logging.typeB\x10HttpRequestProtoP\x01Z8google.golang.org/genproto/googleapis/logging/type;ltype\xaa\x02\x19Google.Cloud.Logging.Type\xca\x02\x19Google\\Cloud\\Logging\\Type\xea\x02\x1cGoogle::Cloud::Logging::Typeb\x06proto3' -) - - -_HTTPREQUEST = DESCRIPTOR.message_types_by_name["HttpRequest"] -HttpRequest = _reflection.GeneratedProtocolMessageType( - "HttpRequest", - (_message.Message,), - { - "DESCRIPTOR": _HTTPREQUEST, - "__module__": "google.logging.type.http_request_pb2" - # @@protoc_insertion_point(class_scope:google.logging.type.HttpRequest) - }, -) -_sym_db.RegisterMessage(HttpRequest) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\027com.google.logging.typeB\020HttpRequestProtoP\001Z8google.golang.org/genproto/googleapis/logging/type;ltype\252\002\031Google.Cloud.Logging.Type\312\002\031Google\\Cloud\\Logging\\Type\352\002\034Google::Cloud::Logging::Type" - _HTTPREQUEST._serialized_start = 96 - _HTTPREQUEST._serialized_end = 463 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/logging/type/log_severity.proto b/opensafely/_vendor/google/logging/type/log_severity.proto deleted file mode 100644 index bed71935..00000000 --- a/opensafely/_vendor/google/logging/type/log_severity.proto +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.logging.type; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "LogSeverityProto"; -option java_package = "com.google.logging.type"; -option objc_class_prefix = "GLOG"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// The severity of the event described in a log entry, expressed as one of the -// standard severity levels listed below. For your reference, the levels are -// assigned the listed numeric values. The effect of using numeric values other -// than those listed is undefined. -// -// You can filter for log entries by severity. For example, the following -// filter expression will match log entries with severities `INFO`, `NOTICE`, -// and `WARNING`: -// -// severity > DEBUG AND severity <= WARNING -// -// If you are writing log entries, you should map other severity encodings to -// one of these standard levels. For example, you might map all of Java's FINE, -// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the -// original severity level in the log entry payload if you wish. -enum LogSeverity { - // (0) The log entry has no assigned severity level. - DEFAULT = 0; - - // (100) Debug or trace information. - DEBUG = 100; - - // (200) Routine information, such as ongoing status or performance. - INFO = 200; - - // (300) Normal but significant events, such as start up, shut down, or - // a configuration change. - NOTICE = 300; - - // (400) Warning events might cause problems. - WARNING = 400; - - // (500) Error events are likely to cause problems. - ERROR = 500; - - // (600) Critical events cause more severe problems or outages. - CRITICAL = 600; - - // (700) A person must take an action immediately. - ALERT = 700; - - // (800) One or more systems are unusable. - EMERGENCY = 800; -} diff --git a/opensafely/_vendor/google/logging/type/log_severity_pb2.py b/opensafely/_vendor/google/logging/type/log_severity_pb2.py deleted file mode 100644 index f15cec2e..00000000 --- a/opensafely/_vendor/google/logging/type/log_severity_pb2.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/logging/type/log_severity.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n&google/logging/type/log_severity.proto\x12\x13google.logging.type*\x82\x01\n\x0bLogSeverity\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x64\x12\t\n\x04INFO\x10\xc8\x01\x12\x0b\n\x06NOTICE\x10\xac\x02\x12\x0c\n\x07WARNING\x10\x90\x03\x12\n\n\x05\x45RROR\x10\xf4\x03\x12\r\n\x08\x43RITICAL\x10\xd8\x04\x12\n\n\x05\x41LERT\x10\xbc\x05\x12\x0e\n\tEMERGENCY\x10\xa0\x06\x42\xc5\x01\n\x17\x63om.google.logging.typeB\x10LogSeverityProtoP\x01Z8google.golang.org/genproto/googleapis/logging/type;ltype\xa2\x02\x04GLOG\xaa\x02\x19Google.Cloud.Logging.Type\xca\x02\x19Google\\Cloud\\Logging\\Type\xea\x02\x1cGoogle::Cloud::Logging::Typeb\x06proto3" -) - -_LOGSEVERITY = DESCRIPTOR.enum_types_by_name["LogSeverity"] -LogSeverity = enum_type_wrapper.EnumTypeWrapper(_LOGSEVERITY) -DEFAULT = 0 -DEBUG = 100 -INFO = 200 -NOTICE = 300 -WARNING = 400 -ERROR = 500 -CRITICAL = 600 -ALERT = 700 -EMERGENCY = 800 - - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\027com.google.logging.typeB\020LogSeverityProtoP\001Z8google.golang.org/genproto/googleapis/logging/type;ltype\242\002\004GLOG\252\002\031Google.Cloud.Logging.Type\312\002\031Google\\Cloud\\Logging\\Type\352\002\034Google::Cloud::Logging::Type" - _LOGSEVERITY._serialized_start = 64 - _LOGSEVERITY._serialized_end = 194 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/longrunning/__init__.py b/opensafely/_vendor/google/longrunning/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/longrunning/operations.proto b/opensafely/_vendor/google/longrunning/operations.proto deleted file mode 100644 index c1fdc6f5..00000000 --- a/opensafely/_vendor/google/longrunning/operations.proto +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2020 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.longrunning; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; -import "google/protobuf/descriptor.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.LongRunning"; -option go_package = "google.golang.org/genproto/googleapis/longrunning;longrunning"; -option java_multiple_files = true; -option java_outer_classname = "OperationsProto"; -option java_package = "com.google.longrunning"; -option php_namespace = "Google\\LongRunning"; - -extend google.protobuf.MethodOptions { - // Additional information regarding long-running operations. - // In particular, this specifies the types that are returned from - // long-running operations. - // - // Required for methods that return `google.longrunning.Operation`; invalid - // otherwise. - google.longrunning.OperationInfo operation_info = 1049; -} - -// Manages long-running operations with an API service. -// -// When an API method normally takes long time to complete, it can be designed -// to return [Operation][google.longrunning.Operation] to the client, and the client can use this -// interface to receive the real response asynchronously by polling the -// operation resource, or pass the operation resource to another API (such as -// Google Cloud Pub/Sub API) to receive the response. Any API service that -// returns long-running operations should implement the `Operations` interface -// so developers can have a consistent client experience. -service Operations { - option (google.api.default_host) = "longrunning.googleapis.com"; - - // Lists operations that match the specified filter in the request. If the - // server doesn't support this method, it returns `UNIMPLEMENTED`. - // - // NOTE: the `name` binding allows API services to override the binding - // to use different resource name schemes, such as `users/*/operations`. To - // override the binding, API services can add a binding such as - // `"/v1/{name=users/*}/operations"` to their service configuration. - // For backwards compatibility, the default name includes the operations - // collection id, however overriding users must ensure the name binding - // is the parent resource, without the operations collection id. - rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { - option (google.api.http) = { - get: "/v1/{name=operations}" - }; - option (google.api.method_signature) = "name,filter"; - } - - // Gets the latest state of a long-running operation. Clients can use this - // method to poll the operation result at intervals as recommended by the API - // service. - rpc GetOperation(GetOperationRequest) returns (Operation) { - option (google.api.http) = { - get: "/v1/{name=operations/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a long-running operation. This method indicates that the client is - // no longer interested in the operation result. It does not cancel the - // operation. If the server doesn't support this method, it returns - // `google.rpc.Code.UNIMPLEMENTED`. - rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=operations/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Starts asynchronous cancellation on a long-running operation. The server - // makes a best effort to cancel the operation, but success is not - // guaranteed. If the server doesn't support this method, it returns - // `google.rpc.Code.UNIMPLEMENTED`. Clients can use - // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - // other methods to check whether the cancellation succeeded or whether the - // operation completed despite cancellation. On successful cancellation, - // the operation is not deleted; instead, it becomes an operation with - // an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=operations/**}:cancel" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Waits until the specified long-running operation is done or reaches at most - // a specified timeout, returning the latest state. If the operation is - // already done, the latest state is immediately returned. If the timeout - // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - // timeout is used. If the server does not support this method, it returns - // `google.rpc.Code.UNIMPLEMENTED`. - // Note that this method is on a best-effort basis. It may return the latest - // state before the specified timeout (including immediately), meaning even an - // immediate response is no guarantee that the operation is done. - rpc WaitOperation(WaitOperationRequest) returns (Operation) { - } -} - -// This resource represents a long-running operation that is the result of a -// network API call. -message Operation { - // The server-assigned name, which is only unique within the same service that - // originally returns it. If you use the default HTTP mapping, the - // `name` should be a resource name ending with `operations/{unique_id}`. - string name = 1; - - // Service-specific metadata associated with the operation. It typically - // contains progress information and common metadata such as create time. - // Some services might not provide such metadata. Any method that returns a - // long-running operation should document the metadata type, if any. - google.protobuf.Any metadata = 2; - - // If the value is `false`, it means the operation is still in progress. - // If `true`, the operation is completed, and either `error` or `response` is - // available. - bool done = 3; - - // The operation result, which can be either an `error` or a valid `response`. - // If `done` == `false`, neither `error` nor `response` is set. - // If `done` == `true`, exactly one of `error` or `response` is set. - oneof result { - // The error result of the operation in case of failure or cancellation. - google.rpc.Status error = 4; - - // The normal response of the operation in case of success. If the original - // method returns no data on success, such as `Delete`, the response is - // `google.protobuf.Empty`. If the original method is standard - // `Get`/`Create`/`Update`, the response should be the resource. For other - // methods, the response should have the type `XxxResponse`, where `Xxx` - // is the original method name. For example, if the original method name - // is `TakeSnapshot()`, the inferred response type is - // `TakeSnapshotResponse`. - google.protobuf.Any response = 5; - } -} - -// The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation]. -message GetOperationRequest { - // The name of the operation resource. - string name = 1; -} - -// The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. -message ListOperationsRequest { - // The name of the operation's parent resource. - string name = 4; - - // The standard list filter. - string filter = 1; - - // The standard list page size. - int32 page_size = 2; - - // The standard list page token. - string page_token = 3; -} - -// The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. -message ListOperationsResponse { - // A list of operations that matches the specified filter in the request. - repeated Operation operations = 1; - - // The standard List next-page token. - string next_page_token = 2; -} - -// The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]. -message CancelOperationRequest { - // The name of the operation resource to be cancelled. - string name = 1; -} - -// The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation]. -message DeleteOperationRequest { - // The name of the operation resource to be deleted. - string name = 1; -} - -// The request message for [Operations.WaitOperation][google.longrunning.Operations.WaitOperation]. -message WaitOperationRequest { - // The name of the operation resource to wait on. - string name = 1; - - // The maximum duration to wait before timing out. If left blank, the wait - // will be at most the time permitted by the underlying HTTP/RPC protocol. - // If RPC context deadline is also specified, the shorter one will be used. - google.protobuf.Duration timeout = 2; -} - -// A message representing the message types used by a long-running operation. -// -// Example: -// -// rpc LongRunningRecognize(LongRunningRecognizeRequest) -// returns (google.longrunning.Operation) { -// option (google.longrunning.operation_info) = { -// response_type: "LongRunningRecognizeResponse" -// metadata_type: "LongRunningRecognizeMetadata" -// }; -// } -message OperationInfo { - // Required. The message name of the primary return type for this - // long-running operation. - // This type will be used to deserialize the LRO's response. - // - // If the response is in a different package from the rpc, a fully-qualified - // message name must be used (e.g. `google.protobuf.Struct`). - // - // Note: Altering this value constitutes a breaking change. - string response_type = 1; - - // Required. The message name of the metadata type for this long-running - // operation. - // - // If the response is in a different package from the rpc, a fully-qualified - // message name must be used (e.g. `google.protobuf.Struct`). - // - // Note: Altering this value constitutes a breaking change. - string metadata_type = 2; -} diff --git a/opensafely/_vendor/google/longrunning/operations_grpc.py b/opensafely/_vendor/google/longrunning/operations_grpc.py deleted file mode 100644 index 832408b5..00000000 --- a/opensafely/_vendor/google/longrunning/operations_grpc.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2020 Google LLC -# -# 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 -# -# https://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. - -# This module is provided for backwards compatibility with -# googleapis-common-protos <= 1.5.0, where this was the import path. - -from __future__ import absolute_import -from opensafely._vendor.google.longrunning.operations_grpc_pb2 import * diff --git a/opensafely/_vendor/google/longrunning/operations_grpc_pb2.py b/opensafely/_vendor/google/longrunning/operations_grpc_pb2.py deleted file mode 100644 index 75fb514e..00000000 --- a/opensafely/_vendor/google/longrunning/operations_grpc_pb2.py +++ /dev/null @@ -1,15 +0,0 @@ -# This module is provided for backwards compatibility with -# googleapis-common-protos <= 1.52.0, where this import path contained -# all of the message and gRPC definitions. - -from opensafely._vendor.google.longrunning.operations_proto_pb2 import * -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATION -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATION -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _GETOPERATIONREQUEST -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _LISTOPERATIONSREQUEST -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _LISTOPERATIONSRESPONSE -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _CANCELOPERATIONREQUEST -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _DELETEOPERATIONREQUEST -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATIONINFO -from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATIONS -from opensafely._vendor.google.longrunning.operations_pb2_grpc import * diff --git a/opensafely/_vendor/google/longrunning/operations_pb2.py b/opensafely/_vendor/google/longrunning/operations_pb2.py deleted file mode 100644 index 2485eed1..00000000 --- a/opensafely/_vendor/google/longrunning/operations_pb2.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2016 Google Inc. 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. - -"""Safe implementation of long-running operations with and without gRPC. - -Multiplexes between versions of long-running operations with and without gRPC. -The former is preferred, but not possible in all environments (such as Google -AppEngine Standard). -""" - -try: - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import * - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _OPERATION - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _GETOPERATIONREQUEST - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _LISTOPERATIONSREQUEST - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _LISTOPERATIONSRESPONSE - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _CANCELOPERATIONREQUEST - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _DELETEOPERATIONREQUEST - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _OPERATIONINFO - from opensafely._vendor.google.longrunning.operations_grpc_pb2 import _OPERATIONS -except ImportError: - from opensafely._vendor.google.longrunning.operations_proto_pb2 import * - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATION - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATION - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _GETOPERATIONREQUEST - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _LISTOPERATIONSREQUEST - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _LISTOPERATIONSRESPONSE - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _CANCELOPERATIONREQUEST - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _DELETEOPERATIONREQUEST - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATIONINFO - from opensafely._vendor.google.longrunning.operations_proto_pb2 import _OPERATIONS diff --git a/opensafely/_vendor/google/longrunning/operations_pb2_grpc.py b/opensafely/_vendor/google/longrunning/operations_pb2_grpc.py deleted file mode 100644 index 6fcf9fbf..00000000 --- a/opensafely/_vendor/google/longrunning/operations_pb2_grpc.py +++ /dev/null @@ -1,341 +0,0 @@ - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! - -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from opensafely._vendor.google.longrunning import ( - operations_proto_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from opensafely._vendor.google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class OperationsStub(object): - """Manages long-running operations with an API service. - - When an API method normally takes long time to complete, it can be designed - to return [Operation][google.longrunning.Operation] to the client, and the client can use this - interface to receive the real response asynchronously by polling the - operation resource, or pass the operation resource to another API (such as - Google Cloud Pub/Sub API) to receive the response. Any API service that - returns long-running operations should implement the `Operations` interface - so developers can have a consistent client experience. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListOperations = channel.unary_unary( - "/google.longrunning.Operations/ListOperations", - request_serializer=google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.FromString, - ) - self.GetOperation = channel.unary_unary( - "/google.longrunning.Operations/GetOperation", - request_serializer=google_dot_longrunning_dot_operations__pb2.GetOperationRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.DeleteOperation = channel.unary_unary( - "/google.longrunning.Operations/DeleteOperation", - request_serializer=google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.CancelOperation = channel.unary_unary( - "/google.longrunning.Operations/CancelOperation", - request_serializer=google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.WaitOperation = channel.unary_unary( - "/google.longrunning.Operations/WaitOperation", - request_serializer=google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - - -class OperationsServicer(object): - """Manages long-running operations with an API service. - - When an API method normally takes long time to complete, it can be designed - to return [Operation][google.longrunning.Operation] to the client, and the client can use this - interface to receive the real response asynchronously by polling the - operation resource, or pass the operation resource to another API (such as - Google Cloud Pub/Sub API) to receive the response. Any API service that - returns long-running operations should implement the `Operations` interface - so developers can have a consistent client experience. - """ - - def ListOperations(self, request, context): - """Lists operations that match the specified filter in the request. If the - server doesn't support this method, it returns `UNIMPLEMENTED`. - - NOTE: the `name` binding allows API services to override the binding - to use different resource name schemes, such as `users/*/operations`. To - override the binding, API services can add a binding such as - `"/v1/{name=users/*}/operations"` to their service configuration. - For backwards compatibility, the default name includes the operations - collection id, however overriding users must ensure the name binding - is the parent resource, without the operations collection id. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetOperation(self, request, context): - """Gets the latest state of a long-running operation. Clients can use this - method to poll the operation result at intervals as recommended by the API - service. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteOperation(self, request, context): - """Deletes a long-running operation. This method indicates that the client is - no longer interested in the operation result. It does not cancel the - operation. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CancelOperation(self, request, context): - """Starts asynchronous cancellation on a long-running operation. The server - makes a best effort to cancel the operation, but success is not - guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. Clients can use - [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - other methods to check whether the cancellation succeeded or whether the - operation completed despite cancellation. On successful cancellation, - the operation is not deleted; instead, it becomes an operation with - an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - corresponding to `Code.CANCELLED`. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def WaitOperation(self, request, context): - """Waits until the specified long-running operation is done or reaches at most - a specified timeout, returning the latest state. If the operation is - already done, the latest state is immediately returned. If the timeout - specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - timeout is used. If the server does not support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - Note that this method is on a best-effort basis. It may return the latest - state before the specified timeout (including immediately), meaning even an - immediate response is no guarantee that the operation is done. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_OperationsServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListOperations": grpc.unary_unary_rpc_method_handler( - servicer.ListOperations, - request_deserializer=google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.SerializeToString, - ), - "GetOperation": grpc.unary_unary_rpc_method_handler( - servicer.GetOperation, - request_deserializer=google_dot_longrunning_dot_operations__pb2.GetOperationRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "DeleteOperation": grpc.unary_unary_rpc_method_handler( - servicer.DeleteOperation, - request_deserializer=google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "CancelOperation": grpc.unary_unary_rpc_method_handler( - servicer.CancelOperation, - request_deserializer=google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "WaitOperation": grpc.unary_unary_rpc_method_handler( - servicer.WaitOperation, - request_deserializer=google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.longrunning.Operations", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Operations(object): - """Manages long-running operations with an API service. - - When an API method normally takes long time to complete, it can be designed - to return [Operation][google.longrunning.Operation] to the client, and the client can use this - interface to receive the real response asynchronously by polling the - operation resource, or pass the operation resource to another API (such as - Google Cloud Pub/Sub API) to receive the response. Any API service that - returns long-running operations should implement the `Operations` interface - so developers can have a consistent client experience. - """ - - @staticmethod - def ListOperations( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.longrunning.Operations/ListOperations", - google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetOperation( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.longrunning.Operations/GetOperation", - google_dot_longrunning_dot_operations__pb2.GetOperationRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteOperation( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.longrunning.Operations/DeleteOperation", - google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CancelOperation( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.longrunning.Operations/CancelOperation", - google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def WaitOperation( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.longrunning.Operations/WaitOperation", - google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/opensafely/_vendor/google/longrunning/operations_proto.py b/opensafely/_vendor/google/longrunning/operations_proto.py deleted file mode 100644 index 2c55473b..00000000 --- a/opensafely/_vendor/google/longrunning/operations_proto.py +++ /dev/null @@ -1,5 +0,0 @@ -# This module is provided for backwards compatibility with -# googleapis-common-protos <= 1.5.0, where this was the import path. - -from __future__ import absolute_import -from opensafely._vendor.google.longrunning.operations_proto_pb2 import * diff --git a/opensafely/_vendor/google/longrunning/operations_proto_pb2.py b/opensafely/_vendor/google/longrunning/operations_proto_pb2.py deleted file mode 100644 index 1f7b54aa..00000000 --- a/opensafely/_vendor/google/longrunning/operations_proto_pb2.py +++ /dev/null @@ -1,196 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/longrunning/operations.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from opensafely._vendor.google.api import client_pb2 as google_dot_api_dot_client__pb2 -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from opensafely._vendor.google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from opensafely._vendor.google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from opensafely._vendor.google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n#google/longrunning/operations.proto\x12\x12google.longrunning\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x17google/rpc/status.proto\x1a google/protobuf/descriptor.proto"\xa8\x01\n\tOperation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12&\n\x08metadata\x18\x02 \x01(\x0b\x32\x14.google.protobuf.Any\x12\x0c\n\x04\x64one\x18\x03 \x01(\x08\x12#\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.StatusH\x00\x12(\n\x08response\x18\x05 \x01(\x0b\x32\x14.google.protobuf.AnyH\x00\x42\x08\n\x06result"#\n\x13GetOperationRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\\\n\x15ListOperationsRequest\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"d\n\x16ListOperationsResponse\x12\x31\n\noperations\x18\x01 \x03(\x0b\x32\x1d.google.longrunning.Operation\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"&\n\x16\x43\x61ncelOperationRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"&\n\x16\x44\x65leteOperationRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"P\n\x14WaitOperationRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\x07timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"=\n\rOperationInfo\x12\x15\n\rresponse_type\x18\x01 \x01(\t\x12\x15\n\rmetadata_type\x18\x02 \x01(\t2\xaa\x05\n\nOperations\x12\x94\x01\n\x0eListOperations\x12).google.longrunning.ListOperationsRequest\x1a*.google.longrunning.ListOperationsResponse"+\x82\xd3\xe4\x93\x02\x17\x12\x15/v1/{name=operations}\xda\x41\x0bname,filter\x12\x7f\n\x0cGetOperation\x12\'.google.longrunning.GetOperationRequest\x1a\x1d.google.longrunning.Operation"\'\x82\xd3\xe4\x93\x02\x1a\x12\x18/v1/{name=operations/**}\xda\x41\x04name\x12~\n\x0f\x44\x65leteOperation\x12*.google.longrunning.DeleteOperationRequest\x1a\x16.google.protobuf.Empty"\'\x82\xd3\xe4\x93\x02\x1a*\x18/v1/{name=operations/**}\xda\x41\x04name\x12\x88\x01\n\x0f\x43\x61ncelOperation\x12*.google.longrunning.CancelOperationRequest\x1a\x16.google.protobuf.Empty"1\x82\xd3\xe4\x93\x02$"\x1f/v1/{name=operations/**}:cancel:\x01*\xda\x41\x04name\x12Z\n\rWaitOperation\x12(.google.longrunning.WaitOperationRequest\x1a\x1d.google.longrunning.Operation"\x00\x1a\x1d\xca\x41\x1alongrunning.googleapis.com:Z\n\x0eoperation_info\x12\x1e.google.protobuf.MethodOptions\x18\x99\x08 \x01(\x0b\x32!.google.longrunning.OperationInfoB\x97\x01\n\x16\x63om.google.longrunningB\x0fOperationsProtoP\x01Z=google.golang.org/genproto/googleapis/longrunning;longrunning\xf8\x01\x01\xaa\x02\x12Google.LongRunning\xca\x02\x12Google\\LongRunningb\x06proto3' -) - - -OPERATION_INFO_FIELD_NUMBER = 1049 -operation_info = DESCRIPTOR.extensions_by_name["operation_info"] - -_OPERATION = DESCRIPTOR.message_types_by_name["Operation"] -_GETOPERATIONREQUEST = DESCRIPTOR.message_types_by_name["GetOperationRequest"] -_LISTOPERATIONSREQUEST = DESCRIPTOR.message_types_by_name["ListOperationsRequest"] -_LISTOPERATIONSRESPONSE = DESCRIPTOR.message_types_by_name["ListOperationsResponse"] -_CANCELOPERATIONREQUEST = DESCRIPTOR.message_types_by_name["CancelOperationRequest"] -_DELETEOPERATIONREQUEST = DESCRIPTOR.message_types_by_name["DeleteOperationRequest"] -_WAITOPERATIONREQUEST = DESCRIPTOR.message_types_by_name["WaitOperationRequest"] -_OPERATIONINFO = DESCRIPTOR.message_types_by_name["OperationInfo"] -Operation = _reflection.GeneratedProtocolMessageType( - "Operation", - (_message.Message,), - { - "DESCRIPTOR": _OPERATION, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.Operation) - }, -) -_sym_db.RegisterMessage(Operation) - -GetOperationRequest = _reflection.GeneratedProtocolMessageType( - "GetOperationRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETOPERATIONREQUEST, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.GetOperationRequest) - }, -) -_sym_db.RegisterMessage(GetOperationRequest) - -ListOperationsRequest = _reflection.GeneratedProtocolMessageType( - "ListOperationsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTOPERATIONSREQUEST, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.ListOperationsRequest) - }, -) -_sym_db.RegisterMessage(ListOperationsRequest) - -ListOperationsResponse = _reflection.GeneratedProtocolMessageType( - "ListOperationsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTOPERATIONSRESPONSE, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.ListOperationsResponse) - }, -) -_sym_db.RegisterMessage(ListOperationsResponse) - -CancelOperationRequest = _reflection.GeneratedProtocolMessageType( - "CancelOperationRequest", - (_message.Message,), - { - "DESCRIPTOR": _CANCELOPERATIONREQUEST, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.CancelOperationRequest) - }, -) -_sym_db.RegisterMessage(CancelOperationRequest) - -DeleteOperationRequest = _reflection.GeneratedProtocolMessageType( - "DeleteOperationRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEOPERATIONREQUEST, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.DeleteOperationRequest) - }, -) -_sym_db.RegisterMessage(DeleteOperationRequest) - -WaitOperationRequest = _reflection.GeneratedProtocolMessageType( - "WaitOperationRequest", - (_message.Message,), - { - "DESCRIPTOR": _WAITOPERATIONREQUEST, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.WaitOperationRequest) - }, -) -_sym_db.RegisterMessage(WaitOperationRequest) - -OperationInfo = _reflection.GeneratedProtocolMessageType( - "OperationInfo", - (_message.Message,), - { - "DESCRIPTOR": _OPERATIONINFO, - "__module__": "google.longrunning.operations_pb2" - # @@protoc_insertion_point(class_scope:google.longrunning.OperationInfo) - }, -) -_sym_db.RegisterMessage(OperationInfo) - -_OPERATIONS = DESCRIPTOR.services_by_name["Operations"] -if _descriptor._USE_C_DESCRIPTORS == False: - google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension( - operation_info - ) - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\026com.google.longrunningB\017OperationsProtoP\001Z=google.golang.org/genproto/googleapis/longrunning;longrunning\370\001\001\252\002\022Google.LongRunning\312\002\022Google\\LongRunning" - _OPERATIONS._options = None - _OPERATIONS._serialized_options = b"\312A\032longrunning.googleapis.com" - _OPERATIONS.methods_by_name["ListOperations"]._options = None - _OPERATIONS.methods_by_name[ - "ListOperations" - ]._serialized_options = ( - b"\202\323\344\223\002\027\022\025/v1/{name=operations}\332A\013name,filter" - ) - _OPERATIONS.methods_by_name["GetOperation"]._options = None - _OPERATIONS.methods_by_name[ - "GetOperation" - ]._serialized_options = ( - b"\202\323\344\223\002\032\022\030/v1/{name=operations/**}\332A\004name" - ) - _OPERATIONS.methods_by_name["DeleteOperation"]._options = None - _OPERATIONS.methods_by_name[ - "DeleteOperation" - ]._serialized_options = ( - b"\202\323\344\223\002\032*\030/v1/{name=operations/**}\332A\004name" - ) - _OPERATIONS.methods_by_name["CancelOperation"]._options = None - _OPERATIONS.methods_by_name[ - "CancelOperation" - ]._serialized_options = ( - b'\202\323\344\223\002$"\037/v1/{name=operations/**}:cancel:\001*\332A\004name' - ) - _OPERATION._serialized_start = 262 - _OPERATION._serialized_end = 430 - _GETOPERATIONREQUEST._serialized_start = 432 - _GETOPERATIONREQUEST._serialized_end = 467 - _LISTOPERATIONSREQUEST._serialized_start = 469 - _LISTOPERATIONSREQUEST._serialized_end = 561 - _LISTOPERATIONSRESPONSE._serialized_start = 563 - _LISTOPERATIONSRESPONSE._serialized_end = 663 - _CANCELOPERATIONREQUEST._serialized_start = 665 - _CANCELOPERATIONREQUEST._serialized_end = 703 - _DELETEOPERATIONREQUEST._serialized_start = 705 - _DELETEOPERATIONREQUEST._serialized_end = 743 - _WAITOPERATIONREQUEST._serialized_start = 745 - _WAITOPERATIONREQUEST._serialized_end = 825 - _OPERATIONINFO._serialized_start = 827 - _OPERATIONINFO._serialized_end = 888 - _OPERATIONS._serialized_start = 891 - _OPERATIONS._serialized_end = 1573 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/__init__.py b/opensafely/_vendor/google/protobuf/__init__.py deleted file mode 100644 index 7dff9a9d..00000000 --- a/opensafely/_vendor/google/protobuf/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Copyright 2007 Google Inc. All Rights Reserved. - -__version__ = '3.20.2' diff --git a/opensafely/_vendor/google/protobuf/any_pb2.py b/opensafely/_vendor/google/protobuf/any_pb2.py deleted file mode 100644 index 92499630..00000000 --- a/opensafely/_vendor/google/protobuf/any_pb2.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/any.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobuf/any.proto\x12\x0fgoogle.protobuf\"&\n\x03\x41ny\x12\x10\n\x08type_url\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\x42v\n\x13\x63om.google.protobufB\x08\x41nyProtoP\x01Z,google.golang.org/protobuf/types/known/anypb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.any_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\010AnyProtoP\001Z,google.golang.org/protobuf/types/known/anypb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _ANY._serialized_start=46 - _ANY._serialized_end=84 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/api_pb2.py b/opensafely/_vendor/google/protobuf/api_pb2.py deleted file mode 100644 index fff87dea..00000000 --- a/opensafely/_vendor/google/protobuf/api_pb2.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/api.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import source_context_pb2 as google_dot_protobuf_dot_source__context__pb2 -from opensafely._vendor.google.protobuf import type_pb2 as google_dot_protobuf_dot_type__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobuf/api.proto\x12\x0fgoogle.protobuf\x1a$google/protobuf/source_context.proto\x1a\x1agoogle/protobuf/type.proto\"\x81\x02\n\x03\x41pi\x12\x0c\n\x04name\x18\x01 \x01(\t\x12(\n\x07methods\x18\x02 \x03(\x0b\x32\x17.google.protobuf.Method\x12(\n\x07options\x18\x03 \x03(\x0b\x32\x17.google.protobuf.Option\x12\x0f\n\x07version\x18\x04 \x01(\t\x12\x36\n\x0esource_context\x18\x05 \x01(\x0b\x32\x1e.google.protobuf.SourceContext\x12&\n\x06mixins\x18\x06 \x03(\x0b\x32\x16.google.protobuf.Mixin\x12\'\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.Syntax\"\xd5\x01\n\x06Method\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x18\n\x10request_type_url\x18\x02 \x01(\t\x12\x19\n\x11request_streaming\x18\x03 \x01(\x08\x12\x19\n\x11response_type_url\x18\x04 \x01(\t\x12\x1a\n\x12response_streaming\x18\x05 \x01(\x08\x12(\n\x07options\x18\x06 \x03(\x0b\x32\x17.google.protobuf.Option\x12\'\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.Syntax\"#\n\x05Mixin\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04root\x18\x02 \x01(\tBv\n\x13\x63om.google.protobufB\x08\x41piProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.api_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\010ApiProtoP\001Z,google.golang.org/protobuf/types/known/apipb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _API._serialized_start=113 - _API._serialized_end=370 - _METHOD._serialized_start=373 - _METHOD._serialized_end=586 - _MIXIN._serialized_start=588 - _MIXIN._serialized_end=623 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/compiler/__init__.py b/opensafely/_vendor/google/protobuf/compiler/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/protobuf/compiler/plugin_pb2.py b/opensafely/_vendor/google/protobuf/compiler/plugin_pb2.py deleted file mode 100644 index 3e42c3d1..00000000 --- a/opensafely/_vendor/google/protobuf/compiler/plugin_pb2.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/compiler/plugin.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n%google/protobuf/compiler/plugin.proto\x12\x18google.protobuf.compiler\x1a google/protobuf/descriptor.proto\"F\n\x07Version\x12\r\n\x05major\x18\x01 \x01(\x05\x12\r\n\x05minor\x18\x02 \x01(\x05\x12\r\n\x05patch\x18\x03 \x01(\x05\x12\x0e\n\x06suffix\x18\x04 \x01(\t\"\xba\x01\n\x14\x43odeGeneratorRequest\x12\x18\n\x10\x66ile_to_generate\x18\x01 \x03(\t\x12\x11\n\tparameter\x18\x02 \x01(\t\x12\x38\n\nproto_file\x18\x0f \x03(\x0b\x32$.google.protobuf.FileDescriptorProto\x12;\n\x10\x63ompiler_version\x18\x03 \x01(\x0b\x32!.google.protobuf.compiler.Version\"\xc1\x02\n\x15\x43odeGeneratorResponse\x12\r\n\x05\x65rror\x18\x01 \x01(\t\x12\x1a\n\x12supported_features\x18\x02 \x01(\x04\x12\x42\n\x04\x66ile\x18\x0f \x03(\x0b\x32\x34.google.protobuf.compiler.CodeGeneratorResponse.File\x1a\x7f\n\x04\x46ile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x17\n\x0finsertion_point\x18\x02 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x0f \x01(\t\x12?\n\x13generated_code_info\x18\x10 \x01(\x0b\x32\".google.protobuf.GeneratedCodeInfo\"8\n\x07\x46\x65\x61ture\x12\x10\n\x0c\x46\x45\x41TURE_NONE\x10\x00\x12\x1b\n\x17\x46\x45\x41TURE_PROTO3_OPTIONAL\x10\x01\x42W\n\x1c\x63om.google.protobuf.compilerB\x0cPluginProtosZ)google.golang.org/protobuf/types/pluginpb') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.compiler.plugin_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\034com.google.protobuf.compilerB\014PluginProtosZ)google.golang.org/protobuf/types/pluginpb' - _VERSION._serialized_start=101 - _VERSION._serialized_end=171 - _CODEGENERATORREQUEST._serialized_start=174 - _CODEGENERATORREQUEST._serialized_end=360 - _CODEGENERATORRESPONSE._serialized_start=363 - _CODEGENERATORRESPONSE._serialized_end=684 - _CODEGENERATORRESPONSE_FILE._serialized_start=499 - _CODEGENERATORRESPONSE_FILE._serialized_end=626 - _CODEGENERATORRESPONSE_FEATURE._serialized_start=628 - _CODEGENERATORRESPONSE_FEATURE._serialized_end=684 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/descriptor.py b/opensafely/_vendor/google/protobuf/descriptor.py deleted file mode 100644 index 3643bdb0..00000000 --- a/opensafely/_vendor/google/protobuf/descriptor.py +++ /dev/null @@ -1,1224 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Descriptors essentially contain exactly the information found in a .proto -file, in types that make this information accessible in Python. -""" - -__author__ = 'robinson@google.com (Will Robinson)' - -import threading -import warnings - -from opensafely._vendor.google.protobuf.internal import api_implementation - -_USE_C_DESCRIPTORS = False -if api_implementation.Type() == 'cpp': - # Used by MakeDescriptor in cpp mode - import binascii - import os - from opensafely._vendor.google.protobuf.pyext import _message - _USE_C_DESCRIPTORS = True - - -class Error(Exception): - """Base error for this module.""" - - -class TypeTransformationError(Error): - """Error transforming between python proto type and corresponding C++ type.""" - - -if _USE_C_DESCRIPTORS: - # This metaclass allows to override the behavior of code like - # isinstance(my_descriptor, FieldDescriptor) - # and make it return True when the descriptor is an instance of the extension - # type written in C++. - class DescriptorMetaclass(type): - def __instancecheck__(cls, obj): - if super(DescriptorMetaclass, cls).__instancecheck__(obj): - return True - if isinstance(obj, cls._C_DESCRIPTOR_CLASS): - return True - return False -else: - # The standard metaclass; nothing changes. - DescriptorMetaclass = type - - -class _Lock(object): - """Wrapper class of threading.Lock(), which is allowed by 'with'.""" - - def __new__(cls): - self = object.__new__(cls) - self._lock = threading.Lock() # pylint: disable=protected-access - return self - - def __enter__(self): - self._lock.acquire() - - def __exit__(self, exc_type, exc_value, exc_tb): - self._lock.release() - - -_lock = threading.Lock() - - -def _Deprecated(name): - if _Deprecated.count > 0: - _Deprecated.count -= 1 - warnings.warn( - 'Call to deprecated create function %s(). Note: Create unlinked ' - 'descriptors is going to go away. Please use get/find descriptors from ' - 'generated code or query the descriptor_pool.' - % name, - category=DeprecationWarning, stacklevel=3) - - -# Deprecated warnings will print 100 times at most which should be enough for -# users to notice and do not cause timeout. -_Deprecated.count = 100 - - -_internal_create_key = object() - - -class DescriptorBase(metaclass=DescriptorMetaclass): - - """Descriptors base class. - - This class is the base of all descriptor classes. It provides common options - related functionality. - - Attributes: - has_options: True if the descriptor has non-default options. Usually it - is not necessary to read this -- just call GetOptions() which will - happily return the default instance. However, it's sometimes useful - for efficiency, and also useful inside the protobuf implementation to - avoid some bootstrapping issues. - """ - - if _USE_C_DESCRIPTORS: - # The class, or tuple of classes, that are considered as "virtual - # subclasses" of this descriptor class. - _C_DESCRIPTOR_CLASS = () - - def __init__(self, options, serialized_options, options_class_name): - """Initialize the descriptor given its options message and the name of the - class of the options message. The name of the class is required in case - the options message is None and has to be created. - """ - self._options = options - self._options_class_name = options_class_name - self._serialized_options = serialized_options - - # Does this descriptor have non-default options? - self.has_options = (options is not None) or (serialized_options is not None) - - def _SetOptions(self, options, options_class_name): - """Sets the descriptor's options - - This function is used in generated proto2 files to update descriptor - options. It must not be used outside proto2. - """ - self._options = options - self._options_class_name = options_class_name - - # Does this descriptor have non-default options? - self.has_options = options is not None - - def GetOptions(self): - """Retrieves descriptor options. - - This method returns the options set or creates the default options for the - descriptor. - """ - if self._options: - return self._options - - from opensafely._vendor.google.protobuf import descriptor_pb2 - try: - options_class = getattr(descriptor_pb2, - self._options_class_name) - except AttributeError: - raise RuntimeError('Unknown options class name %s!' % - (self._options_class_name)) - - with _lock: - if self._serialized_options is None: - self._options = options_class() - else: - self._options = _ParseOptions(options_class(), - self._serialized_options) - - return self._options - - -class _NestedDescriptorBase(DescriptorBase): - """Common class for descriptors that can be nested.""" - - def __init__(self, options, options_class_name, name, full_name, - file, containing_type, serialized_start=None, - serialized_end=None, serialized_options=None): - """Constructor. - - Args: - options: Protocol message options or None - to use default message options. - options_class_name (str): The class name of the above options. - name (str): Name of this protocol message type. - full_name (str): Fully-qualified name of this protocol message type, - which will include protocol "package" name and the name of any - enclosing types. - file (FileDescriptor): Reference to file info. - containing_type: if provided, this is a nested descriptor, with this - descriptor as parent, otherwise None. - serialized_start: The start index (inclusive) in block in the - file.serialized_pb that describes this descriptor. - serialized_end: The end index (exclusive) in block in the - file.serialized_pb that describes this descriptor. - serialized_options: Protocol message serialized options or None. - """ - super(_NestedDescriptorBase, self).__init__( - options, serialized_options, options_class_name) - - self.name = name - # TODO(falk): Add function to calculate full_name instead of having it in - # memory? - self.full_name = full_name - self.file = file - self.containing_type = containing_type - - self._serialized_start = serialized_start - self._serialized_end = serialized_end - - def CopyToProto(self, proto): - """Copies this to the matching proto in descriptor_pb2. - - Args: - proto: An empty proto instance from descriptor_pb2. - - Raises: - Error: If self couldn't be serialized, due to to few constructor - arguments. - """ - if (self.file is not None and - self._serialized_start is not None and - self._serialized_end is not None): - proto.ParseFromString(self.file.serialized_pb[ - self._serialized_start:self._serialized_end]) - else: - raise Error('Descriptor does not contain serialization.') - - -class Descriptor(_NestedDescriptorBase): - - """Descriptor for a protocol message type. - - Attributes: - name (str): Name of this protocol message type. - full_name (str): Fully-qualified name of this protocol message type, - which will include protocol "package" name and the name of any - enclosing types. - containing_type (Descriptor): Reference to the descriptor of the type - containing us, or None if this is top-level. - fields (list[FieldDescriptor]): Field descriptors for all fields in - this type. - fields_by_number (dict(int, FieldDescriptor)): Same - :class:`FieldDescriptor` objects as in :attr:`fields`, but indexed - by "number" attribute in each FieldDescriptor. - fields_by_name (dict(str, FieldDescriptor)): Same - :class:`FieldDescriptor` objects as in :attr:`fields`, but indexed by - "name" attribute in each :class:`FieldDescriptor`. - nested_types (list[Descriptor]): Descriptor references - for all protocol message types nested within this one. - nested_types_by_name (dict(str, Descriptor)): Same Descriptor - objects as in :attr:`nested_types`, but indexed by "name" attribute - in each Descriptor. - enum_types (list[EnumDescriptor]): :class:`EnumDescriptor` references - for all enums contained within this type. - enum_types_by_name (dict(str, EnumDescriptor)): Same - :class:`EnumDescriptor` objects as in :attr:`enum_types`, but - indexed by "name" attribute in each EnumDescriptor. - enum_values_by_name (dict(str, EnumValueDescriptor)): Dict mapping - from enum value name to :class:`EnumValueDescriptor` for that value. - extensions (list[FieldDescriptor]): All extensions defined directly - within this message type (NOT within a nested type). - extensions_by_name (dict(str, FieldDescriptor)): Same FieldDescriptor - objects as :attr:`extensions`, but indexed by "name" attribute of each - FieldDescriptor. - is_extendable (bool): Does this type define any extension ranges? - oneofs (list[OneofDescriptor]): The list of descriptors for oneof fields - in this message. - oneofs_by_name (dict(str, OneofDescriptor)): Same objects as in - :attr:`oneofs`, but indexed by "name" attribute. - file (FileDescriptor): Reference to file descriptor. - - """ - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.Descriptor - - def __new__( - cls, - name=None, - full_name=None, - filename=None, - containing_type=None, - fields=None, - nested_types=None, - enum_types=None, - extensions=None, - options=None, - serialized_options=None, - is_extendable=True, - extension_ranges=None, - oneofs=None, - file=None, # pylint: disable=redefined-builtin - serialized_start=None, - serialized_end=None, - syntax=None, - create_key=None): - _message.Message._CheckCalledFromGeneratedFile() - return _message.default_pool.FindMessageTypeByName(full_name) - - # NOTE(tmarek): The file argument redefining a builtin is nothing we can - # fix right now since we don't know how many clients already rely on the - # name of the argument. - def __init__(self, name, full_name, filename, containing_type, fields, - nested_types, enum_types, extensions, options=None, - serialized_options=None, - is_extendable=True, extension_ranges=None, oneofs=None, - file=None, serialized_start=None, serialized_end=None, # pylint: disable=redefined-builtin - syntax=None, create_key=None): - """Arguments to __init__() are as described in the description - of Descriptor fields above. - - Note that filename is an obsolete argument, that is not used anymore. - Please use file.name to access this as an attribute. - """ - if create_key is not _internal_create_key: - _Deprecated('Descriptor') - - super(Descriptor, self).__init__( - options, 'MessageOptions', name, full_name, file, - containing_type, serialized_start=serialized_start, - serialized_end=serialized_end, serialized_options=serialized_options) - - # We have fields in addition to fields_by_name and fields_by_number, - # so that: - # 1. Clients can index fields by "order in which they're listed." - # 2. Clients can easily iterate over all fields with the terse - # syntax: for f in descriptor.fields: ... - self.fields = fields - for field in self.fields: - field.containing_type = self - self.fields_by_number = dict((f.number, f) for f in fields) - self.fields_by_name = dict((f.name, f) for f in fields) - self._fields_by_camelcase_name = None - - self.nested_types = nested_types - for nested_type in nested_types: - nested_type.containing_type = self - self.nested_types_by_name = dict((t.name, t) for t in nested_types) - - self.enum_types = enum_types - for enum_type in self.enum_types: - enum_type.containing_type = self - self.enum_types_by_name = dict((t.name, t) for t in enum_types) - self.enum_values_by_name = dict( - (v.name, v) for t in enum_types for v in t.values) - - self.extensions = extensions - for extension in self.extensions: - extension.extension_scope = self - self.extensions_by_name = dict((f.name, f) for f in extensions) - self.is_extendable = is_extendable - self.extension_ranges = extension_ranges - self.oneofs = oneofs if oneofs is not None else [] - self.oneofs_by_name = dict((o.name, o) for o in self.oneofs) - for oneof in self.oneofs: - oneof.containing_type = self - self.syntax = syntax or "proto2" - - @property - def fields_by_camelcase_name(self): - """Same FieldDescriptor objects as in :attr:`fields`, but indexed by - :attr:`FieldDescriptor.camelcase_name`. - """ - if self._fields_by_camelcase_name is None: - self._fields_by_camelcase_name = dict( - (f.camelcase_name, f) for f in self.fields) - return self._fields_by_camelcase_name - - def EnumValueName(self, enum, value): - """Returns the string name of an enum value. - - This is just a small helper method to simplify a common operation. - - Args: - enum: string name of the Enum. - value: int, value of the enum. - - Returns: - string name of the enum value. - - Raises: - KeyError if either the Enum doesn't exist or the value is not a valid - value for the enum. - """ - return self.enum_types_by_name[enum].values_by_number[value].name - - def CopyToProto(self, proto): - """Copies this to a descriptor_pb2.DescriptorProto. - - Args: - proto: An empty descriptor_pb2.DescriptorProto. - """ - # This function is overridden to give a better doc comment. - super(Descriptor, self).CopyToProto(proto) - - -# TODO(robinson): We should have aggressive checking here, -# for example: -# * If you specify a repeated field, you should not be allowed -# to specify a default value. -# * [Other examples here as needed]. -# -# TODO(robinson): for this and other *Descriptor classes, we -# might also want to lock things down aggressively (e.g., -# prevent clients from setting the attributes). Having -# stronger invariants here in general will reduce the number -# of runtime checks we must do in reflection.py... -class FieldDescriptor(DescriptorBase): - - """Descriptor for a single field in a .proto file. - - Attributes: - name (str): Name of this field, exactly as it appears in .proto. - full_name (str): Name of this field, including containing scope. This is - particularly relevant for extensions. - index (int): Dense, 0-indexed index giving the order that this - field textually appears within its message in the .proto file. - number (int): Tag number declared for this field in the .proto file. - - type (int): (One of the TYPE_* constants below) Declared type. - cpp_type (int): (One of the CPPTYPE_* constants below) C++ type used to - represent this field. - - label (int): (One of the LABEL_* constants below) Tells whether this - field is optional, required, or repeated. - has_default_value (bool): True if this field has a default value defined, - otherwise false. - default_value (Varies): Default value of this field. Only - meaningful for non-repeated scalar fields. Repeated fields - should always set this to [], and non-repeated composite - fields should always set this to None. - - containing_type (Descriptor): Descriptor of the protocol message - type that contains this field. Set by the Descriptor constructor - if we're passed into one. - Somewhat confusingly, for extension fields, this is the - descriptor of the EXTENDED message, not the descriptor - of the message containing this field. (See is_extension and - extension_scope below). - message_type (Descriptor): If a composite field, a descriptor - of the message type contained in this field. Otherwise, this is None. - enum_type (EnumDescriptor): If this field contains an enum, a - descriptor of that enum. Otherwise, this is None. - - is_extension: True iff this describes an extension field. - extension_scope (Descriptor): Only meaningful if is_extension is True. - Gives the message that immediately contains this extension field. - Will be None iff we're a top-level (file-level) extension field. - - options (descriptor_pb2.FieldOptions): Protocol message field options or - None to use default field options. - - containing_oneof (OneofDescriptor): If the field is a member of a oneof - union, contains its descriptor. Otherwise, None. - - file (FileDescriptor): Reference to file descriptor. - """ - - # Must be consistent with C++ FieldDescriptor::Type enum in - # descriptor.h. - # - # TODO(robinson): Find a way to eliminate this repetition. - TYPE_DOUBLE = 1 - TYPE_FLOAT = 2 - TYPE_INT64 = 3 - TYPE_UINT64 = 4 - TYPE_INT32 = 5 - TYPE_FIXED64 = 6 - TYPE_FIXED32 = 7 - TYPE_BOOL = 8 - TYPE_STRING = 9 - TYPE_GROUP = 10 - TYPE_MESSAGE = 11 - TYPE_BYTES = 12 - TYPE_UINT32 = 13 - TYPE_ENUM = 14 - TYPE_SFIXED32 = 15 - TYPE_SFIXED64 = 16 - TYPE_SINT32 = 17 - TYPE_SINT64 = 18 - MAX_TYPE = 18 - - # Must be consistent with C++ FieldDescriptor::CppType enum in - # descriptor.h. - # - # TODO(robinson): Find a way to eliminate this repetition. - CPPTYPE_INT32 = 1 - CPPTYPE_INT64 = 2 - CPPTYPE_UINT32 = 3 - CPPTYPE_UINT64 = 4 - CPPTYPE_DOUBLE = 5 - CPPTYPE_FLOAT = 6 - CPPTYPE_BOOL = 7 - CPPTYPE_ENUM = 8 - CPPTYPE_STRING = 9 - CPPTYPE_MESSAGE = 10 - MAX_CPPTYPE = 10 - - _PYTHON_TO_CPP_PROTO_TYPE_MAP = { - TYPE_DOUBLE: CPPTYPE_DOUBLE, - TYPE_FLOAT: CPPTYPE_FLOAT, - TYPE_ENUM: CPPTYPE_ENUM, - TYPE_INT64: CPPTYPE_INT64, - TYPE_SINT64: CPPTYPE_INT64, - TYPE_SFIXED64: CPPTYPE_INT64, - TYPE_UINT64: CPPTYPE_UINT64, - TYPE_FIXED64: CPPTYPE_UINT64, - TYPE_INT32: CPPTYPE_INT32, - TYPE_SFIXED32: CPPTYPE_INT32, - TYPE_SINT32: CPPTYPE_INT32, - TYPE_UINT32: CPPTYPE_UINT32, - TYPE_FIXED32: CPPTYPE_UINT32, - TYPE_BYTES: CPPTYPE_STRING, - TYPE_STRING: CPPTYPE_STRING, - TYPE_BOOL: CPPTYPE_BOOL, - TYPE_MESSAGE: CPPTYPE_MESSAGE, - TYPE_GROUP: CPPTYPE_MESSAGE - } - - # Must be consistent with C++ FieldDescriptor::Label enum in - # descriptor.h. - # - # TODO(robinson): Find a way to eliminate this repetition. - LABEL_OPTIONAL = 1 - LABEL_REQUIRED = 2 - LABEL_REPEATED = 3 - MAX_LABEL = 3 - - # Must be consistent with C++ constants kMaxNumber, kFirstReservedNumber, - # and kLastReservedNumber in descriptor.h - MAX_FIELD_NUMBER = (1 << 29) - 1 - FIRST_RESERVED_FIELD_NUMBER = 19000 - LAST_RESERVED_FIELD_NUMBER = 19999 - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.FieldDescriptor - - def __new__(cls, name, full_name, index, number, type, cpp_type, label, - default_value, message_type, enum_type, containing_type, - is_extension, extension_scope, options=None, - serialized_options=None, - has_default_value=True, containing_oneof=None, json_name=None, - file=None, create_key=None): # pylint: disable=redefined-builtin - _message.Message._CheckCalledFromGeneratedFile() - if is_extension: - return _message.default_pool.FindExtensionByName(full_name) - else: - return _message.default_pool.FindFieldByName(full_name) - - def __init__(self, name, full_name, index, number, type, cpp_type, label, - default_value, message_type, enum_type, containing_type, - is_extension, extension_scope, options=None, - serialized_options=None, - has_default_value=True, containing_oneof=None, json_name=None, - file=None, create_key=None): # pylint: disable=redefined-builtin - """The arguments are as described in the description of FieldDescriptor - attributes above. - - Note that containing_type may be None, and may be set later if necessary - (to deal with circular references between message types, for example). - Likewise for extension_scope. - """ - if create_key is not _internal_create_key: - _Deprecated('FieldDescriptor') - - super(FieldDescriptor, self).__init__( - options, serialized_options, 'FieldOptions') - self.name = name - self.full_name = full_name - self.file = file - self._camelcase_name = None - if json_name is None: - self.json_name = _ToJsonName(name) - else: - self.json_name = json_name - self.index = index - self.number = number - self.type = type - self.cpp_type = cpp_type - self.label = label - self.has_default_value = has_default_value - self.default_value = default_value - self.containing_type = containing_type - self.message_type = message_type - self.enum_type = enum_type - self.is_extension = is_extension - self.extension_scope = extension_scope - self.containing_oneof = containing_oneof - if api_implementation.Type() == 'cpp': - if is_extension: - self._cdescriptor = _message.default_pool.FindExtensionByName(full_name) - else: - self._cdescriptor = _message.default_pool.FindFieldByName(full_name) - else: - self._cdescriptor = None - - @property - def camelcase_name(self): - """Camelcase name of this field. - - Returns: - str: the name in CamelCase. - """ - if self._camelcase_name is None: - self._camelcase_name = _ToCamelCase(self.name) - return self._camelcase_name - - @property - def has_presence(self): - """Whether the field distinguishes between unpopulated and default values. - - Raises: - RuntimeError: singular field that is not linked with message nor file. - """ - if self.label == FieldDescriptor.LABEL_REPEATED: - return False - if (self.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE or - self.containing_oneof): - return True - if hasattr(self.file, 'syntax'): - return self.file.syntax == 'proto2' - if hasattr(self.message_type, 'syntax'): - return self.message_type.syntax == 'proto2' - raise RuntimeError( - 'has_presence is not ready to use because field %s is not' - ' linked with message type nor file' % self.full_name) - - @staticmethod - def ProtoTypeToCppProtoType(proto_type): - """Converts from a Python proto type to a C++ Proto Type. - - The Python ProtocolBuffer classes specify both the 'Python' datatype and the - 'C++' datatype - and they're not the same. This helper method should - translate from one to another. - - Args: - proto_type: the Python proto type (descriptor.FieldDescriptor.TYPE_*) - Returns: - int: descriptor.FieldDescriptor.CPPTYPE_*, the C++ type. - Raises: - TypeTransformationError: when the Python proto type isn't known. - """ - try: - return FieldDescriptor._PYTHON_TO_CPP_PROTO_TYPE_MAP[proto_type] - except KeyError: - raise TypeTransformationError('Unknown proto_type: %s' % proto_type) - - -class EnumDescriptor(_NestedDescriptorBase): - - """Descriptor for an enum defined in a .proto file. - - Attributes: - name (str): Name of the enum type. - full_name (str): Full name of the type, including package name - and any enclosing type(s). - - values (list[EnumValueDescriptor]): List of the values - in this enum. - values_by_name (dict(str, EnumValueDescriptor)): Same as :attr:`values`, - but indexed by the "name" field of each EnumValueDescriptor. - values_by_number (dict(int, EnumValueDescriptor)): Same as :attr:`values`, - but indexed by the "number" field of each EnumValueDescriptor. - containing_type (Descriptor): Descriptor of the immediate containing - type of this enum, or None if this is an enum defined at the - top level in a .proto file. Set by Descriptor's constructor - if we're passed into one. - file (FileDescriptor): Reference to file descriptor. - options (descriptor_pb2.EnumOptions): Enum options message or - None to use default enum options. - """ - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.EnumDescriptor - - def __new__(cls, name, full_name, filename, values, - containing_type=None, options=None, - serialized_options=None, file=None, # pylint: disable=redefined-builtin - serialized_start=None, serialized_end=None, create_key=None): - _message.Message._CheckCalledFromGeneratedFile() - return _message.default_pool.FindEnumTypeByName(full_name) - - def __init__(self, name, full_name, filename, values, - containing_type=None, options=None, - serialized_options=None, file=None, # pylint: disable=redefined-builtin - serialized_start=None, serialized_end=None, create_key=None): - """Arguments are as described in the attribute description above. - - Note that filename is an obsolete argument, that is not used anymore. - Please use file.name to access this as an attribute. - """ - if create_key is not _internal_create_key: - _Deprecated('EnumDescriptor') - - super(EnumDescriptor, self).__init__( - options, 'EnumOptions', name, full_name, file, - containing_type, serialized_start=serialized_start, - serialized_end=serialized_end, serialized_options=serialized_options) - - self.values = values - for value in self.values: - value.type = self - self.values_by_name = dict((v.name, v) for v in values) - # Values are reversed to ensure that the first alias is retained. - self.values_by_number = dict((v.number, v) for v in reversed(values)) - - def CopyToProto(self, proto): - """Copies this to a descriptor_pb2.EnumDescriptorProto. - - Args: - proto (descriptor_pb2.EnumDescriptorProto): An empty descriptor proto. - """ - # This function is overridden to give a better doc comment. - super(EnumDescriptor, self).CopyToProto(proto) - - -class EnumValueDescriptor(DescriptorBase): - - """Descriptor for a single value within an enum. - - Attributes: - name (str): Name of this value. - index (int): Dense, 0-indexed index giving the order that this - value appears textually within its enum in the .proto file. - number (int): Actual number assigned to this enum value. - type (EnumDescriptor): :class:`EnumDescriptor` to which this value - belongs. Set by :class:`EnumDescriptor`'s constructor if we're - passed into one. - options (descriptor_pb2.EnumValueOptions): Enum value options message or - None to use default enum value options options. - """ - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.EnumValueDescriptor - - def __new__(cls, name, index, number, - type=None, # pylint: disable=redefined-builtin - options=None, serialized_options=None, create_key=None): - _message.Message._CheckCalledFromGeneratedFile() - # There is no way we can build a complete EnumValueDescriptor with the - # given parameters (the name of the Enum is not known, for example). - # Fortunately generated files just pass it to the EnumDescriptor() - # constructor, which will ignore it, so returning None is good enough. - return None - - def __init__(self, name, index, number, - type=None, # pylint: disable=redefined-builtin - options=None, serialized_options=None, create_key=None): - """Arguments are as described in the attribute description above.""" - if create_key is not _internal_create_key: - _Deprecated('EnumValueDescriptor') - - super(EnumValueDescriptor, self).__init__( - options, serialized_options, 'EnumValueOptions') - self.name = name - self.index = index - self.number = number - self.type = type - - -class OneofDescriptor(DescriptorBase): - """Descriptor for a oneof field. - - Attributes: - name (str): Name of the oneof field. - full_name (str): Full name of the oneof field, including package name. - index (int): 0-based index giving the order of the oneof field inside - its containing type. - containing_type (Descriptor): :class:`Descriptor` of the protocol message - type that contains this field. Set by the :class:`Descriptor` constructor - if we're passed into one. - fields (list[FieldDescriptor]): The list of field descriptors this - oneof can contain. - """ - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.OneofDescriptor - - def __new__( - cls, name, full_name, index, containing_type, fields, options=None, - serialized_options=None, create_key=None): - _message.Message._CheckCalledFromGeneratedFile() - return _message.default_pool.FindOneofByName(full_name) - - def __init__( - self, name, full_name, index, containing_type, fields, options=None, - serialized_options=None, create_key=None): - """Arguments are as described in the attribute description above.""" - if create_key is not _internal_create_key: - _Deprecated('OneofDescriptor') - - super(OneofDescriptor, self).__init__( - options, serialized_options, 'OneofOptions') - self.name = name - self.full_name = full_name - self.index = index - self.containing_type = containing_type - self.fields = fields - - -class ServiceDescriptor(_NestedDescriptorBase): - - """Descriptor for a service. - - Attributes: - name (str): Name of the service. - full_name (str): Full name of the service, including package name. - index (int): 0-indexed index giving the order that this services - definition appears within the .proto file. - methods (list[MethodDescriptor]): List of methods provided by this - service. - methods_by_name (dict(str, MethodDescriptor)): Same - :class:`MethodDescriptor` objects as in :attr:`methods_by_name`, but - indexed by "name" attribute in each :class:`MethodDescriptor`. - options (descriptor_pb2.ServiceOptions): Service options message or - None to use default service options. - file (FileDescriptor): Reference to file info. - """ - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.ServiceDescriptor - - def __new__( - cls, - name=None, - full_name=None, - index=None, - methods=None, - options=None, - serialized_options=None, - file=None, # pylint: disable=redefined-builtin - serialized_start=None, - serialized_end=None, - create_key=None): - _message.Message._CheckCalledFromGeneratedFile() # pylint: disable=protected-access - return _message.default_pool.FindServiceByName(full_name) - - def __init__(self, name, full_name, index, methods, options=None, - serialized_options=None, file=None, # pylint: disable=redefined-builtin - serialized_start=None, serialized_end=None, create_key=None): - if create_key is not _internal_create_key: - _Deprecated('ServiceDescriptor') - - super(ServiceDescriptor, self).__init__( - options, 'ServiceOptions', name, full_name, file, - None, serialized_start=serialized_start, - serialized_end=serialized_end, serialized_options=serialized_options) - self.index = index - self.methods = methods - self.methods_by_name = dict((m.name, m) for m in methods) - # Set the containing service for each method in this service. - for method in self.methods: - method.containing_service = self - - def FindMethodByName(self, name): - """Searches for the specified method, and returns its descriptor. - - Args: - name (str): Name of the method. - Returns: - MethodDescriptor or None: the descriptor for the requested method, if - found. - """ - return self.methods_by_name.get(name, None) - - def CopyToProto(self, proto): - """Copies this to a descriptor_pb2.ServiceDescriptorProto. - - Args: - proto (descriptor_pb2.ServiceDescriptorProto): An empty descriptor proto. - """ - # This function is overridden to give a better doc comment. - super(ServiceDescriptor, self).CopyToProto(proto) - - -class MethodDescriptor(DescriptorBase): - - """Descriptor for a method in a service. - - Attributes: - name (str): Name of the method within the service. - full_name (str): Full name of method. - index (int): 0-indexed index of the method inside the service. - containing_service (ServiceDescriptor): The service that contains this - method. - input_type (Descriptor): The descriptor of the message that this method - accepts. - output_type (Descriptor): The descriptor of the message that this method - returns. - client_streaming (bool): Whether this method uses client streaming. - server_streaming (bool): Whether this method uses server streaming. - options (descriptor_pb2.MethodOptions or None): Method options message, or - None to use default method options. - """ - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.MethodDescriptor - - def __new__(cls, - name, - full_name, - index, - containing_service, - input_type, - output_type, - client_streaming=False, - server_streaming=False, - options=None, - serialized_options=None, - create_key=None): - _message.Message._CheckCalledFromGeneratedFile() # pylint: disable=protected-access - return _message.default_pool.FindMethodByName(full_name) - - def __init__(self, - name, - full_name, - index, - containing_service, - input_type, - output_type, - client_streaming=False, - server_streaming=False, - options=None, - serialized_options=None, - create_key=None): - """The arguments are as described in the description of MethodDescriptor - attributes above. - - Note that containing_service may be None, and may be set later if necessary. - """ - if create_key is not _internal_create_key: - _Deprecated('MethodDescriptor') - - super(MethodDescriptor, self).__init__( - options, serialized_options, 'MethodOptions') - self.name = name - self.full_name = full_name - self.index = index - self.containing_service = containing_service - self.input_type = input_type - self.output_type = output_type - self.client_streaming = client_streaming - self.server_streaming = server_streaming - - def CopyToProto(self, proto): - """Copies this to a descriptor_pb2.MethodDescriptorProto. - - Args: - proto (descriptor_pb2.MethodDescriptorProto): An empty descriptor proto. - - Raises: - Error: If self couldn't be serialized, due to too few constructor - arguments. - """ - if self.containing_service is not None: - from opensafely._vendor.google.protobuf import descriptor_pb2 - service_proto = descriptor_pb2.ServiceDescriptorProto() - self.containing_service.CopyToProto(service_proto) - proto.CopyFrom(service_proto.method[self.index]) - else: - raise Error('Descriptor does not contain a service.') - - -class FileDescriptor(DescriptorBase): - """Descriptor for a file. Mimics the descriptor_pb2.FileDescriptorProto. - - Note that :attr:`enum_types_by_name`, :attr:`extensions_by_name`, and - :attr:`dependencies` fields are only set by the - :py:mod:`google.protobuf.message_factory` module, and not by the generated - proto code. - - Attributes: - name (str): Name of file, relative to root of source tree. - package (str): Name of the package - syntax (str): string indicating syntax of the file (can be "proto2" or - "proto3") - serialized_pb (bytes): Byte string of serialized - :class:`descriptor_pb2.FileDescriptorProto`. - dependencies (list[FileDescriptor]): List of other :class:`FileDescriptor` - objects this :class:`FileDescriptor` depends on. - public_dependencies (list[FileDescriptor]): A subset of - :attr:`dependencies`, which were declared as "public". - message_types_by_name (dict(str, Descriptor)): Mapping from message names - to their :class:`Descriptor`. - enum_types_by_name (dict(str, EnumDescriptor)): Mapping from enum names to - their :class:`EnumDescriptor`. - extensions_by_name (dict(str, FieldDescriptor)): Mapping from extension - names declared at file scope to their :class:`FieldDescriptor`. - services_by_name (dict(str, ServiceDescriptor)): Mapping from services' - names to their :class:`ServiceDescriptor`. - pool (DescriptorPool): The pool this descriptor belongs to. When not - passed to the constructor, the global default pool is used. - """ - - if _USE_C_DESCRIPTORS: - _C_DESCRIPTOR_CLASS = _message.FileDescriptor - - def __new__(cls, name, package, options=None, - serialized_options=None, serialized_pb=None, - dependencies=None, public_dependencies=None, - syntax=None, pool=None, create_key=None): - # FileDescriptor() is called from various places, not only from generated - # files, to register dynamic proto files and messages. - # pylint: disable=g-explicit-bool-comparison - if serialized_pb == b'': - # Cpp generated code must be linked in if serialized_pb is '' - try: - return _message.default_pool.FindFileByName(name) - except KeyError: - raise RuntimeError('Please link in cpp generated lib for %s' % (name)) - elif serialized_pb: - return _message.default_pool.AddSerializedFile(serialized_pb) - else: - return super(FileDescriptor, cls).__new__(cls) - - def __init__(self, name, package, options=None, - serialized_options=None, serialized_pb=None, - dependencies=None, public_dependencies=None, - syntax=None, pool=None, create_key=None): - """Constructor.""" - if create_key is not _internal_create_key: - _Deprecated('FileDescriptor') - - super(FileDescriptor, self).__init__( - options, serialized_options, 'FileOptions') - - if pool is None: - from opensafely._vendor.google.protobuf import descriptor_pool - pool = descriptor_pool.Default() - self.pool = pool - self.message_types_by_name = {} - self.name = name - self.package = package - self.syntax = syntax or "proto2" - self.serialized_pb = serialized_pb - - self.enum_types_by_name = {} - self.extensions_by_name = {} - self.services_by_name = {} - self.dependencies = (dependencies or []) - self.public_dependencies = (public_dependencies or []) - - def CopyToProto(self, proto): - """Copies this to a descriptor_pb2.FileDescriptorProto. - - Args: - proto: An empty descriptor_pb2.FileDescriptorProto. - """ - proto.ParseFromString(self.serialized_pb) - - -def _ParseOptions(message, string): - """Parses serialized options. - - This helper function is used to parse serialized options in generated - proto2 files. It must not be used outside proto2. - """ - message.ParseFromString(string) - return message - - -def _ToCamelCase(name): - """Converts name to camel-case and returns it.""" - capitalize_next = False - result = [] - - for c in name: - if c == '_': - if result: - capitalize_next = True - elif capitalize_next: - result.append(c.upper()) - capitalize_next = False - else: - result += c - - # Lower-case the first letter. - if result and result[0].isupper(): - result[0] = result[0].lower() - return ''.join(result) - - -def _OptionsOrNone(descriptor_proto): - """Returns the value of the field `options`, or None if it is not set.""" - if descriptor_proto.HasField('options'): - return descriptor_proto.options - else: - return None - - -def _ToJsonName(name): - """Converts name to Json name and returns it.""" - capitalize_next = False - result = [] - - for c in name: - if c == '_': - capitalize_next = True - elif capitalize_next: - result.append(c.upper()) - capitalize_next = False - else: - result += c - - return ''.join(result) - - -def MakeDescriptor(desc_proto, package='', build_file_if_cpp=True, - syntax=None): - """Make a protobuf Descriptor given a DescriptorProto protobuf. - - Handles nested descriptors. Note that this is limited to the scope of defining - a message inside of another message. Composite fields can currently only be - resolved if the message is defined in the same scope as the field. - - Args: - desc_proto: The descriptor_pb2.DescriptorProto protobuf message. - package: Optional package name for the new message Descriptor (string). - build_file_if_cpp: Update the C++ descriptor pool if api matches. - Set to False on recursion, so no duplicates are created. - syntax: The syntax/semantics that should be used. Set to "proto3" to get - proto3 field presence semantics. - Returns: - A Descriptor for protobuf messages. - """ - if api_implementation.Type() == 'cpp' and build_file_if_cpp: - # The C++ implementation requires all descriptors to be backed by the same - # definition in the C++ descriptor pool. To do this, we build a - # FileDescriptorProto with the same definition as this descriptor and build - # it into the pool. - from opensafely._vendor.google.protobuf import descriptor_pb2 - file_descriptor_proto = descriptor_pb2.FileDescriptorProto() - file_descriptor_proto.message_type.add().MergeFrom(desc_proto) - - # Generate a random name for this proto file to prevent conflicts with any - # imported ones. We need to specify a file name so the descriptor pool - # accepts our FileDescriptorProto, but it is not important what that file - # name is actually set to. - proto_name = binascii.hexlify(os.urandom(16)).decode('ascii') - - if package: - file_descriptor_proto.name = os.path.join(package.replace('.', '/'), - proto_name + '.proto') - file_descriptor_proto.package = package - else: - file_descriptor_proto.name = proto_name + '.proto' - - _message.default_pool.Add(file_descriptor_proto) - result = _message.default_pool.FindFileByName(file_descriptor_proto.name) - - if _USE_C_DESCRIPTORS: - return result.message_types_by_name[desc_proto.name] - - full_message_name = [desc_proto.name] - if package: full_message_name.insert(0, package) - - # Create Descriptors for enum types - enum_types = {} - for enum_proto in desc_proto.enum_type: - full_name = '.'.join(full_message_name + [enum_proto.name]) - enum_desc = EnumDescriptor( - enum_proto.name, full_name, None, [ - EnumValueDescriptor(enum_val.name, ii, enum_val.number, - create_key=_internal_create_key) - for ii, enum_val in enumerate(enum_proto.value)], - create_key=_internal_create_key) - enum_types[full_name] = enum_desc - - # Create Descriptors for nested types - nested_types = {} - for nested_proto in desc_proto.nested_type: - full_name = '.'.join(full_message_name + [nested_proto.name]) - # Nested types are just those defined inside of the message, not all types - # used by fields in the message, so no loops are possible here. - nested_desc = MakeDescriptor(nested_proto, - package='.'.join(full_message_name), - build_file_if_cpp=False, - syntax=syntax) - nested_types[full_name] = nested_desc - - fields = [] - for field_proto in desc_proto.field: - full_name = '.'.join(full_message_name + [field_proto.name]) - enum_desc = None - nested_desc = None - if field_proto.json_name: - json_name = field_proto.json_name - else: - json_name = None - if field_proto.HasField('type_name'): - type_name = field_proto.type_name - full_type_name = '.'.join(full_message_name + - [type_name[type_name.rfind('.')+1:]]) - if full_type_name in nested_types: - nested_desc = nested_types[full_type_name] - elif full_type_name in enum_types: - enum_desc = enum_types[full_type_name] - # Else type_name references a non-local type, which isn't implemented - field = FieldDescriptor( - field_proto.name, full_name, field_proto.number - 1, - field_proto.number, field_proto.type, - FieldDescriptor.ProtoTypeToCppProtoType(field_proto.type), - field_proto.label, None, nested_desc, enum_desc, None, False, None, - options=_OptionsOrNone(field_proto), has_default_value=False, - json_name=json_name, create_key=_internal_create_key) - fields.append(field) - - desc_name = '.'.join(full_message_name) - return Descriptor(desc_proto.name, desc_name, None, None, fields, - list(nested_types.values()), list(enum_types.values()), [], - options=_OptionsOrNone(desc_proto), - create_key=_internal_create_key) diff --git a/opensafely/_vendor/google/protobuf/descriptor_database.py b/opensafely/_vendor/google/protobuf/descriptor_database.py deleted file mode 100644 index 073eddc7..00000000 --- a/opensafely/_vendor/google/protobuf/descriptor_database.py +++ /dev/null @@ -1,177 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Provides a container for DescriptorProtos.""" - -__author__ = 'matthewtoia@google.com (Matt Toia)' - -import warnings - - -class Error(Exception): - pass - - -class DescriptorDatabaseConflictingDefinitionError(Error): - """Raised when a proto is added with the same name & different descriptor.""" - - -class DescriptorDatabase(object): - """A container accepting FileDescriptorProtos and maps DescriptorProtos.""" - - def __init__(self): - self._file_desc_protos_by_file = {} - self._file_desc_protos_by_symbol = {} - - def Add(self, file_desc_proto): - """Adds the FileDescriptorProto and its types to this database. - - Args: - file_desc_proto: The FileDescriptorProto to add. - Raises: - DescriptorDatabaseConflictingDefinitionError: if an attempt is made to - add a proto with the same name but different definition than an - existing proto in the database. - """ - proto_name = file_desc_proto.name - if proto_name not in self._file_desc_protos_by_file: - self._file_desc_protos_by_file[proto_name] = file_desc_proto - elif self._file_desc_protos_by_file[proto_name] != file_desc_proto: - raise DescriptorDatabaseConflictingDefinitionError( - '%s already added, but with different descriptor.' % proto_name) - else: - return - - # Add all the top-level descriptors to the index. - package = file_desc_proto.package - for message in file_desc_proto.message_type: - for name in _ExtractSymbols(message, package): - self._AddSymbol(name, file_desc_proto) - for enum in file_desc_proto.enum_type: - self._AddSymbol(('.'.join((package, enum.name))), file_desc_proto) - for enum_value in enum.value: - self._file_desc_protos_by_symbol[ - '.'.join((package, enum_value.name))] = file_desc_proto - for extension in file_desc_proto.extension: - self._AddSymbol(('.'.join((package, extension.name))), file_desc_proto) - for service in file_desc_proto.service: - self._AddSymbol(('.'.join((package, service.name))), file_desc_proto) - - def FindFileByName(self, name): - """Finds the file descriptor proto by file name. - - Typically the file name is a relative path ending to a .proto file. The - proto with the given name will have to have been added to this database - using the Add method or else an error will be raised. - - Args: - name: The file name to find. - - Returns: - The file descriptor proto matching the name. - - Raises: - KeyError if no file by the given name was added. - """ - - return self._file_desc_protos_by_file[name] - - def FindFileContainingSymbol(self, symbol): - """Finds the file descriptor proto containing the specified symbol. - - The symbol should be a fully qualified name including the file descriptor's - package and any containing messages. Some examples: - - 'some.package.name.Message' - 'some.package.name.Message.NestedEnum' - 'some.package.name.Message.some_field' - - The file descriptor proto containing the specified symbol must be added to - this database using the Add method or else an error will be raised. - - Args: - symbol: The fully qualified symbol name. - - Returns: - The file descriptor proto containing the symbol. - - Raises: - KeyError if no file contains the specified symbol. - """ - try: - return self._file_desc_protos_by_symbol[symbol] - except KeyError: - # Fields, enum values, and nested extensions are not in - # _file_desc_protos_by_symbol. Try to find the top level - # descriptor. Non-existent nested symbol under a valid top level - # descriptor can also be found. The behavior is the same with - # protobuf C++. - top_level, _, _ = symbol.rpartition('.') - try: - return self._file_desc_protos_by_symbol[top_level] - except KeyError: - # Raise the original symbol as a KeyError for better diagnostics. - raise KeyError(symbol) - - def FindFileContainingExtension(self, extendee_name, extension_number): - # TODO(jieluo): implement this API. - return None - - def FindAllExtensionNumbers(self, extendee_name): - # TODO(jieluo): implement this API. - return [] - - def _AddSymbol(self, name, file_desc_proto): - if name in self._file_desc_protos_by_symbol: - warn_msg = ('Conflict register for file "' + file_desc_proto.name + - '": ' + name + - ' is already defined in file "' + - self._file_desc_protos_by_symbol[name].name + '"') - warnings.warn(warn_msg, RuntimeWarning) - self._file_desc_protos_by_symbol[name] = file_desc_proto - - -def _ExtractSymbols(desc_proto, package): - """Pulls out all the symbols from a descriptor proto. - - Args: - desc_proto: The proto to extract symbols from. - package: The package containing the descriptor type. - - Yields: - The fully qualified name found in the descriptor. - """ - message_name = package + '.' + desc_proto.name if package else desc_proto.name - yield message_name - for nested_type in desc_proto.nested_type: - for symbol in _ExtractSymbols(nested_type, message_name): - yield symbol - for enum_type in desc_proto.enum_type: - yield '.'.join((message_name, enum_type.name)) diff --git a/opensafely/_vendor/google/protobuf/descriptor_pb2.py b/opensafely/_vendor/google/protobuf/descriptor_pb2.py deleted file mode 100644 index 8e4162be..00000000 --- a/opensafely/_vendor/google/protobuf/descriptor_pb2.py +++ /dev/null @@ -1,1925 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -if _descriptor._USE_C_DESCRIPTORS == False: - DESCRIPTOR = _descriptor.FileDescriptor( - name='google/protobuf/descriptor.proto', - package='google.protobuf', - syntax='proto2', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"G\n\x11\x46ileDescriptorSet\x12\x32\n\x04\x66ile\x18\x01 \x03(\x0b\x32$.google.protobuf.FileDescriptorProto\"\xdb\x03\n\x13\x46ileDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07package\x18\x02 \x01(\t\x12\x12\n\ndependency\x18\x03 \x03(\t\x12\x19\n\x11public_dependency\x18\n \x03(\x05\x12\x17\n\x0fweak_dependency\x18\x0b \x03(\x05\x12\x36\n\x0cmessage_type\x18\x04 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x05 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12\x38\n\x07service\x18\x06 \x03(\x0b\x32\'.google.protobuf.ServiceDescriptorProto\x12\x38\n\textension\x18\x07 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12-\n\x07options\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.FileOptions\x12\x39\n\x10source_code_info\x18\t \x01(\x0b\x32\x1f.google.protobuf.SourceCodeInfo\x12\x0e\n\x06syntax\x18\x0c \x01(\t\"\xa9\x05\n\x0f\x44\x65scriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x34\n\x05\x66ield\x18\x02 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x38\n\textension\x18\x06 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x35\n\x0bnested_type\x18\x03 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x04 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12H\n\x0f\x65xtension_range\x18\x05 \x03(\x0b\x32/.google.protobuf.DescriptorProto.ExtensionRange\x12\x39\n\noneof_decl\x18\x08 \x03(\x0b\x32%.google.protobuf.OneofDescriptorProto\x12\x30\n\x07options\x18\x07 \x01(\x0b\x32\x1f.google.protobuf.MessageOptions\x12\x46\n\x0ereserved_range\x18\t \x03(\x0b\x32..google.protobuf.DescriptorProto.ReservedRange\x12\x15\n\rreserved_name\x18\n \x03(\t\x1a\x65\n\x0e\x45xtensionRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\x12\x37\n\x07options\x18\x03 \x01(\x0b\x32&.google.protobuf.ExtensionRangeOptions\x1a+\n\rReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"g\n\x15\x45xtensionRangeOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xd5\x05\n\x14\x46ieldDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x03 \x01(\x05\x12:\n\x05label\x18\x04 \x01(\x0e\x32+.google.protobuf.FieldDescriptorProto.Label\x12\x38\n\x04type\x18\x05 \x01(\x0e\x32*.google.protobuf.FieldDescriptorProto.Type\x12\x11\n\ttype_name\x18\x06 \x01(\t\x12\x10\n\x08\x65xtendee\x18\x02 \x01(\t\x12\x15\n\rdefault_value\x18\x07 \x01(\t\x12\x13\n\x0boneof_index\x18\t \x01(\x05\x12\x11\n\tjson_name\x18\n \x01(\t\x12.\n\x07options\x18\x08 \x01(\x0b\x32\x1d.google.protobuf.FieldOptions\x12\x17\n\x0fproto3_optional\x18\x11 \x01(\x08\"\xb6\x02\n\x04Type\x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\x05Label\x12\x12\n\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REQUIRED\x10\x02\x12\x12\n\x0eLABEL_REPEATED\x10\x03\"T\n\x14OneofDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x07options\x18\x02 \x01(\x0b\x32\x1d.google.protobuf.OneofOptions\"\xa4\x02\n\x13\x45numDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x03(\x0b\x32).google.protobuf.EnumValueDescriptorProto\x12-\n\x07options\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.EnumOptions\x12N\n\x0ereserved_range\x18\x04 \x03(\x0b\x32\x36.google.protobuf.EnumDescriptorProto.EnumReservedRange\x12\x15\n\rreserved_name\x18\x05 \x03(\t\x1a/\n\x11\x45numReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"l\n\x18\x45numValueDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\x05\x12\x32\n\x07options\x18\x03 \x01(\x0b\x32!.google.protobuf.EnumValueOptions\"\x90\x01\n\x16ServiceDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x36\n\x06method\x18\x02 \x03(\x0b\x32&.google.protobuf.MethodDescriptorProto\x12\x30\n\x07options\x18\x03 \x01(\x0b\x32\x1f.google.protobuf.ServiceOptions\"\xc1\x01\n\x15MethodDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ninput_type\x18\x02 \x01(\t\x12\x13\n\x0boutput_type\x18\x03 \x01(\t\x12/\n\x07options\x18\x04 \x01(\x0b\x32\x1e.google.protobuf.MethodOptions\x12\x1f\n\x10\x63lient_streaming\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x10server_streaming\x18\x06 \x01(\x08:\x05\x66\x61lse\"\xa5\x06\n\x0b\x46ileOptions\x12\x14\n\x0cjava_package\x18\x01 \x01(\t\x12\x1c\n\x14java_outer_classname\x18\x08 \x01(\t\x12\"\n\x13java_multiple_files\x18\n \x01(\x08:\x05\x66\x61lse\x12)\n\x1djava_generate_equals_and_hash\x18\x14 \x01(\x08\x42\x02\x18\x01\x12%\n\x16java_string_check_utf8\x18\x1b \x01(\x08:\x05\x66\x61lse\x12\x46\n\x0coptimize_for\x18\t \x01(\x0e\x32).google.protobuf.FileOptions.OptimizeMode:\x05SPEED\x12\x12\n\ngo_package\x18\x0b \x01(\t\x12\"\n\x13\x63\x63_generic_services\x18\x10 \x01(\x08:\x05\x66\x61lse\x12$\n\x15java_generic_services\x18\x11 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13py_generic_services\x18\x12 \x01(\x08:\x05\x66\x61lse\x12#\n\x14php_generic_services\x18* \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x10\x63\x63_enable_arenas\x18\x1f \x01(\x08:\x04true\x12\x19\n\x11objc_class_prefix\x18$ \x01(\t\x12\x18\n\x10\x63sharp_namespace\x18% \x01(\t\x12\x14\n\x0cswift_prefix\x18\' \x01(\t\x12\x18\n\x10php_class_prefix\x18( \x01(\t\x12\x15\n\rphp_namespace\x18) \x01(\t\x12\x1e\n\x16php_metadata_namespace\x18, \x01(\t\x12\x14\n\x0cruby_package\x18- \x01(\t\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\":\n\x0cOptimizeMode\x12\t\n\x05SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02\x12\x10\n\x0cLITE_RUNTIME\x10\x03*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08&\x10\'\"\x84\x02\n\x0eMessageOptions\x12&\n\x17message_set_wire_format\x18\x01 \x01(\x08:\x05\x66\x61lse\x12.\n\x1fno_standard_descriptor_accessor\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x11\n\tmap_entry\x18\x07 \x01(\x08\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xbe\x03\n\x0c\x46ieldOptions\x12:\n\x05\x63type\x18\x01 \x01(\x0e\x32#.google.protobuf.FieldOptions.CType:\x06STRING\x12\x0e\n\x06packed\x18\x02 \x01(\x08\x12?\n\x06jstype\x18\x06 \x01(\x0e\x32$.google.protobuf.FieldOptions.JSType:\tJS_NORMAL\x12\x13\n\x04lazy\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x0funverified_lazy\x18\x0f \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x13\n\x04weak\x18\n \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"/\n\x05\x43Type\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x43ORD\x10\x01\x12\x10\n\x0cSTRING_PIECE\x10\x02\"5\n\x06JSType\x12\r\n\tJS_NORMAL\x10\x00\x12\r\n\tJS_STRING\x10\x01\x12\r\n\tJS_NUMBER\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05\"^\n\x0cOneofOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x93\x01\n\x0b\x45numOptions\x12\x13\n\x0b\x61llow_alias\x18\x02 \x01(\x08\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x05\x10\x06\"}\n\x10\x45numValueOptions\x12\x19\n\ndeprecated\x18\x01 \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"{\n\x0eServiceOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xad\x02\n\rMethodOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12_\n\x11idempotency_level\x18\" \x01(\x0e\x32/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UNKNOWN\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"P\n\x10IdempotencyLevel\x12\x17\n\x13IDEMPOTENCY_UNKNOWN\x10\x00\x12\x13\n\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n\nIDEMPOTENT\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9e\x02\n\x13UninterpretedOption\x12;\n\x04name\x18\x02 \x03(\x0b\x32-.google.protobuf.UninterpretedOption.NamePart\x12\x18\n\x10identifier_value\x18\x03 \x01(\t\x12\x1a\n\x12positive_int_value\x18\x04 \x01(\x04\x12\x1a\n\x12negative_int_value\x18\x05 \x01(\x03\x12\x14\n\x0c\x64ouble_value\x18\x06 \x01(\x01\x12\x14\n\x0cstring_value\x18\x07 \x01(\x0c\x12\x17\n\x0f\x61ggregate_value\x18\x08 \x01(\t\x1a\x33\n\x08NamePart\x12\x11\n\tname_part\x18\x01 \x02(\t\x12\x14\n\x0cis_extension\x18\x02 \x02(\x08\"\xd5\x01\n\x0eSourceCodeInfo\x12:\n\x08location\x18\x01 \x03(\x0b\x32(.google.protobuf.SourceCodeInfo.Location\x1a\x86\x01\n\x08Location\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x10\n\x04span\x18\x02 \x03(\x05\x42\x02\x10\x01\x12\x18\n\x10leading_comments\x18\x03 \x01(\t\x12\x19\n\x11trailing_comments\x18\x04 \x01(\t\x12!\n\x19leading_detached_comments\x18\x06 \x03(\t\"\xa7\x01\n\x11GeneratedCodeInfo\x12\x41\n\nannotation\x18\x01 \x03(\x0b\x32-.google.protobuf.GeneratedCodeInfo.Annotation\x1aO\n\nAnnotation\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bsource_file\x18\x02 \x01(\t\x12\r\n\x05\x62\x65gin\x18\x03 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x05\x42~\n\x13\x63om.google.protobufB\x10\x44\x65scriptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.Reflection' - ) -else: - DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"G\n\x11\x46ileDescriptorSet\x12\x32\n\x04\x66ile\x18\x01 \x03(\x0b\x32$.google.protobuf.FileDescriptorProto\"\xdb\x03\n\x13\x46ileDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07package\x18\x02 \x01(\t\x12\x12\n\ndependency\x18\x03 \x03(\t\x12\x19\n\x11public_dependency\x18\n \x03(\x05\x12\x17\n\x0fweak_dependency\x18\x0b \x03(\x05\x12\x36\n\x0cmessage_type\x18\x04 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x05 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12\x38\n\x07service\x18\x06 \x03(\x0b\x32\'.google.protobuf.ServiceDescriptorProto\x12\x38\n\textension\x18\x07 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12-\n\x07options\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.FileOptions\x12\x39\n\x10source_code_info\x18\t \x01(\x0b\x32\x1f.google.protobuf.SourceCodeInfo\x12\x0e\n\x06syntax\x18\x0c \x01(\t\"\xa9\x05\n\x0f\x44\x65scriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x34\n\x05\x66ield\x18\x02 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x38\n\textension\x18\x06 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x35\n\x0bnested_type\x18\x03 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x04 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12H\n\x0f\x65xtension_range\x18\x05 \x03(\x0b\x32/.google.protobuf.DescriptorProto.ExtensionRange\x12\x39\n\noneof_decl\x18\x08 \x03(\x0b\x32%.google.protobuf.OneofDescriptorProto\x12\x30\n\x07options\x18\x07 \x01(\x0b\x32\x1f.google.protobuf.MessageOptions\x12\x46\n\x0ereserved_range\x18\t \x03(\x0b\x32..google.protobuf.DescriptorProto.ReservedRange\x12\x15\n\rreserved_name\x18\n \x03(\t\x1a\x65\n\x0e\x45xtensionRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\x12\x37\n\x07options\x18\x03 \x01(\x0b\x32&.google.protobuf.ExtensionRangeOptions\x1a+\n\rReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"g\n\x15\x45xtensionRangeOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xd5\x05\n\x14\x46ieldDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x03 \x01(\x05\x12:\n\x05label\x18\x04 \x01(\x0e\x32+.google.protobuf.FieldDescriptorProto.Label\x12\x38\n\x04type\x18\x05 \x01(\x0e\x32*.google.protobuf.FieldDescriptorProto.Type\x12\x11\n\ttype_name\x18\x06 \x01(\t\x12\x10\n\x08\x65xtendee\x18\x02 \x01(\t\x12\x15\n\rdefault_value\x18\x07 \x01(\t\x12\x13\n\x0boneof_index\x18\t \x01(\x05\x12\x11\n\tjson_name\x18\n \x01(\t\x12.\n\x07options\x18\x08 \x01(\x0b\x32\x1d.google.protobuf.FieldOptions\x12\x17\n\x0fproto3_optional\x18\x11 \x01(\x08\"\xb6\x02\n\x04Type\x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\x05Label\x12\x12\n\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REQUIRED\x10\x02\x12\x12\n\x0eLABEL_REPEATED\x10\x03\"T\n\x14OneofDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x07options\x18\x02 \x01(\x0b\x32\x1d.google.protobuf.OneofOptions\"\xa4\x02\n\x13\x45numDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x03(\x0b\x32).google.protobuf.EnumValueDescriptorProto\x12-\n\x07options\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.EnumOptions\x12N\n\x0ereserved_range\x18\x04 \x03(\x0b\x32\x36.google.protobuf.EnumDescriptorProto.EnumReservedRange\x12\x15\n\rreserved_name\x18\x05 \x03(\t\x1a/\n\x11\x45numReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"l\n\x18\x45numValueDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\x05\x12\x32\n\x07options\x18\x03 \x01(\x0b\x32!.google.protobuf.EnumValueOptions\"\x90\x01\n\x16ServiceDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x36\n\x06method\x18\x02 \x03(\x0b\x32&.google.protobuf.MethodDescriptorProto\x12\x30\n\x07options\x18\x03 \x01(\x0b\x32\x1f.google.protobuf.ServiceOptions\"\xc1\x01\n\x15MethodDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ninput_type\x18\x02 \x01(\t\x12\x13\n\x0boutput_type\x18\x03 \x01(\t\x12/\n\x07options\x18\x04 \x01(\x0b\x32\x1e.google.protobuf.MethodOptions\x12\x1f\n\x10\x63lient_streaming\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x10server_streaming\x18\x06 \x01(\x08:\x05\x66\x61lse\"\xa5\x06\n\x0b\x46ileOptions\x12\x14\n\x0cjava_package\x18\x01 \x01(\t\x12\x1c\n\x14java_outer_classname\x18\x08 \x01(\t\x12\"\n\x13java_multiple_files\x18\n \x01(\x08:\x05\x66\x61lse\x12)\n\x1djava_generate_equals_and_hash\x18\x14 \x01(\x08\x42\x02\x18\x01\x12%\n\x16java_string_check_utf8\x18\x1b \x01(\x08:\x05\x66\x61lse\x12\x46\n\x0coptimize_for\x18\t \x01(\x0e\x32).google.protobuf.FileOptions.OptimizeMode:\x05SPEED\x12\x12\n\ngo_package\x18\x0b \x01(\t\x12\"\n\x13\x63\x63_generic_services\x18\x10 \x01(\x08:\x05\x66\x61lse\x12$\n\x15java_generic_services\x18\x11 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13py_generic_services\x18\x12 \x01(\x08:\x05\x66\x61lse\x12#\n\x14php_generic_services\x18* \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x10\x63\x63_enable_arenas\x18\x1f \x01(\x08:\x04true\x12\x19\n\x11objc_class_prefix\x18$ \x01(\t\x12\x18\n\x10\x63sharp_namespace\x18% \x01(\t\x12\x14\n\x0cswift_prefix\x18\' \x01(\t\x12\x18\n\x10php_class_prefix\x18( \x01(\t\x12\x15\n\rphp_namespace\x18) \x01(\t\x12\x1e\n\x16php_metadata_namespace\x18, \x01(\t\x12\x14\n\x0cruby_package\x18- \x01(\t\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\":\n\x0cOptimizeMode\x12\t\n\x05SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02\x12\x10\n\x0cLITE_RUNTIME\x10\x03*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08&\x10\'\"\x84\x02\n\x0eMessageOptions\x12&\n\x17message_set_wire_format\x18\x01 \x01(\x08:\x05\x66\x61lse\x12.\n\x1fno_standard_descriptor_accessor\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x11\n\tmap_entry\x18\x07 \x01(\x08\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xbe\x03\n\x0c\x46ieldOptions\x12:\n\x05\x63type\x18\x01 \x01(\x0e\x32#.google.protobuf.FieldOptions.CType:\x06STRING\x12\x0e\n\x06packed\x18\x02 \x01(\x08\x12?\n\x06jstype\x18\x06 \x01(\x0e\x32$.google.protobuf.FieldOptions.JSType:\tJS_NORMAL\x12\x13\n\x04lazy\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x0funverified_lazy\x18\x0f \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x13\n\x04weak\x18\n \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"/\n\x05\x43Type\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x43ORD\x10\x01\x12\x10\n\x0cSTRING_PIECE\x10\x02\"5\n\x06JSType\x12\r\n\tJS_NORMAL\x10\x00\x12\r\n\tJS_STRING\x10\x01\x12\r\n\tJS_NUMBER\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05\"^\n\x0cOneofOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x93\x01\n\x0b\x45numOptions\x12\x13\n\x0b\x61llow_alias\x18\x02 \x01(\x08\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x05\x10\x06\"}\n\x10\x45numValueOptions\x12\x19\n\ndeprecated\x18\x01 \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"{\n\x0eServiceOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xad\x02\n\rMethodOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12_\n\x11idempotency_level\x18\" \x01(\x0e\x32/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UNKNOWN\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"P\n\x10IdempotencyLevel\x12\x17\n\x13IDEMPOTENCY_UNKNOWN\x10\x00\x12\x13\n\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n\nIDEMPOTENT\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9e\x02\n\x13UninterpretedOption\x12;\n\x04name\x18\x02 \x03(\x0b\x32-.google.protobuf.UninterpretedOption.NamePart\x12\x18\n\x10identifier_value\x18\x03 \x01(\t\x12\x1a\n\x12positive_int_value\x18\x04 \x01(\x04\x12\x1a\n\x12negative_int_value\x18\x05 \x01(\x03\x12\x14\n\x0c\x64ouble_value\x18\x06 \x01(\x01\x12\x14\n\x0cstring_value\x18\x07 \x01(\x0c\x12\x17\n\x0f\x61ggregate_value\x18\x08 \x01(\t\x1a\x33\n\x08NamePart\x12\x11\n\tname_part\x18\x01 \x02(\t\x12\x14\n\x0cis_extension\x18\x02 \x02(\x08\"\xd5\x01\n\x0eSourceCodeInfo\x12:\n\x08location\x18\x01 \x03(\x0b\x32(.google.protobuf.SourceCodeInfo.Location\x1a\x86\x01\n\x08Location\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x10\n\x04span\x18\x02 \x03(\x05\x42\x02\x10\x01\x12\x18\n\x10leading_comments\x18\x03 \x01(\t\x12\x19\n\x11trailing_comments\x18\x04 \x01(\t\x12!\n\x19leading_detached_comments\x18\x06 \x03(\t\"\xa7\x01\n\x11GeneratedCodeInfo\x12\x41\n\nannotation\x18\x01 \x03(\x0b\x32-.google.protobuf.GeneratedCodeInfo.Annotation\x1aO\n\nAnnotation\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bsource_file\x18\x02 \x01(\t\x12\r\n\x05\x62\x65gin\x18\x03 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x05\x42~\n\x13\x63om.google.protobufB\x10\x44\x65scriptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.Reflection') - -if _descriptor._USE_C_DESCRIPTORS == False: - _FIELDDESCRIPTORPROTO_TYPE = _descriptor.EnumDescriptor( - name='Type', - full_name='google.protobuf.FieldDescriptorProto.Type', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='TYPE_DOUBLE', index=0, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_FLOAT', index=1, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_INT64', index=2, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_UINT64', index=3, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_INT32', index=4, number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_FIXED64', index=5, number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_FIXED32', index=6, number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_BOOL', index=7, number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_STRING', index=8, number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_GROUP', index=9, number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_MESSAGE', index=10, number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_BYTES', index=11, number=12, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_UINT32', index=12, number=13, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_ENUM', index=13, number=14, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_SFIXED32', index=14, number=15, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_SFIXED64', index=15, number=16, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_SINT32', index=16, number=17, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='TYPE_SINT64', index=17, number=18, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - ) - _sym_db.RegisterEnumDescriptor(_FIELDDESCRIPTORPROTO_TYPE) - - _FIELDDESCRIPTORPROTO_LABEL = _descriptor.EnumDescriptor( - name='Label', - full_name='google.protobuf.FieldDescriptorProto.Label', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='LABEL_OPTIONAL', index=0, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LABEL_REQUIRED', index=1, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LABEL_REPEATED', index=2, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - ) - _sym_db.RegisterEnumDescriptor(_FIELDDESCRIPTORPROTO_LABEL) - - _FILEOPTIONS_OPTIMIZEMODE = _descriptor.EnumDescriptor( - name='OptimizeMode', - full_name='google.protobuf.FileOptions.OptimizeMode', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SPEED', index=0, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='CODE_SIZE', index=1, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LITE_RUNTIME', index=2, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - ) - _sym_db.RegisterEnumDescriptor(_FILEOPTIONS_OPTIMIZEMODE) - - _FIELDOPTIONS_CTYPE = _descriptor.EnumDescriptor( - name='CType', - full_name='google.protobuf.FieldOptions.CType', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='STRING', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='CORD', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='STRING_PIECE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - ) - _sym_db.RegisterEnumDescriptor(_FIELDOPTIONS_CTYPE) - - _FIELDOPTIONS_JSTYPE = _descriptor.EnumDescriptor( - name='JSType', - full_name='google.protobuf.FieldOptions.JSType', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='JS_NORMAL', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='JS_STRING', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='JS_NUMBER', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - ) - _sym_db.RegisterEnumDescriptor(_FIELDOPTIONS_JSTYPE) - - _METHODOPTIONS_IDEMPOTENCYLEVEL = _descriptor.EnumDescriptor( - name='IdempotencyLevel', - full_name='google.protobuf.MethodOptions.IdempotencyLevel', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='IDEMPOTENCY_UNKNOWN', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='NO_SIDE_EFFECTS', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='IDEMPOTENT', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - ) - _sym_db.RegisterEnumDescriptor(_METHODOPTIONS_IDEMPOTENCYLEVEL) - - - _FILEDESCRIPTORSET = _descriptor.Descriptor( - name='FileDescriptorSet', - full_name='google.protobuf.FileDescriptorSet', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='file', full_name='google.protobuf.FileDescriptorSet.file', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _FILEDESCRIPTORPROTO = _descriptor.Descriptor( - name='FileDescriptorProto', - full_name='google.protobuf.FileDescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.FileDescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='package', full_name='google.protobuf.FileDescriptorProto.package', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dependency', full_name='google.protobuf.FileDescriptorProto.dependency', index=2, - number=3, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='public_dependency', full_name='google.protobuf.FileDescriptorProto.public_dependency', index=3, - number=10, type=5, cpp_type=1, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='weak_dependency', full_name='google.protobuf.FileDescriptorProto.weak_dependency', index=4, - number=11, type=5, cpp_type=1, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='message_type', full_name='google.protobuf.FileDescriptorProto.message_type', index=5, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='enum_type', full_name='google.protobuf.FileDescriptorProto.enum_type', index=6, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='service', full_name='google.protobuf.FileDescriptorProto.service', index=7, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='extension', full_name='google.protobuf.FileDescriptorProto.extension', index=8, - number=7, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.FileDescriptorProto.options', index=9, - number=8, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='source_code_info', full_name='google.protobuf.FileDescriptorProto.source_code_info', index=10, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='syntax', full_name='google.protobuf.FileDescriptorProto.syntax', index=11, - number=12, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _DESCRIPTORPROTO_EXTENSIONRANGE = _descriptor.Descriptor( - name='ExtensionRange', - full_name='google.protobuf.DescriptorProto.ExtensionRange', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='start', full_name='google.protobuf.DescriptorProto.ExtensionRange.start', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='end', full_name='google.protobuf.DescriptorProto.ExtensionRange.end', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.DescriptorProto.ExtensionRange.options', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - _DESCRIPTORPROTO_RESERVEDRANGE = _descriptor.Descriptor( - name='ReservedRange', - full_name='google.protobuf.DescriptorProto.ReservedRange', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='start', full_name='google.protobuf.DescriptorProto.ReservedRange.start', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='end', full_name='google.protobuf.DescriptorProto.ReservedRange.end', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - _DESCRIPTORPROTO = _descriptor.Descriptor( - name='DescriptorProto', - full_name='google.protobuf.DescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.DescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='field', full_name='google.protobuf.DescriptorProto.field', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='extension', full_name='google.protobuf.DescriptorProto.extension', index=2, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='nested_type', full_name='google.protobuf.DescriptorProto.nested_type', index=3, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='enum_type', full_name='google.protobuf.DescriptorProto.enum_type', index=4, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='extension_range', full_name='google.protobuf.DescriptorProto.extension_range', index=5, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='oneof_decl', full_name='google.protobuf.DescriptorProto.oneof_decl', index=6, - number=8, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.DescriptorProto.options', index=7, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='reserved_range', full_name='google.protobuf.DescriptorProto.reserved_range', index=8, - number=9, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='reserved_name', full_name='google.protobuf.DescriptorProto.reserved_name', index=9, - number=10, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_DESCRIPTORPROTO_EXTENSIONRANGE, _DESCRIPTORPROTO_RESERVEDRANGE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _EXTENSIONRANGEOPTIONS = _descriptor.Descriptor( - name='ExtensionRangeOptions', - full_name='google.protobuf.ExtensionRangeOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.ExtensionRangeOptions.uninterpreted_option', index=0, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _FIELDDESCRIPTORPROTO = _descriptor.Descriptor( - name='FieldDescriptorProto', - full_name='google.protobuf.FieldDescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.FieldDescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='number', full_name='google.protobuf.FieldDescriptorProto.number', index=1, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='label', full_name='google.protobuf.FieldDescriptorProto.label', index=2, - number=4, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=1, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='type', full_name='google.protobuf.FieldDescriptorProto.type', index=3, - number=5, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=1, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='type_name', full_name='google.protobuf.FieldDescriptorProto.type_name', index=4, - number=6, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='extendee', full_name='google.protobuf.FieldDescriptorProto.extendee', index=5, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='default_value', full_name='google.protobuf.FieldDescriptorProto.default_value', index=6, - number=7, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='oneof_index', full_name='google.protobuf.FieldDescriptorProto.oneof_index', index=7, - number=9, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='json_name', full_name='google.protobuf.FieldDescriptorProto.json_name', index=8, - number=10, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.FieldDescriptorProto.options', index=9, - number=8, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='proto3_optional', full_name='google.protobuf.FieldDescriptorProto.proto3_optional', index=10, - number=17, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _FIELDDESCRIPTORPROTO_TYPE, - _FIELDDESCRIPTORPROTO_LABEL, - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _ONEOFDESCRIPTORPROTO = _descriptor.Descriptor( - name='OneofDescriptorProto', - full_name='google.protobuf.OneofDescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.OneofDescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.OneofDescriptorProto.options', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _ENUMDESCRIPTORPROTO_ENUMRESERVEDRANGE = _descriptor.Descriptor( - name='EnumReservedRange', - full_name='google.protobuf.EnumDescriptorProto.EnumReservedRange', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='start', full_name='google.protobuf.EnumDescriptorProto.EnumReservedRange.start', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='end', full_name='google.protobuf.EnumDescriptorProto.EnumReservedRange.end', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - _ENUMDESCRIPTORPROTO = _descriptor.Descriptor( - name='EnumDescriptorProto', - full_name='google.protobuf.EnumDescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.EnumDescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='google.protobuf.EnumDescriptorProto.value', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.EnumDescriptorProto.options', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='reserved_range', full_name='google.protobuf.EnumDescriptorProto.reserved_range', index=3, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='reserved_name', full_name='google.protobuf.EnumDescriptorProto.reserved_name', index=4, - number=5, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_ENUMDESCRIPTORPROTO_ENUMRESERVEDRANGE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _ENUMVALUEDESCRIPTORPROTO = _descriptor.Descriptor( - name='EnumValueDescriptorProto', - full_name='google.protobuf.EnumValueDescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.EnumValueDescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='number', full_name='google.protobuf.EnumValueDescriptorProto.number', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.EnumValueDescriptorProto.options', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _SERVICEDESCRIPTORPROTO = _descriptor.Descriptor( - name='ServiceDescriptorProto', - full_name='google.protobuf.ServiceDescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.ServiceDescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='method', full_name='google.protobuf.ServiceDescriptorProto.method', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.ServiceDescriptorProto.options', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _METHODDESCRIPTORPROTO = _descriptor.Descriptor( - name='MethodDescriptorProto', - full_name='google.protobuf.MethodDescriptorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.MethodDescriptorProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='input_type', full_name='google.protobuf.MethodDescriptorProto.input_type', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='output_type', full_name='google.protobuf.MethodDescriptorProto.output_type', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='options', full_name='google.protobuf.MethodDescriptorProto.options', index=3, - number=4, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='client_streaming', full_name='google.protobuf.MethodDescriptorProto.client_streaming', index=4, - number=5, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='server_streaming', full_name='google.protobuf.MethodDescriptorProto.server_streaming', index=5, - number=6, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _FILEOPTIONS = _descriptor.Descriptor( - name='FileOptions', - full_name='google.protobuf.FileOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='java_package', full_name='google.protobuf.FileOptions.java_package', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='java_outer_classname', full_name='google.protobuf.FileOptions.java_outer_classname', index=1, - number=8, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='java_multiple_files', full_name='google.protobuf.FileOptions.java_multiple_files', index=2, - number=10, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='java_generate_equals_and_hash', full_name='google.protobuf.FileOptions.java_generate_equals_and_hash', index=3, - number=20, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='java_string_check_utf8', full_name='google.protobuf.FileOptions.java_string_check_utf8', index=4, - number=27, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='optimize_for', full_name='google.protobuf.FileOptions.optimize_for', index=5, - number=9, type=14, cpp_type=8, label=1, - has_default_value=True, default_value=1, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='go_package', full_name='google.protobuf.FileOptions.go_package', index=6, - number=11, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='cc_generic_services', full_name='google.protobuf.FileOptions.cc_generic_services', index=7, - number=16, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='java_generic_services', full_name='google.protobuf.FileOptions.java_generic_services', index=8, - number=17, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='py_generic_services', full_name='google.protobuf.FileOptions.py_generic_services', index=9, - number=18, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='php_generic_services', full_name='google.protobuf.FileOptions.php_generic_services', index=10, - number=42, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='deprecated', full_name='google.protobuf.FileOptions.deprecated', index=11, - number=23, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='cc_enable_arenas', full_name='google.protobuf.FileOptions.cc_enable_arenas', index=12, - number=31, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=True, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='objc_class_prefix', full_name='google.protobuf.FileOptions.objc_class_prefix', index=13, - number=36, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='csharp_namespace', full_name='google.protobuf.FileOptions.csharp_namespace', index=14, - number=37, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='swift_prefix', full_name='google.protobuf.FileOptions.swift_prefix', index=15, - number=39, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='php_class_prefix', full_name='google.protobuf.FileOptions.php_class_prefix', index=16, - number=40, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='php_namespace', full_name='google.protobuf.FileOptions.php_namespace', index=17, - number=41, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='php_metadata_namespace', full_name='google.protobuf.FileOptions.php_metadata_namespace', index=18, - number=44, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='ruby_package', full_name='google.protobuf.FileOptions.ruby_package', index=19, - number=45, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.FileOptions.uninterpreted_option', index=20, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _FILEOPTIONS_OPTIMIZEMODE, - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _MESSAGEOPTIONS = _descriptor.Descriptor( - name='MessageOptions', - full_name='google.protobuf.MessageOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message_set_wire_format', full_name='google.protobuf.MessageOptions.message_set_wire_format', index=0, - number=1, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='no_standard_descriptor_accessor', full_name='google.protobuf.MessageOptions.no_standard_descriptor_accessor', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='deprecated', full_name='google.protobuf.MessageOptions.deprecated', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='map_entry', full_name='google.protobuf.MessageOptions.map_entry', index=3, - number=7, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.MessageOptions.uninterpreted_option', index=4, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _FIELDOPTIONS = _descriptor.Descriptor( - name='FieldOptions', - full_name='google.protobuf.FieldOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='ctype', full_name='google.protobuf.FieldOptions.ctype', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=True, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='packed', full_name='google.protobuf.FieldOptions.packed', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='jstype', full_name='google.protobuf.FieldOptions.jstype', index=2, - number=6, type=14, cpp_type=8, label=1, - has_default_value=True, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='lazy', full_name='google.protobuf.FieldOptions.lazy', index=3, - number=5, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='unverified_lazy', full_name='google.protobuf.FieldOptions.unverified_lazy', index=4, - number=15, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='deprecated', full_name='google.protobuf.FieldOptions.deprecated', index=5, - number=3, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='weak', full_name='google.protobuf.FieldOptions.weak', index=6, - number=10, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.FieldOptions.uninterpreted_option', index=7, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _FIELDOPTIONS_CTYPE, - _FIELDOPTIONS_JSTYPE, - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _ONEOFOPTIONS = _descriptor.Descriptor( - name='OneofOptions', - full_name='google.protobuf.OneofOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.OneofOptions.uninterpreted_option', index=0, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _ENUMOPTIONS = _descriptor.Descriptor( - name='EnumOptions', - full_name='google.protobuf.EnumOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='allow_alias', full_name='google.protobuf.EnumOptions.allow_alias', index=0, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='deprecated', full_name='google.protobuf.EnumOptions.deprecated', index=1, - number=3, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.EnumOptions.uninterpreted_option', index=2, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _ENUMVALUEOPTIONS = _descriptor.Descriptor( - name='EnumValueOptions', - full_name='google.protobuf.EnumValueOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='deprecated', full_name='google.protobuf.EnumValueOptions.deprecated', index=0, - number=1, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.EnumValueOptions.uninterpreted_option', index=1, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _SERVICEOPTIONS = _descriptor.Descriptor( - name='ServiceOptions', - full_name='google.protobuf.ServiceOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='deprecated', full_name='google.protobuf.ServiceOptions.deprecated', index=0, - number=33, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.ServiceOptions.uninterpreted_option', index=1, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _METHODOPTIONS = _descriptor.Descriptor( - name='MethodOptions', - full_name='google.protobuf.MethodOptions', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='deprecated', full_name='google.protobuf.MethodOptions.deprecated', index=0, - number=33, type=8, cpp_type=7, label=1, - has_default_value=True, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='idempotency_level', full_name='google.protobuf.MethodOptions.idempotency_level', index=1, - number=34, type=14, cpp_type=8, label=1, - has_default_value=True, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='uninterpreted_option', full_name='google.protobuf.MethodOptions.uninterpreted_option', index=2, - number=999, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _METHODOPTIONS_IDEMPOTENCYLEVEL, - ], - serialized_options=None, - is_extendable=True, - syntax='proto2', - extension_ranges=[(1000, 536870912), ], - oneofs=[ - ], - ) - - - _UNINTERPRETEDOPTION_NAMEPART = _descriptor.Descriptor( - name='NamePart', - full_name='google.protobuf.UninterpretedOption.NamePart', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name_part', full_name='google.protobuf.UninterpretedOption.NamePart.name_part', index=0, - number=1, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='is_extension', full_name='google.protobuf.UninterpretedOption.NamePart.is_extension', index=1, - number=2, type=8, cpp_type=7, label=2, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - _UNINTERPRETEDOPTION = _descriptor.Descriptor( - name='UninterpretedOption', - full_name='google.protobuf.UninterpretedOption', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='google.protobuf.UninterpretedOption.name', index=0, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='identifier_value', full_name='google.protobuf.UninterpretedOption.identifier_value', index=1, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='positive_int_value', full_name='google.protobuf.UninterpretedOption.positive_int_value', index=2, - number=4, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='negative_int_value', full_name='google.protobuf.UninterpretedOption.negative_int_value', index=3, - number=5, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='double_value', full_name='google.protobuf.UninterpretedOption.double_value', index=4, - number=6, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='string_value', full_name='google.protobuf.UninterpretedOption.string_value', index=5, - number=7, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='aggregate_value', full_name='google.protobuf.UninterpretedOption.aggregate_value', index=6, - number=8, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_UNINTERPRETEDOPTION_NAMEPART, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _SOURCECODEINFO_LOCATION = _descriptor.Descriptor( - name='Location', - full_name='google.protobuf.SourceCodeInfo.Location', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='path', full_name='google.protobuf.SourceCodeInfo.Location.path', index=0, - number=1, type=5, cpp_type=1, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span', full_name='google.protobuf.SourceCodeInfo.Location.span', index=1, - number=2, type=5, cpp_type=1, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='leading_comments', full_name='google.protobuf.SourceCodeInfo.Location.leading_comments', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trailing_comments', full_name='google.protobuf.SourceCodeInfo.Location.trailing_comments', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='leading_detached_comments', full_name='google.protobuf.SourceCodeInfo.Location.leading_detached_comments', index=4, - number=6, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - _SOURCECODEINFO = _descriptor.Descriptor( - name='SourceCodeInfo', - full_name='google.protobuf.SourceCodeInfo', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='location', full_name='google.protobuf.SourceCodeInfo.location', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_SOURCECODEINFO_LOCATION, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - - _GENERATEDCODEINFO_ANNOTATION = _descriptor.Descriptor( - name='Annotation', - full_name='google.protobuf.GeneratedCodeInfo.Annotation', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='path', full_name='google.protobuf.GeneratedCodeInfo.Annotation.path', index=0, - number=1, type=5, cpp_type=1, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='source_file', full_name='google.protobuf.GeneratedCodeInfo.Annotation.source_file', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='begin', full_name='google.protobuf.GeneratedCodeInfo.Annotation.begin', index=2, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='end', full_name='google.protobuf.GeneratedCodeInfo.Annotation.end', index=3, - number=4, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - _GENERATEDCODEINFO = _descriptor.Descriptor( - name='GeneratedCodeInfo', - full_name='google.protobuf.GeneratedCodeInfo', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='annotation', full_name='google.protobuf.GeneratedCodeInfo.annotation', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_GENERATEDCODEINFO_ANNOTATION, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - ) - - _FILEDESCRIPTORSET.fields_by_name['file'].message_type = _FILEDESCRIPTORPROTO - _FILEDESCRIPTORPROTO.fields_by_name['message_type'].message_type = _DESCRIPTORPROTO - _FILEDESCRIPTORPROTO.fields_by_name['enum_type'].message_type = _ENUMDESCRIPTORPROTO - _FILEDESCRIPTORPROTO.fields_by_name['service'].message_type = _SERVICEDESCRIPTORPROTO - _FILEDESCRIPTORPROTO.fields_by_name['extension'].message_type = _FIELDDESCRIPTORPROTO - _FILEDESCRIPTORPROTO.fields_by_name['options'].message_type = _FILEOPTIONS - _FILEDESCRIPTORPROTO.fields_by_name['source_code_info'].message_type = _SOURCECODEINFO - _DESCRIPTORPROTO_EXTENSIONRANGE.fields_by_name['options'].message_type = _EXTENSIONRANGEOPTIONS - _DESCRIPTORPROTO_EXTENSIONRANGE.containing_type = _DESCRIPTORPROTO - _DESCRIPTORPROTO_RESERVEDRANGE.containing_type = _DESCRIPTORPROTO - _DESCRIPTORPROTO.fields_by_name['field'].message_type = _FIELDDESCRIPTORPROTO - _DESCRIPTORPROTO.fields_by_name['extension'].message_type = _FIELDDESCRIPTORPROTO - _DESCRIPTORPROTO.fields_by_name['nested_type'].message_type = _DESCRIPTORPROTO - _DESCRIPTORPROTO.fields_by_name['enum_type'].message_type = _ENUMDESCRIPTORPROTO - _DESCRIPTORPROTO.fields_by_name['extension_range'].message_type = _DESCRIPTORPROTO_EXTENSIONRANGE - _DESCRIPTORPROTO.fields_by_name['oneof_decl'].message_type = _ONEOFDESCRIPTORPROTO - _DESCRIPTORPROTO.fields_by_name['options'].message_type = _MESSAGEOPTIONS - _DESCRIPTORPROTO.fields_by_name['reserved_range'].message_type = _DESCRIPTORPROTO_RESERVEDRANGE - _EXTENSIONRANGEOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _FIELDDESCRIPTORPROTO.fields_by_name['label'].enum_type = _FIELDDESCRIPTORPROTO_LABEL - _FIELDDESCRIPTORPROTO.fields_by_name['type'].enum_type = _FIELDDESCRIPTORPROTO_TYPE - _FIELDDESCRIPTORPROTO.fields_by_name['options'].message_type = _FIELDOPTIONS - _FIELDDESCRIPTORPROTO_TYPE.containing_type = _FIELDDESCRIPTORPROTO - _FIELDDESCRIPTORPROTO_LABEL.containing_type = _FIELDDESCRIPTORPROTO - _ONEOFDESCRIPTORPROTO.fields_by_name['options'].message_type = _ONEOFOPTIONS - _ENUMDESCRIPTORPROTO_ENUMRESERVEDRANGE.containing_type = _ENUMDESCRIPTORPROTO - _ENUMDESCRIPTORPROTO.fields_by_name['value'].message_type = _ENUMVALUEDESCRIPTORPROTO - _ENUMDESCRIPTORPROTO.fields_by_name['options'].message_type = _ENUMOPTIONS - _ENUMDESCRIPTORPROTO.fields_by_name['reserved_range'].message_type = _ENUMDESCRIPTORPROTO_ENUMRESERVEDRANGE - _ENUMVALUEDESCRIPTORPROTO.fields_by_name['options'].message_type = _ENUMVALUEOPTIONS - _SERVICEDESCRIPTORPROTO.fields_by_name['method'].message_type = _METHODDESCRIPTORPROTO - _SERVICEDESCRIPTORPROTO.fields_by_name['options'].message_type = _SERVICEOPTIONS - _METHODDESCRIPTORPROTO.fields_by_name['options'].message_type = _METHODOPTIONS - _FILEOPTIONS.fields_by_name['optimize_for'].enum_type = _FILEOPTIONS_OPTIMIZEMODE - _FILEOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _FILEOPTIONS_OPTIMIZEMODE.containing_type = _FILEOPTIONS - _MESSAGEOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _FIELDOPTIONS.fields_by_name['ctype'].enum_type = _FIELDOPTIONS_CTYPE - _FIELDOPTIONS.fields_by_name['jstype'].enum_type = _FIELDOPTIONS_JSTYPE - _FIELDOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _FIELDOPTIONS_CTYPE.containing_type = _FIELDOPTIONS - _FIELDOPTIONS_JSTYPE.containing_type = _FIELDOPTIONS - _ONEOFOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _ENUMOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _ENUMVALUEOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _SERVICEOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _METHODOPTIONS.fields_by_name['idempotency_level'].enum_type = _METHODOPTIONS_IDEMPOTENCYLEVEL - _METHODOPTIONS.fields_by_name['uninterpreted_option'].message_type = _UNINTERPRETEDOPTION - _METHODOPTIONS_IDEMPOTENCYLEVEL.containing_type = _METHODOPTIONS - _UNINTERPRETEDOPTION_NAMEPART.containing_type = _UNINTERPRETEDOPTION - _UNINTERPRETEDOPTION.fields_by_name['name'].message_type = _UNINTERPRETEDOPTION_NAMEPART - _SOURCECODEINFO_LOCATION.containing_type = _SOURCECODEINFO - _SOURCECODEINFO.fields_by_name['location'].message_type = _SOURCECODEINFO_LOCATION - _GENERATEDCODEINFO_ANNOTATION.containing_type = _GENERATEDCODEINFO - _GENERATEDCODEINFO.fields_by_name['annotation'].message_type = _GENERATEDCODEINFO_ANNOTATION - DESCRIPTOR.message_types_by_name['FileDescriptorSet'] = _FILEDESCRIPTORSET - DESCRIPTOR.message_types_by_name['FileDescriptorProto'] = _FILEDESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['DescriptorProto'] = _DESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['ExtensionRangeOptions'] = _EXTENSIONRANGEOPTIONS - DESCRIPTOR.message_types_by_name['FieldDescriptorProto'] = _FIELDDESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['OneofDescriptorProto'] = _ONEOFDESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['EnumDescriptorProto'] = _ENUMDESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['EnumValueDescriptorProto'] = _ENUMVALUEDESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['ServiceDescriptorProto'] = _SERVICEDESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['MethodDescriptorProto'] = _METHODDESCRIPTORPROTO - DESCRIPTOR.message_types_by_name['FileOptions'] = _FILEOPTIONS - DESCRIPTOR.message_types_by_name['MessageOptions'] = _MESSAGEOPTIONS - DESCRIPTOR.message_types_by_name['FieldOptions'] = _FIELDOPTIONS - DESCRIPTOR.message_types_by_name['OneofOptions'] = _ONEOFOPTIONS - DESCRIPTOR.message_types_by_name['EnumOptions'] = _ENUMOPTIONS - DESCRIPTOR.message_types_by_name['EnumValueOptions'] = _ENUMVALUEOPTIONS - DESCRIPTOR.message_types_by_name['ServiceOptions'] = _SERVICEOPTIONS - DESCRIPTOR.message_types_by_name['MethodOptions'] = _METHODOPTIONS - DESCRIPTOR.message_types_by_name['UninterpretedOption'] = _UNINTERPRETEDOPTION - DESCRIPTOR.message_types_by_name['SourceCodeInfo'] = _SOURCECODEINFO - DESCRIPTOR.message_types_by_name['GeneratedCodeInfo'] = _GENERATEDCODEINFO - _sym_db.RegisterFileDescriptor(DESCRIPTOR) - -else: - _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.descriptor_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - _FILEDESCRIPTORSET._serialized_start=53 - _FILEDESCRIPTORSET._serialized_end=124 - _FILEDESCRIPTORPROTO._serialized_start=127 - _FILEDESCRIPTORPROTO._serialized_end=602 - _DESCRIPTORPROTO._serialized_start=605 - _DESCRIPTORPROTO._serialized_end=1286 - _DESCRIPTORPROTO_EXTENSIONRANGE._serialized_start=1140 - _DESCRIPTORPROTO_EXTENSIONRANGE._serialized_end=1241 - _DESCRIPTORPROTO_RESERVEDRANGE._serialized_start=1243 - _DESCRIPTORPROTO_RESERVEDRANGE._serialized_end=1286 - _EXTENSIONRANGEOPTIONS._serialized_start=1288 - _EXTENSIONRANGEOPTIONS._serialized_end=1391 - _FIELDDESCRIPTORPROTO._serialized_start=1394 - _FIELDDESCRIPTORPROTO._serialized_end=2119 - _FIELDDESCRIPTORPROTO_TYPE._serialized_start=1740 - _FIELDDESCRIPTORPROTO_TYPE._serialized_end=2050 - _FIELDDESCRIPTORPROTO_LABEL._serialized_start=2052 - _FIELDDESCRIPTORPROTO_LABEL._serialized_end=2119 - _ONEOFDESCRIPTORPROTO._serialized_start=2121 - _ONEOFDESCRIPTORPROTO._serialized_end=2205 - _ENUMDESCRIPTORPROTO._serialized_start=2208 - _ENUMDESCRIPTORPROTO._serialized_end=2500 - _ENUMDESCRIPTORPROTO_ENUMRESERVEDRANGE._serialized_start=2453 - _ENUMDESCRIPTORPROTO_ENUMRESERVEDRANGE._serialized_end=2500 - _ENUMVALUEDESCRIPTORPROTO._serialized_start=2502 - _ENUMVALUEDESCRIPTORPROTO._serialized_end=2610 - _SERVICEDESCRIPTORPROTO._serialized_start=2613 - _SERVICEDESCRIPTORPROTO._serialized_end=2757 - _METHODDESCRIPTORPROTO._serialized_start=2760 - _METHODDESCRIPTORPROTO._serialized_end=2953 - _FILEOPTIONS._serialized_start=2956 - _FILEOPTIONS._serialized_end=3761 - _FILEOPTIONS_OPTIMIZEMODE._serialized_start=3686 - _FILEOPTIONS_OPTIMIZEMODE._serialized_end=3744 - _MESSAGEOPTIONS._serialized_start=3764 - _MESSAGEOPTIONS._serialized_end=4024 - _FIELDOPTIONS._serialized_start=4027 - _FIELDOPTIONS._serialized_end=4473 - _FIELDOPTIONS_CTYPE._serialized_start=4354 - _FIELDOPTIONS_CTYPE._serialized_end=4401 - _FIELDOPTIONS_JSTYPE._serialized_start=4403 - _FIELDOPTIONS_JSTYPE._serialized_end=4456 - _ONEOFOPTIONS._serialized_start=4475 - _ONEOFOPTIONS._serialized_end=4569 - _ENUMOPTIONS._serialized_start=4572 - _ENUMOPTIONS._serialized_end=4719 - _ENUMVALUEOPTIONS._serialized_start=4721 - _ENUMVALUEOPTIONS._serialized_end=4846 - _SERVICEOPTIONS._serialized_start=4848 - _SERVICEOPTIONS._serialized_end=4971 - _METHODOPTIONS._serialized_start=4974 - _METHODOPTIONS._serialized_end=5275 - _METHODOPTIONS_IDEMPOTENCYLEVEL._serialized_start=5184 - _METHODOPTIONS_IDEMPOTENCYLEVEL._serialized_end=5264 - _UNINTERPRETEDOPTION._serialized_start=5278 - _UNINTERPRETEDOPTION._serialized_end=5564 - _UNINTERPRETEDOPTION_NAMEPART._serialized_start=5513 - _UNINTERPRETEDOPTION_NAMEPART._serialized_end=5564 - _SOURCECODEINFO._serialized_start=5567 - _SOURCECODEINFO._serialized_end=5780 - _SOURCECODEINFO_LOCATION._serialized_start=5646 - _SOURCECODEINFO_LOCATION._serialized_end=5780 - _GENERATEDCODEINFO._serialized_start=5783 - _GENERATEDCODEINFO._serialized_end=5950 - _GENERATEDCODEINFO_ANNOTATION._serialized_start=5871 - _GENERATEDCODEINFO_ANNOTATION._serialized_end=5950 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/descriptor_pool.py b/opensafely/_vendor/google/protobuf/descriptor_pool.py deleted file mode 100644 index 88e90d99..00000000 --- a/opensafely/_vendor/google/protobuf/descriptor_pool.py +++ /dev/null @@ -1,1295 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Provides DescriptorPool to use as a container for proto2 descriptors. - -The DescriptorPool is used in conjection with a DescriptorDatabase to maintain -a collection of protocol buffer descriptors for use when dynamically creating -message types at runtime. - -For most applications protocol buffers should be used via modules generated by -the protocol buffer compiler tool. This should only be used when the type of -protocol buffers used in an application or library cannot be predetermined. - -Below is a straightforward example on how to use this class:: - - pool = DescriptorPool() - file_descriptor_protos = [ ... ] - for file_descriptor_proto in file_descriptor_protos: - pool.Add(file_descriptor_proto) - my_message_descriptor = pool.FindMessageTypeByName('some.package.MessageType') - -The message descriptor can be used in conjunction with the message_factory -module in order to create a protocol buffer class that can be encoded and -decoded. - -If you want to get a Python class for the specified proto, use the -helper functions inside google.protobuf.message_factory -directly instead of this class. -""" - -__author__ = 'matthewtoia@google.com (Matt Toia)' - -import collections -import warnings - -from opensafely._vendor.google.protobuf import descriptor -from opensafely._vendor.google.protobuf import descriptor_database -from opensafely._vendor.google.protobuf import text_encoding - - -_USE_C_DESCRIPTORS = descriptor._USE_C_DESCRIPTORS # pylint: disable=protected-access - - -def _Deprecated(func): - """Mark functions as deprecated.""" - - def NewFunc(*args, **kwargs): - warnings.warn( - 'Call to deprecated function %s(). Note: Do add unlinked descriptors ' - 'to descriptor_pool is wrong. Use Add() or AddSerializedFile() ' - 'instead.' % func.__name__, - category=DeprecationWarning) - return func(*args, **kwargs) - NewFunc.__name__ = func.__name__ - NewFunc.__doc__ = func.__doc__ - NewFunc.__dict__.update(func.__dict__) - return NewFunc - - -def _NormalizeFullyQualifiedName(name): - """Remove leading period from fully-qualified type name. - - Due to b/13860351 in descriptor_database.py, types in the root namespace are - generated with a leading period. This function removes that prefix. - - Args: - name (str): The fully-qualified symbol name. - - Returns: - str: The normalized fully-qualified symbol name. - """ - return name.lstrip('.') - - -def _OptionsOrNone(descriptor_proto): - """Returns the value of the field `options`, or None if it is not set.""" - if descriptor_proto.HasField('options'): - return descriptor_proto.options - else: - return None - - -def _IsMessageSetExtension(field): - return (field.is_extension and - field.containing_type.has_options and - field.containing_type.GetOptions().message_set_wire_format and - field.type == descriptor.FieldDescriptor.TYPE_MESSAGE and - field.label == descriptor.FieldDescriptor.LABEL_OPTIONAL) - - -class DescriptorPool(object): - """A collection of protobufs dynamically constructed by descriptor protos.""" - - if _USE_C_DESCRIPTORS: - - def __new__(cls, descriptor_db=None): - # pylint: disable=protected-access - return descriptor._message.DescriptorPool(descriptor_db) - - def __init__(self, descriptor_db=None): - """Initializes a Pool of proto buffs. - - The descriptor_db argument to the constructor is provided to allow - specialized file descriptor proto lookup code to be triggered on demand. An - example would be an implementation which will read and compile a file - specified in a call to FindFileByName() and not require the call to Add() - at all. Results from this database will be cached internally here as well. - - Args: - descriptor_db: A secondary source of file descriptors. - """ - - self._internal_db = descriptor_database.DescriptorDatabase() - self._descriptor_db = descriptor_db - self._descriptors = {} - self._enum_descriptors = {} - self._service_descriptors = {} - self._file_descriptors = {} - self._toplevel_extensions = {} - # TODO(jieluo): Remove _file_desc_by_toplevel_extension after - # maybe year 2020 for compatibility issue (with 3.4.1 only). - self._file_desc_by_toplevel_extension = {} - self._top_enum_values = {} - # We store extensions in two two-level mappings: The first key is the - # descriptor of the message being extended, the second key is the extension - # full name or its tag number. - self._extensions_by_name = collections.defaultdict(dict) - self._extensions_by_number = collections.defaultdict(dict) - - def _CheckConflictRegister(self, desc, desc_name, file_name): - """Check if the descriptor name conflicts with another of the same name. - - Args: - desc: Descriptor of a message, enum, service, extension or enum value. - desc_name (str): the full name of desc. - file_name (str): The file name of descriptor. - """ - for register, descriptor_type in [ - (self._descriptors, descriptor.Descriptor), - (self._enum_descriptors, descriptor.EnumDescriptor), - (self._service_descriptors, descriptor.ServiceDescriptor), - (self._toplevel_extensions, descriptor.FieldDescriptor), - (self._top_enum_values, descriptor.EnumValueDescriptor)]: - if desc_name in register: - old_desc = register[desc_name] - if isinstance(old_desc, descriptor.EnumValueDescriptor): - old_file = old_desc.type.file.name - else: - old_file = old_desc.file.name - - if not isinstance(desc, descriptor_type) or ( - old_file != file_name): - error_msg = ('Conflict register for file "' + file_name + - '": ' + desc_name + - ' is already defined in file "' + - old_file + '". Please fix the conflict by adding ' - 'package name on the proto file, or use different ' - 'name for the duplication.') - if isinstance(desc, descriptor.EnumValueDescriptor): - error_msg += ('\nNote: enum values appear as ' - 'siblings of the enum type instead of ' - 'children of it.') - - raise TypeError(error_msg) - - return - - def Add(self, file_desc_proto): - """Adds the FileDescriptorProto and its types to this pool. - - Args: - file_desc_proto (FileDescriptorProto): The file descriptor to add. - """ - - self._internal_db.Add(file_desc_proto) - - def AddSerializedFile(self, serialized_file_desc_proto): - """Adds the FileDescriptorProto and its types to this pool. - - Args: - serialized_file_desc_proto (bytes): A bytes string, serialization of the - :class:`FileDescriptorProto` to add. - - Returns: - FileDescriptor: Descriptor for the added file. - """ - - # pylint: disable=g-import-not-at-top - from opensafely._vendor.google.protobuf import descriptor_pb2 - file_desc_proto = descriptor_pb2.FileDescriptorProto.FromString( - serialized_file_desc_proto) - file_desc = self._ConvertFileProtoToFileDescriptor(file_desc_proto) - file_desc.serialized_pb = serialized_file_desc_proto - return file_desc - - # Add Descriptor to descriptor pool is dreprecated. Please use Add() - # or AddSerializedFile() to add a FileDescriptorProto instead. - @_Deprecated - def AddDescriptor(self, desc): - self._AddDescriptor(desc) - - # Never call this method. It is for internal usage only. - def _AddDescriptor(self, desc): - """Adds a Descriptor to the pool, non-recursively. - - If the Descriptor contains nested messages or enums, the caller must - explicitly register them. This method also registers the FileDescriptor - associated with the message. - - Args: - desc: A Descriptor. - """ - if not isinstance(desc, descriptor.Descriptor): - raise TypeError('Expected instance of descriptor.Descriptor.') - - self._CheckConflictRegister(desc, desc.full_name, desc.file.name) - - self._descriptors[desc.full_name] = desc - self._AddFileDescriptor(desc.file) - - # Add EnumDescriptor to descriptor pool is dreprecated. Please use Add() - # or AddSerializedFile() to add a FileDescriptorProto instead. - @_Deprecated - def AddEnumDescriptor(self, enum_desc): - self._AddEnumDescriptor(enum_desc) - - # Never call this method. It is for internal usage only. - def _AddEnumDescriptor(self, enum_desc): - """Adds an EnumDescriptor to the pool. - - This method also registers the FileDescriptor associated with the enum. - - Args: - enum_desc: An EnumDescriptor. - """ - - if not isinstance(enum_desc, descriptor.EnumDescriptor): - raise TypeError('Expected instance of descriptor.EnumDescriptor.') - - file_name = enum_desc.file.name - self._CheckConflictRegister(enum_desc, enum_desc.full_name, file_name) - self._enum_descriptors[enum_desc.full_name] = enum_desc - - # Top enum values need to be indexed. - # Count the number of dots to see whether the enum is toplevel or nested - # in a message. We cannot use enum_desc.containing_type at this stage. - if enum_desc.file.package: - top_level = (enum_desc.full_name.count('.') - - enum_desc.file.package.count('.') == 1) - else: - top_level = enum_desc.full_name.count('.') == 0 - if top_level: - file_name = enum_desc.file.name - package = enum_desc.file.package - for enum_value in enum_desc.values: - full_name = _NormalizeFullyQualifiedName( - '.'.join((package, enum_value.name))) - self._CheckConflictRegister(enum_value, full_name, file_name) - self._top_enum_values[full_name] = enum_value - self._AddFileDescriptor(enum_desc.file) - - # Add ServiceDescriptor to descriptor pool is dreprecated. Please use Add() - # or AddSerializedFile() to add a FileDescriptorProto instead. - @_Deprecated - def AddServiceDescriptor(self, service_desc): - self._AddServiceDescriptor(service_desc) - - # Never call this method. It is for internal usage only. - def _AddServiceDescriptor(self, service_desc): - """Adds a ServiceDescriptor to the pool. - - Args: - service_desc: A ServiceDescriptor. - """ - - if not isinstance(service_desc, descriptor.ServiceDescriptor): - raise TypeError('Expected instance of descriptor.ServiceDescriptor.') - - self._CheckConflictRegister(service_desc, service_desc.full_name, - service_desc.file.name) - self._service_descriptors[service_desc.full_name] = service_desc - - # Add ExtensionDescriptor to descriptor pool is dreprecated. Please use Add() - # or AddSerializedFile() to add a FileDescriptorProto instead. - @_Deprecated - def AddExtensionDescriptor(self, extension): - self._AddExtensionDescriptor(extension) - - # Never call this method. It is for internal usage only. - def _AddExtensionDescriptor(self, extension): - """Adds a FieldDescriptor describing an extension to the pool. - - Args: - extension: A FieldDescriptor. - - Raises: - AssertionError: when another extension with the same number extends the - same message. - TypeError: when the specified extension is not a - descriptor.FieldDescriptor. - """ - if not (isinstance(extension, descriptor.FieldDescriptor) and - extension.is_extension): - raise TypeError('Expected an extension descriptor.') - - if extension.extension_scope is None: - self._toplevel_extensions[extension.full_name] = extension - - try: - existing_desc = self._extensions_by_number[ - extension.containing_type][extension.number] - except KeyError: - pass - else: - if extension is not existing_desc: - raise AssertionError( - 'Extensions "%s" and "%s" both try to extend message type "%s" ' - 'with field number %d.' % - (extension.full_name, existing_desc.full_name, - extension.containing_type.full_name, extension.number)) - - self._extensions_by_number[extension.containing_type][ - extension.number] = extension - self._extensions_by_name[extension.containing_type][ - extension.full_name] = extension - - # Also register MessageSet extensions with the type name. - if _IsMessageSetExtension(extension): - self._extensions_by_name[extension.containing_type][ - extension.message_type.full_name] = extension - - @_Deprecated - def AddFileDescriptor(self, file_desc): - self._InternalAddFileDescriptor(file_desc) - - # Never call this method. It is for internal usage only. - def _InternalAddFileDescriptor(self, file_desc): - """Adds a FileDescriptor to the pool, non-recursively. - - If the FileDescriptor contains messages or enums, the caller must explicitly - register them. - - Args: - file_desc: A FileDescriptor. - """ - - self._AddFileDescriptor(file_desc) - # TODO(jieluo): This is a temporary solution for FieldDescriptor.file. - # FieldDescriptor.file is added in code gen. Remove this solution after - # maybe 2020 for compatibility reason (with 3.4.1 only). - for extension in file_desc.extensions_by_name.values(): - self._file_desc_by_toplevel_extension[ - extension.full_name] = file_desc - - def _AddFileDescriptor(self, file_desc): - """Adds a FileDescriptor to the pool, non-recursively. - - If the FileDescriptor contains messages or enums, the caller must explicitly - register them. - - Args: - file_desc: A FileDescriptor. - """ - - if not isinstance(file_desc, descriptor.FileDescriptor): - raise TypeError('Expected instance of descriptor.FileDescriptor.') - self._file_descriptors[file_desc.name] = file_desc - - def FindFileByName(self, file_name): - """Gets a FileDescriptor by file name. - - Args: - file_name (str): The path to the file to get a descriptor for. - - Returns: - FileDescriptor: The descriptor for the named file. - - Raises: - KeyError: if the file cannot be found in the pool. - """ - - try: - return self._file_descriptors[file_name] - except KeyError: - pass - - try: - file_proto = self._internal_db.FindFileByName(file_name) - except KeyError as error: - if self._descriptor_db: - file_proto = self._descriptor_db.FindFileByName(file_name) - else: - raise error - if not file_proto: - raise KeyError('Cannot find a file named %s' % file_name) - return self._ConvertFileProtoToFileDescriptor(file_proto) - - def FindFileContainingSymbol(self, symbol): - """Gets the FileDescriptor for the file containing the specified symbol. - - Args: - symbol (str): The name of the symbol to search for. - - Returns: - FileDescriptor: Descriptor for the file that contains the specified - symbol. - - Raises: - KeyError: if the file cannot be found in the pool. - """ - - symbol = _NormalizeFullyQualifiedName(symbol) - try: - return self._InternalFindFileContainingSymbol(symbol) - except KeyError: - pass - - try: - # Try fallback database. Build and find again if possible. - self._FindFileContainingSymbolInDb(symbol) - return self._InternalFindFileContainingSymbol(symbol) - except KeyError: - raise KeyError('Cannot find a file containing %s' % symbol) - - def _InternalFindFileContainingSymbol(self, symbol): - """Gets the already built FileDescriptor containing the specified symbol. - - Args: - symbol (str): The name of the symbol to search for. - - Returns: - FileDescriptor: Descriptor for the file that contains the specified - symbol. - - Raises: - KeyError: if the file cannot be found in the pool. - """ - try: - return self._descriptors[symbol].file - except KeyError: - pass - - try: - return self._enum_descriptors[symbol].file - except KeyError: - pass - - try: - return self._service_descriptors[symbol].file - except KeyError: - pass - - try: - return self._top_enum_values[symbol].type.file - except KeyError: - pass - - try: - return self._file_desc_by_toplevel_extension[symbol] - except KeyError: - pass - - # Try fields, enum values and nested extensions inside a message. - top_name, _, sub_name = symbol.rpartition('.') - try: - message = self.FindMessageTypeByName(top_name) - assert (sub_name in message.extensions_by_name or - sub_name in message.fields_by_name or - sub_name in message.enum_values_by_name) - return message.file - except (KeyError, AssertionError): - raise KeyError('Cannot find a file containing %s' % symbol) - - def FindMessageTypeByName(self, full_name): - """Loads the named descriptor from the pool. - - Args: - full_name (str): The full name of the descriptor to load. - - Returns: - Descriptor: The descriptor for the named type. - - Raises: - KeyError: if the message cannot be found in the pool. - """ - - full_name = _NormalizeFullyQualifiedName(full_name) - if full_name not in self._descriptors: - self._FindFileContainingSymbolInDb(full_name) - return self._descriptors[full_name] - - def FindEnumTypeByName(self, full_name): - """Loads the named enum descriptor from the pool. - - Args: - full_name (str): The full name of the enum descriptor to load. - - Returns: - EnumDescriptor: The enum descriptor for the named type. - - Raises: - KeyError: if the enum cannot be found in the pool. - """ - - full_name = _NormalizeFullyQualifiedName(full_name) - if full_name not in self._enum_descriptors: - self._FindFileContainingSymbolInDb(full_name) - return self._enum_descriptors[full_name] - - def FindFieldByName(self, full_name): - """Loads the named field descriptor from the pool. - - Args: - full_name (str): The full name of the field descriptor to load. - - Returns: - FieldDescriptor: The field descriptor for the named field. - - Raises: - KeyError: if the field cannot be found in the pool. - """ - full_name = _NormalizeFullyQualifiedName(full_name) - message_name, _, field_name = full_name.rpartition('.') - message_descriptor = self.FindMessageTypeByName(message_name) - return message_descriptor.fields_by_name[field_name] - - def FindOneofByName(self, full_name): - """Loads the named oneof descriptor from the pool. - - Args: - full_name (str): The full name of the oneof descriptor to load. - - Returns: - OneofDescriptor: The oneof descriptor for the named oneof. - - Raises: - KeyError: if the oneof cannot be found in the pool. - """ - full_name = _NormalizeFullyQualifiedName(full_name) - message_name, _, oneof_name = full_name.rpartition('.') - message_descriptor = self.FindMessageTypeByName(message_name) - return message_descriptor.oneofs_by_name[oneof_name] - - def FindExtensionByName(self, full_name): - """Loads the named extension descriptor from the pool. - - Args: - full_name (str): The full name of the extension descriptor to load. - - Returns: - FieldDescriptor: The field descriptor for the named extension. - - Raises: - KeyError: if the extension cannot be found in the pool. - """ - full_name = _NormalizeFullyQualifiedName(full_name) - try: - # The proto compiler does not give any link between the FileDescriptor - # and top-level extensions unless the FileDescriptorProto is added to - # the DescriptorDatabase, but this can impact memory usage. - # So we registered these extensions by name explicitly. - return self._toplevel_extensions[full_name] - except KeyError: - pass - message_name, _, extension_name = full_name.rpartition('.') - try: - # Most extensions are nested inside a message. - scope = self.FindMessageTypeByName(message_name) - except KeyError: - # Some extensions are defined at file scope. - scope = self._FindFileContainingSymbolInDb(full_name) - return scope.extensions_by_name[extension_name] - - def FindExtensionByNumber(self, message_descriptor, number): - """Gets the extension of the specified message with the specified number. - - Extensions have to be registered to this pool by calling :func:`Add` or - :func:`AddExtensionDescriptor`. - - Args: - message_descriptor (Descriptor): descriptor of the extended message. - number (int): Number of the extension field. - - Returns: - FieldDescriptor: The descriptor for the extension. - - Raises: - KeyError: when no extension with the given number is known for the - specified message. - """ - try: - return self._extensions_by_number[message_descriptor][number] - except KeyError: - self._TryLoadExtensionFromDB(message_descriptor, number) - return self._extensions_by_number[message_descriptor][number] - - def FindAllExtensions(self, message_descriptor): - """Gets all the known extensions of a given message. - - Extensions have to be registered to this pool by build related - :func:`Add` or :func:`AddExtensionDescriptor`. - - Args: - message_descriptor (Descriptor): Descriptor of the extended message. - - Returns: - list[FieldDescriptor]: Field descriptors describing the extensions. - """ - # Fallback to descriptor db if FindAllExtensionNumbers is provided. - if self._descriptor_db and hasattr( - self._descriptor_db, 'FindAllExtensionNumbers'): - full_name = message_descriptor.full_name - all_numbers = self._descriptor_db.FindAllExtensionNumbers(full_name) - for number in all_numbers: - if number in self._extensions_by_number[message_descriptor]: - continue - self._TryLoadExtensionFromDB(message_descriptor, number) - - return list(self._extensions_by_number[message_descriptor].values()) - - def _TryLoadExtensionFromDB(self, message_descriptor, number): - """Try to Load extensions from descriptor db. - - Args: - message_descriptor: descriptor of the extended message. - number: the extension number that needs to be loaded. - """ - if not self._descriptor_db: - return - # Only supported when FindFileContainingExtension is provided. - if not hasattr( - self._descriptor_db, 'FindFileContainingExtension'): - return - - full_name = message_descriptor.full_name - file_proto = self._descriptor_db.FindFileContainingExtension( - full_name, number) - - if file_proto is None: - return - - try: - self._ConvertFileProtoToFileDescriptor(file_proto) - except: - warn_msg = ('Unable to load proto file %s for extension number %d.' % - (file_proto.name, number)) - warnings.warn(warn_msg, RuntimeWarning) - - def FindServiceByName(self, full_name): - """Loads the named service descriptor from the pool. - - Args: - full_name (str): The full name of the service descriptor to load. - - Returns: - ServiceDescriptor: The service descriptor for the named service. - - Raises: - KeyError: if the service cannot be found in the pool. - """ - full_name = _NormalizeFullyQualifiedName(full_name) - if full_name not in self._service_descriptors: - self._FindFileContainingSymbolInDb(full_name) - return self._service_descriptors[full_name] - - def FindMethodByName(self, full_name): - """Loads the named service method descriptor from the pool. - - Args: - full_name (str): The full name of the method descriptor to load. - - Returns: - MethodDescriptor: The method descriptor for the service method. - - Raises: - KeyError: if the method cannot be found in the pool. - """ - full_name = _NormalizeFullyQualifiedName(full_name) - service_name, _, method_name = full_name.rpartition('.') - service_descriptor = self.FindServiceByName(service_name) - return service_descriptor.methods_by_name[method_name] - - def _FindFileContainingSymbolInDb(self, symbol): - """Finds the file in descriptor DB containing the specified symbol. - - Args: - symbol (str): The name of the symbol to search for. - - Returns: - FileDescriptor: The file that contains the specified symbol. - - Raises: - KeyError: if the file cannot be found in the descriptor database. - """ - try: - file_proto = self._internal_db.FindFileContainingSymbol(symbol) - except KeyError as error: - if self._descriptor_db: - file_proto = self._descriptor_db.FindFileContainingSymbol(symbol) - else: - raise error - if not file_proto: - raise KeyError('Cannot find a file containing %s' % symbol) - return self._ConvertFileProtoToFileDescriptor(file_proto) - - def _ConvertFileProtoToFileDescriptor(self, file_proto): - """Creates a FileDescriptor from a proto or returns a cached copy. - - This method also has the side effect of loading all the symbols found in - the file into the appropriate dictionaries in the pool. - - Args: - file_proto: The proto to convert. - - Returns: - A FileDescriptor matching the passed in proto. - """ - if file_proto.name not in self._file_descriptors: - built_deps = list(self._GetDeps(file_proto.dependency)) - direct_deps = [self.FindFileByName(n) for n in file_proto.dependency] - public_deps = [direct_deps[i] for i in file_proto.public_dependency] - - file_descriptor = descriptor.FileDescriptor( - pool=self, - name=file_proto.name, - package=file_proto.package, - syntax=file_proto.syntax, - options=_OptionsOrNone(file_proto), - serialized_pb=file_proto.SerializeToString(), - dependencies=direct_deps, - public_dependencies=public_deps, - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - scope = {} - - # This loop extracts all the message and enum types from all the - # dependencies of the file_proto. This is necessary to create the - # scope of available message types when defining the passed in - # file proto. - for dependency in built_deps: - scope.update(self._ExtractSymbols( - dependency.message_types_by_name.values())) - scope.update((_PrefixWithDot(enum.full_name), enum) - for enum in dependency.enum_types_by_name.values()) - - for message_type in file_proto.message_type: - message_desc = self._ConvertMessageDescriptor( - message_type, file_proto.package, file_descriptor, scope, - file_proto.syntax) - file_descriptor.message_types_by_name[message_desc.name] = ( - message_desc) - - for enum_type in file_proto.enum_type: - file_descriptor.enum_types_by_name[enum_type.name] = ( - self._ConvertEnumDescriptor(enum_type, file_proto.package, - file_descriptor, None, scope, True)) - - for index, extension_proto in enumerate(file_proto.extension): - extension_desc = self._MakeFieldDescriptor( - extension_proto, file_proto.package, index, file_descriptor, - is_extension=True) - extension_desc.containing_type = self._GetTypeFromScope( - file_descriptor.package, extension_proto.extendee, scope) - self._SetFieldType(extension_proto, extension_desc, - file_descriptor.package, scope) - file_descriptor.extensions_by_name[extension_desc.name] = ( - extension_desc) - self._file_desc_by_toplevel_extension[extension_desc.full_name] = ( - file_descriptor) - - for desc_proto in file_proto.message_type: - self._SetAllFieldTypes(file_proto.package, desc_proto, scope) - - if file_proto.package: - desc_proto_prefix = _PrefixWithDot(file_proto.package) - else: - desc_proto_prefix = '' - - for desc_proto in file_proto.message_type: - desc = self._GetTypeFromScope( - desc_proto_prefix, desc_proto.name, scope) - file_descriptor.message_types_by_name[desc_proto.name] = desc - - for index, service_proto in enumerate(file_proto.service): - file_descriptor.services_by_name[service_proto.name] = ( - self._MakeServiceDescriptor(service_proto, index, scope, - file_proto.package, file_descriptor)) - - self._file_descriptors[file_proto.name] = file_descriptor - - # Add extensions to the pool - file_desc = self._file_descriptors[file_proto.name] - for extension in file_desc.extensions_by_name.values(): - self._AddExtensionDescriptor(extension) - for message_type in file_desc.message_types_by_name.values(): - for extension in message_type.extensions: - self._AddExtensionDescriptor(extension) - - return file_desc - - def _ConvertMessageDescriptor(self, desc_proto, package=None, file_desc=None, - scope=None, syntax=None): - """Adds the proto to the pool in the specified package. - - Args: - desc_proto: The descriptor_pb2.DescriptorProto protobuf message. - package: The package the proto should be located in. - file_desc: The file containing this message. - scope: Dict mapping short and full symbols to message and enum types. - syntax: string indicating syntax of the file ("proto2" or "proto3") - - Returns: - The added descriptor. - """ - - if package: - desc_name = '.'.join((package, desc_proto.name)) - else: - desc_name = desc_proto.name - - if file_desc is None: - file_name = None - else: - file_name = file_desc.name - - if scope is None: - scope = {} - - nested = [ - self._ConvertMessageDescriptor( - nested, desc_name, file_desc, scope, syntax) - for nested in desc_proto.nested_type] - enums = [ - self._ConvertEnumDescriptor(enum, desc_name, file_desc, None, - scope, False) - for enum in desc_proto.enum_type] - fields = [self._MakeFieldDescriptor(field, desc_name, index, file_desc) - for index, field in enumerate(desc_proto.field)] - extensions = [ - self._MakeFieldDescriptor(extension, desc_name, index, file_desc, - is_extension=True) - for index, extension in enumerate(desc_proto.extension)] - oneofs = [ - # pylint: disable=g-complex-comprehension - descriptor.OneofDescriptor( - desc.name, - '.'.join((desc_name, desc.name)), - index, - None, - [], - _OptionsOrNone(desc), - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - for index, desc in enumerate(desc_proto.oneof_decl) - ] - extension_ranges = [(r.start, r.end) for r in desc_proto.extension_range] - if extension_ranges: - is_extendable = True - else: - is_extendable = False - desc = descriptor.Descriptor( - name=desc_proto.name, - full_name=desc_name, - filename=file_name, - containing_type=None, - fields=fields, - oneofs=oneofs, - nested_types=nested, - enum_types=enums, - extensions=extensions, - options=_OptionsOrNone(desc_proto), - is_extendable=is_extendable, - extension_ranges=extension_ranges, - file=file_desc, - serialized_start=None, - serialized_end=None, - syntax=syntax, - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - for nested in desc.nested_types: - nested.containing_type = desc - for enum in desc.enum_types: - enum.containing_type = desc - for field_index, field_desc in enumerate(desc_proto.field): - if field_desc.HasField('oneof_index'): - oneof_index = field_desc.oneof_index - oneofs[oneof_index].fields.append(fields[field_index]) - fields[field_index].containing_oneof = oneofs[oneof_index] - - scope[_PrefixWithDot(desc_name)] = desc - self._CheckConflictRegister(desc, desc.full_name, desc.file.name) - self._descriptors[desc_name] = desc - return desc - - def _ConvertEnumDescriptor(self, enum_proto, package=None, file_desc=None, - containing_type=None, scope=None, top_level=False): - """Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf. - - Args: - enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message. - package: Optional package name for the new message EnumDescriptor. - file_desc: The file containing the enum descriptor. - containing_type: The type containing this enum. - scope: Scope containing available types. - top_level: If True, the enum is a top level symbol. If False, the enum - is defined inside a message. - - Returns: - The added descriptor - """ - - if package: - enum_name = '.'.join((package, enum_proto.name)) - else: - enum_name = enum_proto.name - - if file_desc is None: - file_name = None - else: - file_name = file_desc.name - - values = [self._MakeEnumValueDescriptor(value, index) - for index, value in enumerate(enum_proto.value)] - desc = descriptor.EnumDescriptor(name=enum_proto.name, - full_name=enum_name, - filename=file_name, - file=file_desc, - values=values, - containing_type=containing_type, - options=_OptionsOrNone(enum_proto), - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - scope['.%s' % enum_name] = desc - self._CheckConflictRegister(desc, desc.full_name, desc.file.name) - self._enum_descriptors[enum_name] = desc - - # Add top level enum values. - if top_level: - for value in values: - full_name = _NormalizeFullyQualifiedName( - '.'.join((package, value.name))) - self._CheckConflictRegister(value, full_name, file_name) - self._top_enum_values[full_name] = value - - return desc - - def _MakeFieldDescriptor(self, field_proto, message_name, index, - file_desc, is_extension=False): - """Creates a field descriptor from a FieldDescriptorProto. - - For message and enum type fields, this method will do a look up - in the pool for the appropriate descriptor for that type. If it - is unavailable, it will fall back to the _source function to - create it. If this type is still unavailable, construction will - fail. - - Args: - field_proto: The proto describing the field. - message_name: The name of the containing message. - index: Index of the field - file_desc: The file containing the field descriptor. - is_extension: Indication that this field is for an extension. - - Returns: - An initialized FieldDescriptor object - """ - - if message_name: - full_name = '.'.join((message_name, field_proto.name)) - else: - full_name = field_proto.name - - if field_proto.json_name: - json_name = field_proto.json_name - else: - json_name = None - - return descriptor.FieldDescriptor( - name=field_proto.name, - full_name=full_name, - index=index, - number=field_proto.number, - type=field_proto.type, - cpp_type=None, - message_type=None, - enum_type=None, - containing_type=None, - label=field_proto.label, - has_default_value=False, - default_value=None, - is_extension=is_extension, - extension_scope=None, - options=_OptionsOrNone(field_proto), - json_name=json_name, - file=file_desc, - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - - def _SetAllFieldTypes(self, package, desc_proto, scope): - """Sets all the descriptor's fields's types. - - This method also sets the containing types on any extensions. - - Args: - package: The current package of desc_proto. - desc_proto: The message descriptor to update. - scope: Enclosing scope of available types. - """ - - package = _PrefixWithDot(package) - - main_desc = self._GetTypeFromScope(package, desc_proto.name, scope) - - if package == '.': - nested_package = _PrefixWithDot(desc_proto.name) - else: - nested_package = '.'.join([package, desc_proto.name]) - - for field_proto, field_desc in zip(desc_proto.field, main_desc.fields): - self._SetFieldType(field_proto, field_desc, nested_package, scope) - - for extension_proto, extension_desc in ( - zip(desc_proto.extension, main_desc.extensions)): - extension_desc.containing_type = self._GetTypeFromScope( - nested_package, extension_proto.extendee, scope) - self._SetFieldType(extension_proto, extension_desc, nested_package, scope) - - for nested_type in desc_proto.nested_type: - self._SetAllFieldTypes(nested_package, nested_type, scope) - - def _SetFieldType(self, field_proto, field_desc, package, scope): - """Sets the field's type, cpp_type, message_type and enum_type. - - Args: - field_proto: Data about the field in proto format. - field_desc: The descriptor to modify. - package: The package the field's container is in. - scope: Enclosing scope of available types. - """ - if field_proto.type_name: - desc = self._GetTypeFromScope(package, field_proto.type_name, scope) - else: - desc = None - - if not field_proto.HasField('type'): - if isinstance(desc, descriptor.Descriptor): - field_proto.type = descriptor.FieldDescriptor.TYPE_MESSAGE - else: - field_proto.type = descriptor.FieldDescriptor.TYPE_ENUM - - field_desc.cpp_type = descriptor.FieldDescriptor.ProtoTypeToCppProtoType( - field_proto.type) - - if (field_proto.type == descriptor.FieldDescriptor.TYPE_MESSAGE - or field_proto.type == descriptor.FieldDescriptor.TYPE_GROUP): - field_desc.message_type = desc - - if field_proto.type == descriptor.FieldDescriptor.TYPE_ENUM: - field_desc.enum_type = desc - - if field_proto.label == descriptor.FieldDescriptor.LABEL_REPEATED: - field_desc.has_default_value = False - field_desc.default_value = [] - elif field_proto.HasField('default_value'): - field_desc.has_default_value = True - if (field_proto.type == descriptor.FieldDescriptor.TYPE_DOUBLE or - field_proto.type == descriptor.FieldDescriptor.TYPE_FLOAT): - field_desc.default_value = float(field_proto.default_value) - elif field_proto.type == descriptor.FieldDescriptor.TYPE_STRING: - field_desc.default_value = field_proto.default_value - elif field_proto.type == descriptor.FieldDescriptor.TYPE_BOOL: - field_desc.default_value = field_proto.default_value.lower() == 'true' - elif field_proto.type == descriptor.FieldDescriptor.TYPE_ENUM: - field_desc.default_value = field_desc.enum_type.values_by_name[ - field_proto.default_value].number - elif field_proto.type == descriptor.FieldDescriptor.TYPE_BYTES: - field_desc.default_value = text_encoding.CUnescape( - field_proto.default_value) - elif field_proto.type == descriptor.FieldDescriptor.TYPE_MESSAGE: - field_desc.default_value = None - else: - # All other types are of the "int" type. - field_desc.default_value = int(field_proto.default_value) - else: - field_desc.has_default_value = False - if (field_proto.type == descriptor.FieldDescriptor.TYPE_DOUBLE or - field_proto.type == descriptor.FieldDescriptor.TYPE_FLOAT): - field_desc.default_value = 0.0 - elif field_proto.type == descriptor.FieldDescriptor.TYPE_STRING: - field_desc.default_value = u'' - elif field_proto.type == descriptor.FieldDescriptor.TYPE_BOOL: - field_desc.default_value = False - elif field_proto.type == descriptor.FieldDescriptor.TYPE_ENUM: - field_desc.default_value = field_desc.enum_type.values[0].number - elif field_proto.type == descriptor.FieldDescriptor.TYPE_BYTES: - field_desc.default_value = b'' - elif field_proto.type == descriptor.FieldDescriptor.TYPE_MESSAGE: - field_desc.default_value = None - elif field_proto.type == descriptor.FieldDescriptor.TYPE_GROUP: - field_desc.default_value = None - else: - # All other types are of the "int" type. - field_desc.default_value = 0 - - field_desc.type = field_proto.type - - def _MakeEnumValueDescriptor(self, value_proto, index): - """Creates a enum value descriptor object from a enum value proto. - - Args: - value_proto: The proto describing the enum value. - index: The index of the enum value. - - Returns: - An initialized EnumValueDescriptor object. - """ - - return descriptor.EnumValueDescriptor( - name=value_proto.name, - index=index, - number=value_proto.number, - options=_OptionsOrNone(value_proto), - type=None, - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - - def _MakeServiceDescriptor(self, service_proto, service_index, scope, - package, file_desc): - """Make a protobuf ServiceDescriptor given a ServiceDescriptorProto. - - Args: - service_proto: The descriptor_pb2.ServiceDescriptorProto protobuf message. - service_index: The index of the service in the File. - scope: Dict mapping short and full symbols to message and enum types. - package: Optional package name for the new message EnumDescriptor. - file_desc: The file containing the service descriptor. - - Returns: - The added descriptor. - """ - - if package: - service_name = '.'.join((package, service_proto.name)) - else: - service_name = service_proto.name - - methods = [self._MakeMethodDescriptor(method_proto, service_name, package, - scope, index) - for index, method_proto in enumerate(service_proto.method)] - desc = descriptor.ServiceDescriptor( - name=service_proto.name, - full_name=service_name, - index=service_index, - methods=methods, - options=_OptionsOrNone(service_proto), - file=file_desc, - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - self._CheckConflictRegister(desc, desc.full_name, desc.file.name) - self._service_descriptors[service_name] = desc - return desc - - def _MakeMethodDescriptor(self, method_proto, service_name, package, scope, - index): - """Creates a method descriptor from a MethodDescriptorProto. - - Args: - method_proto: The proto describing the method. - service_name: The name of the containing service. - package: Optional package name to look up for types. - scope: Scope containing available types. - index: Index of the method in the service. - - Returns: - An initialized MethodDescriptor object. - """ - full_name = '.'.join((service_name, method_proto.name)) - input_type = self._GetTypeFromScope( - package, method_proto.input_type, scope) - output_type = self._GetTypeFromScope( - package, method_proto.output_type, scope) - return descriptor.MethodDescriptor( - name=method_proto.name, - full_name=full_name, - index=index, - containing_service=None, - input_type=input_type, - output_type=output_type, - client_streaming=method_proto.client_streaming, - server_streaming=method_proto.server_streaming, - options=_OptionsOrNone(method_proto), - # pylint: disable=protected-access - create_key=descriptor._internal_create_key) - - def _ExtractSymbols(self, descriptors): - """Pulls out all the symbols from descriptor protos. - - Args: - descriptors: The messages to extract descriptors from. - Yields: - A two element tuple of the type name and descriptor object. - """ - - for desc in descriptors: - yield (_PrefixWithDot(desc.full_name), desc) - for symbol in self._ExtractSymbols(desc.nested_types): - yield symbol - for enum in desc.enum_types: - yield (_PrefixWithDot(enum.full_name), enum) - - def _GetDeps(self, dependencies, visited=None): - """Recursively finds dependencies for file protos. - - Args: - dependencies: The names of the files being depended on. - visited: The names of files already found. - - Yields: - Each direct and indirect dependency. - """ - - visited = visited or set() - for dependency in dependencies: - if dependency not in visited: - visited.add(dependency) - dep_desc = self.FindFileByName(dependency) - yield dep_desc - public_files = [d.name for d in dep_desc.public_dependencies] - yield from self._GetDeps(public_files, visited) - - def _GetTypeFromScope(self, package, type_name, scope): - """Finds a given type name in the current scope. - - Args: - package: The package the proto should be located in. - type_name: The name of the type to be found in the scope. - scope: Dict mapping short and full symbols to message and enum types. - - Returns: - The descriptor for the requested type. - """ - if type_name not in scope: - components = _PrefixWithDot(package).split('.') - while components: - possible_match = '.'.join(components + [type_name]) - if possible_match in scope: - type_name = possible_match - break - else: - components.pop(-1) - return scope[type_name] - - -def _PrefixWithDot(name): - return name if name.startswith('.') else '.%s' % name - - -if _USE_C_DESCRIPTORS: - # TODO(amauryfa): This pool could be constructed from Python code, when we - # support a flag like 'use_cpp_generated_pool=True'. - # pylint: disable=protected-access - _DEFAULT = descriptor._message.default_pool -else: - _DEFAULT = DescriptorPool() - - -def Default(): - return _DEFAULT diff --git a/opensafely/_vendor/google/protobuf/duration_pb2.py b/opensafely/_vendor/google/protobuf/duration_pb2.py deleted file mode 100644 index 825980bc..00000000 --- a/opensafely/_vendor/google/protobuf/duration_pb2.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/duration.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1egoogle/protobuf/duration.proto\x12\x0fgoogle.protobuf\"*\n\x08\x44uration\x12\x0f\n\x07seconds\x18\x01 \x01(\x03\x12\r\n\x05nanos\x18\x02 \x01(\x05\x42\x83\x01\n\x13\x63om.google.protobufB\rDurationProtoP\x01Z1google.golang.org/protobuf/types/known/durationpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.duration_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\rDurationProtoP\001Z1google.golang.org/protobuf/types/known/durationpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _DURATION._serialized_start=51 - _DURATION._serialized_end=93 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/empty_pb2.py b/opensafely/_vendor/google/protobuf/empty_pb2.py deleted file mode 100644 index 9b0d55a7..00000000 --- a/opensafely/_vendor/google/protobuf/empty_pb2.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/empty.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bgoogle/protobuf/empty.proto\x12\x0fgoogle.protobuf\"\x07\n\x05\x45mptyB}\n\x13\x63om.google.protobufB\nEmptyProtoP\x01Z.google.golang.org/protobuf/types/known/emptypb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.empty_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\nEmptyProtoP\001Z.google.golang.org/protobuf/types/known/emptypb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _EMPTY._serialized_start=48 - _EMPTY._serialized_end=55 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/field_mask_pb2.py b/opensafely/_vendor/google/protobuf/field_mask_pb2.py deleted file mode 100644 index 4a20bf8d..00000000 --- a/opensafely/_vendor/google/protobuf/field_mask_pb2.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/field_mask.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n google/protobuf/field_mask.proto\x12\x0fgoogle.protobuf\"\x1a\n\tFieldMask\x12\r\n\x05paths\x18\x01 \x03(\tB\x85\x01\n\x13\x63om.google.protobufB\x0e\x46ieldMaskProtoP\x01Z2google.golang.org/protobuf/types/known/fieldmaskpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.field_mask_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\016FieldMaskProtoP\001Z2google.golang.org/protobuf/types/known/fieldmaskpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _FIELDMASK._serialized_start=53 - _FIELDMASK._serialized_end=79 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/internal/__init__.py b/opensafely/_vendor/google/protobuf/internal/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/protobuf/internal/api_implementation.py b/opensafely/_vendor/google/protobuf/internal/api_implementation.py deleted file mode 100644 index 6c0dd8bd..00000000 --- a/opensafely/_vendor/google/protobuf/internal/api_implementation.py +++ /dev/null @@ -1,112 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Determine which implementation of the protobuf API is used in this process. -""" - -import os -import sys -import warnings - -try: - # pylint: disable=g-import-not-at-top - from opensafely._vendor.google.protobuf.internal import _api_implementation - # The compile-time constants in the _api_implementation module can be used to - # switch to a certain implementation of the Python API at build time. - _api_version = _api_implementation.api_version -except ImportError: - _api_version = -1 # Unspecified by compiler flags. - -if _api_version == 1: - raise ValueError('api_version=1 is no longer supported.') - - -_default_implementation_type = ('cpp' if _api_version > 0 else 'python') - - -# This environment variable can be used to switch to a certain implementation -# of the Python API, overriding the compile-time constants in the -# _api_implementation module. Right now only 'python' and 'cpp' are valid -# values. Any other value will be ignored. -_implementation_type = os.getenv('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION', - _default_implementation_type) - -if _implementation_type != 'python': - _implementation_type = 'cpp' - -if 'PyPy' in sys.version and _implementation_type == 'cpp': - warnings.warn('PyPy does not work yet with cpp protocol buffers. ' - 'Falling back to the python implementation.') - _implementation_type = 'python' - - -# Detect if serialization should be deterministic by default -try: - # The presence of this module in a build allows the proto implementation to - # be upgraded merely via build deps. - # - # NOTE: Merely importing this automatically enables deterministic proto - # serialization for C++ code, but we still need to export it as a boolean so - # that we can do the same for `_implementation_type == 'python'`. - # - # NOTE2: It is possible for C++ code to enable deterministic serialization by - # default _without_ affecting Python code, if the C++ implementation is not in - # use by this module. That is intended behavior, so we don't actually expose - # this boolean outside of this module. - # - # pylint: disable=g-import-not-at-top,unused-import - from opensafely._vendor.google.protobuf import enable_deterministic_proto_serialization - _python_deterministic_proto_serialization = True -except ImportError: - _python_deterministic_proto_serialization = False - - -# Usage of this function is discouraged. Clients shouldn't care which -# implementation of the API is in use. Note that there is no guarantee -# that differences between APIs will be maintained. -# Please don't use this function if possible. -def Type(): - return _implementation_type - - -def _SetType(implementation_type): - """Never use! Only for protobuf benchmark.""" - global _implementation_type - _implementation_type = implementation_type - - -# See comment on 'Type' above. -def Version(): - return 2 - - -# For internal use only -def IsPythonDefaultSerializationDeterministic(): - return _python_deterministic_proto_serialization diff --git a/opensafely/_vendor/google/protobuf/internal/builder.py b/opensafely/_vendor/google/protobuf/internal/builder.py deleted file mode 100644 index 4c4e5eb5..00000000 --- a/opensafely/_vendor/google/protobuf/internal/builder.py +++ /dev/null @@ -1,130 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Builds descriptors, message classes and services for generated _pb2.py. - -This file is only called in python generated _pb2.py files. It builds -descriptors, message classes and services that users can directly use -in generated code. -""" - -__author__ = 'jieluo@google.com (Jie Luo)' - -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -_sym_db = _symbol_database.Default() - - -def BuildMessageAndEnumDescriptors(file_des, module): - """Builds message and enum descriptors. - - Args: - file_des: FileDescriptor of the .proto file - module: Generated _pb2 module - """ - - def BuildNestedDescriptors(msg_des, prefix): - for (name, nested_msg) in msg_des.nested_types_by_name.items(): - module_name = prefix + name.upper() - module[module_name] = nested_msg - BuildNestedDescriptors(nested_msg, module_name + '_') - for enum_des in msg_des.enum_types: - module[prefix + enum_des.name.upper()] = enum_des - - for (name, msg_des) in file_des.message_types_by_name.items(): - module_name = '_' + name.upper() - module[module_name] = msg_des - BuildNestedDescriptors(msg_des, module_name + '_') - - -def BuildTopDescriptorsAndMessages(file_des, module_name, module): - """Builds top level descriptors and message classes. - - Args: - file_des: FileDescriptor of the .proto file - module_name: str, the name of generated _pb2 module - module: Generated _pb2 module - """ - - def BuildMessage(msg_des): - create_dict = {} - for (name, nested_msg) in msg_des.nested_types_by_name.items(): - create_dict[name] = BuildMessage(nested_msg) - create_dict['DESCRIPTOR'] = msg_des - create_dict['__module__'] = module_name - message_class = _reflection.GeneratedProtocolMessageType( - msg_des.name, (_message.Message,), create_dict) - _sym_db.RegisterMessage(message_class) - return message_class - - # top level enums - for (name, enum_des) in file_des.enum_types_by_name.items(): - module['_' + name.upper()] = enum_des - module[name] = enum_type_wrapper.EnumTypeWrapper(enum_des) - for enum_value in enum_des.values: - module[enum_value.name] = enum_value.number - - # top level extensions - for (name, extension_des) in file_des.extensions_by_name.items(): - module[name.upper() + '_FIELD_NUMBER'] = extension_des.number - module[name] = extension_des - - # services - for (name, service) in file_des.services_by_name.items(): - module['_' + name.upper()] = service - - # Build messages. - for (name, msg_des) in file_des.message_types_by_name.items(): - module[name] = BuildMessage(msg_des) - - -def BuildServices(file_des, module_name, module): - """Builds services classes and services stub class. - - Args: - file_des: FileDescriptor of the .proto file - module_name: str, the name of generated _pb2 module - module: Generated _pb2 module - """ - # pylint: disable=g-import-not-at-top - from opensafely._vendor.google.protobuf import service as _service - from opensafely._vendor.google.protobuf import service_reflection - # pylint: enable=g-import-not-at-top - for (name, service) in file_des.services_by_name.items(): - module[name] = service_reflection.GeneratedServiceType( - name, (_service.Service,), - dict(DESCRIPTOR=service, __module__=module_name)) - stub_name = name + '_Stub' - module[stub_name] = service_reflection.GeneratedServiceStubType( - stub_name, (module[name],), - dict(DESCRIPTOR=service, __module__=module_name)) diff --git a/opensafely/_vendor/google/protobuf/internal/containers.py b/opensafely/_vendor/google/protobuf/internal/containers.py deleted file mode 100644 index 29fbb53d..00000000 --- a/opensafely/_vendor/google/protobuf/internal/containers.py +++ /dev/null @@ -1,710 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Contains container classes to represent different protocol buffer types. - -This file defines container classes which represent categories of protocol -buffer field types which need extra maintenance. Currently these categories -are: - -- Repeated scalar fields - These are all repeated fields which aren't - composite (e.g. they are of simple types like int32, string, etc). -- Repeated composite fields - Repeated fields which are composite. This - includes groups and nested messages. -""" - -import collections.abc -import copy -import pickle -from typing import ( - Any, - Iterable, - Iterator, - List, - MutableMapping, - MutableSequence, - NoReturn, - Optional, - Sequence, - TypeVar, - Union, - overload, -) - - -_T = TypeVar('_T') -_K = TypeVar('_K') -_V = TypeVar('_V') - - -class BaseContainer(Sequence[_T]): - """Base container class.""" - - # Minimizes memory usage and disallows assignment to other attributes. - __slots__ = ['_message_listener', '_values'] - - def __init__(self, message_listener: Any) -> None: - """ - Args: - message_listener: A MessageListener implementation. - The RepeatedScalarFieldContainer will call this object's - Modified() method when it is modified. - """ - self._message_listener = message_listener - self._values = [] - - @overload - def __getitem__(self, key: int) -> _T: - ... - - @overload - def __getitem__(self, key: slice) -> List[_T]: - ... - - def __getitem__(self, key): - """Retrieves item by the specified key.""" - return self._values[key] - - def __len__(self) -> int: - """Returns the number of elements in the container.""" - return len(self._values) - - def __ne__(self, other: Any) -> bool: - """Checks if another instance isn't equal to this one.""" - # The concrete classes should define __eq__. - return not self == other - - __hash__ = None - - def __repr__(self) -> str: - return repr(self._values) - - def sort(self, *args, **kwargs) -> None: - # Continue to support the old sort_function keyword argument. - # This is expected to be a rare occurrence, so use LBYL to avoid - # the overhead of actually catching KeyError. - if 'sort_function' in kwargs: - kwargs['cmp'] = kwargs.pop('sort_function') - self._values.sort(*args, **kwargs) - - def reverse(self) -> None: - self._values.reverse() - - -# TODO(slebedev): Remove this. BaseContainer does *not* conform to -# MutableSequence, only its subclasses do. -collections.abc.MutableSequence.register(BaseContainer) - - -class RepeatedScalarFieldContainer(BaseContainer[_T], MutableSequence[_T]): - """Simple, type-checked, list-like container for holding repeated scalars.""" - - # Disallows assignment to other attributes. - __slots__ = ['_type_checker'] - - def __init__( - self, - message_listener: Any, - type_checker: Any, - ) -> None: - """Args: - - message_listener: A MessageListener implementation. The - RepeatedScalarFieldContainer will call this object's Modified() method - when it is modified. - type_checker: A type_checkers.ValueChecker instance to run on elements - inserted into this container. - """ - super().__init__(message_listener) - self._type_checker = type_checker - - def append(self, value: _T) -> None: - """Appends an item to the list. Similar to list.append().""" - self._values.append(self._type_checker.CheckValue(value)) - if not self._message_listener.dirty: - self._message_listener.Modified() - - def insert(self, key: int, value: _T) -> None: - """Inserts the item at the specified position. Similar to list.insert().""" - self._values.insert(key, self._type_checker.CheckValue(value)) - if not self._message_listener.dirty: - self._message_listener.Modified() - - def extend(self, elem_seq: Iterable[_T]) -> None: - """Extends by appending the given iterable. Similar to list.extend().""" - if elem_seq is None: - return - try: - elem_seq_iter = iter(elem_seq) - except TypeError: - if not elem_seq: - # silently ignore falsy inputs :-/. - # TODO(ptucker): Deprecate this behavior. b/18413862 - return - raise - - new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter] - if new_values: - self._values.extend(new_values) - self._message_listener.Modified() - - def MergeFrom( - self, - other: Union['RepeatedScalarFieldContainer[_T]', Iterable[_T]], - ) -> None: - """Appends the contents of another repeated field of the same type to this - one. We do not check the types of the individual fields. - """ - self._values.extend(other) - self._message_listener.Modified() - - def remove(self, elem: _T): - """Removes an item from the list. Similar to list.remove().""" - self._values.remove(elem) - self._message_listener.Modified() - - def pop(self, key: Optional[int] = -1) -> _T: - """Removes and returns an item at a given index. Similar to list.pop().""" - value = self._values[key] - self.__delitem__(key) - return value - - @overload - def __setitem__(self, key: int, value: _T) -> None: - ... - - @overload - def __setitem__(self, key: slice, value: Iterable[_T]) -> None: - ... - - def __setitem__(self, key, value) -> None: - """Sets the item on the specified position.""" - if isinstance(key, slice): - if key.step is not None: - raise ValueError('Extended slices not supported') - self._values[key] = map(self._type_checker.CheckValue, value) - self._message_listener.Modified() - else: - self._values[key] = self._type_checker.CheckValue(value) - self._message_listener.Modified() - - def __delitem__(self, key: Union[int, slice]) -> None: - """Deletes the item at the specified position.""" - del self._values[key] - self._message_listener.Modified() - - def __eq__(self, other: Any) -> bool: - """Compares the current instance with another one.""" - if self is other: - return True - # Special case for the same type which should be common and fast. - if isinstance(other, self.__class__): - return other._values == self._values - # We are presumably comparing against some other sequence type. - return other == self._values - - def __deepcopy__( - self, - unused_memo: Any = None, - ) -> 'RepeatedScalarFieldContainer[_T]': - clone = RepeatedScalarFieldContainer( - copy.deepcopy(self._message_listener), self._type_checker) - clone.MergeFrom(self) - return clone - - def __reduce__(self, **kwargs) -> NoReturn: - raise pickle.PickleError( - "Can't pickle repeated scalar fields, convert to list first") - - -# TODO(slebedev): Constrain T to be a subtype of Message. -class RepeatedCompositeFieldContainer(BaseContainer[_T], MutableSequence[_T]): - """Simple, list-like container for holding repeated composite fields.""" - - # Disallows assignment to other attributes. - __slots__ = ['_message_descriptor'] - - def __init__(self, message_listener: Any, message_descriptor: Any) -> None: - """ - Note that we pass in a descriptor instead of the generated directly, - since at the time we construct a _RepeatedCompositeFieldContainer we - haven't yet necessarily initialized the type that will be contained in the - container. - - Args: - message_listener: A MessageListener implementation. - The RepeatedCompositeFieldContainer will call this object's - Modified() method when it is modified. - message_descriptor: A Descriptor instance describing the protocol type - that should be present in this container. We'll use the - _concrete_class field of this descriptor when the client calls add(). - """ - super().__init__(message_listener) - self._message_descriptor = message_descriptor - - def add(self, **kwargs: Any) -> _T: - """Adds a new element at the end of the list and returns it. Keyword - arguments may be used to initialize the element. - """ - new_element = self._message_descriptor._concrete_class(**kwargs) - new_element._SetListener(self._message_listener) - self._values.append(new_element) - if not self._message_listener.dirty: - self._message_listener.Modified() - return new_element - - def append(self, value: _T) -> None: - """Appends one element by copying the message.""" - new_element = self._message_descriptor._concrete_class() - new_element._SetListener(self._message_listener) - new_element.CopyFrom(value) - self._values.append(new_element) - if not self._message_listener.dirty: - self._message_listener.Modified() - - def insert(self, key: int, value: _T) -> None: - """Inserts the item at the specified position by copying.""" - new_element = self._message_descriptor._concrete_class() - new_element._SetListener(self._message_listener) - new_element.CopyFrom(value) - self._values.insert(key, new_element) - if not self._message_listener.dirty: - self._message_listener.Modified() - - def extend(self, elem_seq: Iterable[_T]) -> None: - """Extends by appending the given sequence of elements of the same type - - as this one, copying each individual message. - """ - message_class = self._message_descriptor._concrete_class - listener = self._message_listener - values = self._values - for message in elem_seq: - new_element = message_class() - new_element._SetListener(listener) - new_element.MergeFrom(message) - values.append(new_element) - listener.Modified() - - def MergeFrom( - self, - other: Union['RepeatedCompositeFieldContainer[_T]', Iterable[_T]], - ) -> None: - """Appends the contents of another repeated field of the same type to this - one, copying each individual message. - """ - self.extend(other) - - def remove(self, elem: _T) -> None: - """Removes an item from the list. Similar to list.remove().""" - self._values.remove(elem) - self._message_listener.Modified() - - def pop(self, key: Optional[int] = -1) -> _T: - """Removes and returns an item at a given index. Similar to list.pop().""" - value = self._values[key] - self.__delitem__(key) - return value - - @overload - def __setitem__(self, key: int, value: _T) -> None: - ... - - @overload - def __setitem__(self, key: slice, value: Iterable[_T]) -> None: - ... - - def __setitem__(self, key, value): - # This method is implemented to make RepeatedCompositeFieldContainer - # structurally compatible with typing.MutableSequence. It is - # otherwise unsupported and will always raise an error. - raise TypeError( - f'{self.__class__.__name__} object does not support item assignment') - - def __delitem__(self, key: Union[int, slice]) -> None: - """Deletes the item at the specified position.""" - del self._values[key] - self._message_listener.Modified() - - def __eq__(self, other: Any) -> bool: - """Compares the current instance with another one.""" - if self is other: - return True - if not isinstance(other, self.__class__): - raise TypeError('Can only compare repeated composite fields against ' - 'other repeated composite fields.') - return self._values == other._values - - -class ScalarMap(MutableMapping[_K, _V]): - """Simple, type-checked, dict-like container for holding repeated scalars.""" - - # Disallows assignment to other attributes. - __slots__ = ['_key_checker', '_value_checker', '_values', '_message_listener', - '_entry_descriptor'] - - def __init__( - self, - message_listener: Any, - key_checker: Any, - value_checker: Any, - entry_descriptor: Any, - ) -> None: - """ - Args: - message_listener: A MessageListener implementation. - The ScalarMap will call this object's Modified() method when it - is modified. - key_checker: A type_checkers.ValueChecker instance to run on keys - inserted into this container. - value_checker: A type_checkers.ValueChecker instance to run on values - inserted into this container. - entry_descriptor: The MessageDescriptor of a map entry: key and value. - """ - self._message_listener = message_listener - self._key_checker = key_checker - self._value_checker = value_checker - self._entry_descriptor = entry_descriptor - self._values = {} - - def __getitem__(self, key: _K) -> _V: - try: - return self._values[key] - except KeyError: - key = self._key_checker.CheckValue(key) - val = self._value_checker.DefaultValue() - self._values[key] = val - return val - - def __contains__(self, item: _K) -> bool: - # We check the key's type to match the strong-typing flavor of the API. - # Also this makes it easier to match the behavior of the C++ implementation. - self._key_checker.CheckValue(item) - return item in self._values - - @overload - def get(self, key: _K) -> Optional[_V]: - ... - - @overload - def get(self, key: _K, default: _T) -> Union[_V, _T]: - ... - - # We need to override this explicitly, because our defaultdict-like behavior - # will make the default implementation (from our base class) always insert - # the key. - def get(self, key, default=None): - if key in self: - return self[key] - else: - return default - - def __setitem__(self, key: _K, value: _V) -> _T: - checked_key = self._key_checker.CheckValue(key) - checked_value = self._value_checker.CheckValue(value) - self._values[checked_key] = checked_value - self._message_listener.Modified() - - def __delitem__(self, key: _K) -> None: - del self._values[key] - self._message_listener.Modified() - - def __len__(self) -> int: - return len(self._values) - - def __iter__(self) -> Iterator[_K]: - return iter(self._values) - - def __repr__(self) -> str: - return repr(self._values) - - def MergeFrom(self, other: 'ScalarMap[_K, _V]') -> None: - self._values.update(other._values) - self._message_listener.Modified() - - def InvalidateIterators(self) -> None: - # It appears that the only way to reliably invalidate iterators to - # self._values is to ensure that its size changes. - original = self._values - self._values = original.copy() - original[None] = None - - # This is defined in the abstract base, but we can do it much more cheaply. - def clear(self) -> None: - self._values.clear() - self._message_listener.Modified() - - def GetEntryClass(self) -> Any: - return self._entry_descriptor._concrete_class - - -class MessageMap(MutableMapping[_K, _V]): - """Simple, type-checked, dict-like container for with submessage values.""" - - # Disallows assignment to other attributes. - __slots__ = ['_key_checker', '_values', '_message_listener', - '_message_descriptor', '_entry_descriptor'] - - def __init__( - self, - message_listener: Any, - message_descriptor: Any, - key_checker: Any, - entry_descriptor: Any, - ) -> None: - """ - Args: - message_listener: A MessageListener implementation. - The ScalarMap will call this object's Modified() method when it - is modified. - key_checker: A type_checkers.ValueChecker instance to run on keys - inserted into this container. - value_checker: A type_checkers.ValueChecker instance to run on values - inserted into this container. - entry_descriptor: The MessageDescriptor of a map entry: key and value. - """ - self._message_listener = message_listener - self._message_descriptor = message_descriptor - self._key_checker = key_checker - self._entry_descriptor = entry_descriptor - self._values = {} - - def __getitem__(self, key: _K) -> _V: - key = self._key_checker.CheckValue(key) - try: - return self._values[key] - except KeyError: - new_element = self._message_descriptor._concrete_class() - new_element._SetListener(self._message_listener) - self._values[key] = new_element - self._message_listener.Modified() - return new_element - - def get_or_create(self, key: _K) -> _V: - """get_or_create() is an alias for getitem (ie. map[key]). - - Args: - key: The key to get or create in the map. - - This is useful in cases where you want to be explicit that the call is - mutating the map. This can avoid lint errors for statements like this - that otherwise would appear to be pointless statements: - - msg.my_map[key] - """ - return self[key] - - @overload - def get(self, key: _K) -> Optional[_V]: - ... - - @overload - def get(self, key: _K, default: _T) -> Union[_V, _T]: - ... - - # We need to override this explicitly, because our defaultdict-like behavior - # will make the default implementation (from our base class) always insert - # the key. - def get(self, key, default=None): - if key in self: - return self[key] - else: - return default - - def __contains__(self, item: _K) -> bool: - item = self._key_checker.CheckValue(item) - return item in self._values - - def __setitem__(self, key: _K, value: _V) -> NoReturn: - raise ValueError('May not set values directly, call my_map[key].foo = 5') - - def __delitem__(self, key: _K) -> None: - key = self._key_checker.CheckValue(key) - del self._values[key] - self._message_listener.Modified() - - def __len__(self) -> int: - return len(self._values) - - def __iter__(self) -> Iterator[_K]: - return iter(self._values) - - def __repr__(self) -> str: - return repr(self._values) - - def MergeFrom(self, other: 'MessageMap[_K, _V]') -> None: - # pylint: disable=protected-access - for key in other._values: - # According to documentation: "When parsing from the wire or when merging, - # if there are duplicate map keys the last key seen is used". - if key in self: - del self[key] - self[key].CopyFrom(other[key]) - # self._message_listener.Modified() not required here, because - # mutations to submessages already propagate. - - def InvalidateIterators(self) -> None: - # It appears that the only way to reliably invalidate iterators to - # self._values is to ensure that its size changes. - original = self._values - self._values = original.copy() - original[None] = None - - # This is defined in the abstract base, but we can do it much more cheaply. - def clear(self) -> None: - self._values.clear() - self._message_listener.Modified() - - def GetEntryClass(self) -> Any: - return self._entry_descriptor._concrete_class - - -class _UnknownField: - """A parsed unknown field.""" - - # Disallows assignment to other attributes. - __slots__ = ['_field_number', '_wire_type', '_data'] - - def __init__(self, field_number, wire_type, data): - self._field_number = field_number - self._wire_type = wire_type - self._data = data - return - - def __lt__(self, other): - # pylint: disable=protected-access - return self._field_number < other._field_number - - def __eq__(self, other): - if self is other: - return True - # pylint: disable=protected-access - return (self._field_number == other._field_number and - self._wire_type == other._wire_type and - self._data == other._data) - - -class UnknownFieldRef: # pylint: disable=missing-class-docstring - - def __init__(self, parent, index): - self._parent = parent - self._index = index - - def _check_valid(self): - if not self._parent: - raise ValueError('UnknownField does not exist. ' - 'The parent message might be cleared.') - if self._index >= len(self._parent): - raise ValueError('UnknownField does not exist. ' - 'The parent message might be cleared.') - - @property - def field_number(self): - self._check_valid() - # pylint: disable=protected-access - return self._parent._internal_get(self._index)._field_number - - @property - def wire_type(self): - self._check_valid() - # pylint: disable=protected-access - return self._parent._internal_get(self._index)._wire_type - - @property - def data(self): - self._check_valid() - # pylint: disable=protected-access - return self._parent._internal_get(self._index)._data - - -class UnknownFieldSet: - """UnknownField container""" - - # Disallows assignment to other attributes. - __slots__ = ['_values'] - - def __init__(self): - self._values = [] - - def __getitem__(self, index): - if self._values is None: - raise ValueError('UnknownFields does not exist. ' - 'The parent message might be cleared.') - size = len(self._values) - if index < 0: - index += size - if index < 0 or index >= size: - raise IndexError('index %d out of range'.index) - - return UnknownFieldRef(self, index) - - def _internal_get(self, index): - return self._values[index] - - def __len__(self): - if self._values is None: - raise ValueError('UnknownFields does not exist. ' - 'The parent message might be cleared.') - return len(self._values) - - def _add(self, field_number, wire_type, data): - unknown_field = _UnknownField(field_number, wire_type, data) - self._values.append(unknown_field) - return unknown_field - - def __iter__(self): - for i in range(len(self)): - yield UnknownFieldRef(self, i) - - def _extend(self, other): - if other is None: - return - # pylint: disable=protected-access - self._values.extend(other._values) - - def __eq__(self, other): - if self is other: - return True - # Sort unknown fields because their order shouldn't - # affect equality test. - values = list(self._values) - if other is None: - return not values - values.sort() - # pylint: disable=protected-access - other_values = sorted(other._values) - return values == other_values - - def _clear(self): - for value in self._values: - # pylint: disable=protected-access - if isinstance(value._data, UnknownFieldSet): - value._data._clear() # pylint: disable=protected-access - self._values = None diff --git a/opensafely/_vendor/google/protobuf/internal/decoder.py b/opensafely/_vendor/google/protobuf/internal/decoder.py deleted file mode 100644 index 1c056598..00000000 --- a/opensafely/_vendor/google/protobuf/internal/decoder.py +++ /dev/null @@ -1,1029 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Code for decoding protocol buffer primitives. - -This code is very similar to encoder.py -- read the docs for that module first. - -A "decoder" is a function with the signature: - Decode(buffer, pos, end, message, field_dict) -The arguments are: - buffer: The string containing the encoded message. - pos: The current position in the string. - end: The position in the string where the current message ends. May be - less than len(buffer) if we're reading a sub-message. - message: The message object into which we're parsing. - field_dict: message._fields (avoids a hashtable lookup). -The decoder reads the field and stores it into field_dict, returning the new -buffer position. A decoder for a repeated field may proactively decode all of -the elements of that field, if they appear consecutively. - -Note that decoders may throw any of the following: - IndexError: Indicates a truncated message. - struct.error: Unpacking of a fixed-width field failed. - message.DecodeError: Other errors. - -Decoders are expected to raise an exception if they are called with pos > end. -This allows callers to be lax about bounds checking: it's fineto read past -"end" as long as you are sure that someone else will notice and throw an -exception later on. - -Something up the call stack is expected to catch IndexError and struct.error -and convert them to message.DecodeError. - -Decoders are constructed using decoder constructors with the signature: - MakeDecoder(field_number, is_repeated, is_packed, key, new_default) -The arguments are: - field_number: The field number of the field we want to decode. - is_repeated: Is the field a repeated field? (bool) - is_packed: Is the field a packed field? (bool) - key: The key to use when looking up the field within field_dict. - (This is actually the FieldDescriptor but nothing in this - file should depend on that.) - new_default: A function which takes a message object as a parameter and - returns a new instance of the default value for this field. - (This is called for repeated fields and sub-messages, when an - instance does not already exist.) - -As with encoders, we define a decoder constructor for every type of field. -Then, for every field of every message class we construct an actual decoder. -That decoder goes into a dict indexed by tag, so when we decode a message -we repeatedly read a tag, look up the corresponding decoder, and invoke it. -""" - -__author__ = 'kenton@google.com (Kenton Varda)' - -import math -import struct - -from opensafely._vendor.google.protobuf.internal import containers -from opensafely._vendor.google.protobuf.internal import encoder -from opensafely._vendor.google.protobuf.internal import wire_format -from opensafely._vendor.google.protobuf import message - - -# This is not for optimization, but rather to avoid conflicts with local -# variables named "message". -_DecodeError = message.DecodeError - - -def _VarintDecoder(mask, result_type): - """Return an encoder for a basic varint value (does not include tag). - - Decoded values will be bitwise-anded with the given mask before being - returned, e.g. to limit them to 32 bits. The returned decoder does not - take the usual "end" parameter -- the caller is expected to do bounds checking - after the fact (often the caller can defer such checking until later). The - decoder returns a (value, new_pos) pair. - """ - - def DecodeVarint(buffer, pos): - result = 0 - shift = 0 - while 1: - b = buffer[pos] - result |= ((b & 0x7f) << shift) - pos += 1 - if not (b & 0x80): - result &= mask - result = result_type(result) - return (result, pos) - shift += 7 - if shift >= 64: - raise _DecodeError('Too many bytes when decoding varint.') - return DecodeVarint - - -def _SignedVarintDecoder(bits, result_type): - """Like _VarintDecoder() but decodes signed values.""" - - signbit = 1 << (bits - 1) - mask = (1 << bits) - 1 - - def DecodeVarint(buffer, pos): - result = 0 - shift = 0 - while 1: - b = buffer[pos] - result |= ((b & 0x7f) << shift) - pos += 1 - if not (b & 0x80): - result &= mask - result = (result ^ signbit) - signbit - result = result_type(result) - return (result, pos) - shift += 7 - if shift >= 64: - raise _DecodeError('Too many bytes when decoding varint.') - return DecodeVarint - -# All 32-bit and 64-bit values are represented as int. -_DecodeVarint = _VarintDecoder((1 << 64) - 1, int) -_DecodeSignedVarint = _SignedVarintDecoder(64, int) - -# Use these versions for values which must be limited to 32 bits. -_DecodeVarint32 = _VarintDecoder((1 << 32) - 1, int) -_DecodeSignedVarint32 = _SignedVarintDecoder(32, int) - - -def ReadTag(buffer, pos): - """Read a tag from the memoryview, and return a (tag_bytes, new_pos) tuple. - - We return the raw bytes of the tag rather than decoding them. The raw - bytes can then be used to look up the proper decoder. This effectively allows - us to trade some work that would be done in pure-python (decoding a varint) - for work that is done in C (searching for a byte string in a hash table). - In a low-level language it would be much cheaper to decode the varint and - use that, but not in Python. - - Args: - buffer: memoryview object of the encoded bytes - pos: int of the current position to start from - - Returns: - Tuple[bytes, int] of the tag data and new position. - """ - start = pos - while buffer[pos] & 0x80: - pos += 1 - pos += 1 - - tag_bytes = buffer[start:pos].tobytes() - return tag_bytes, pos - - -# -------------------------------------------------------------------- - - -def _SimpleDecoder(wire_type, decode_value): - """Return a constructor for a decoder for fields of a particular type. - - Args: - wire_type: The field's wire type. - decode_value: A function which decodes an individual value, e.g. - _DecodeVarint() - """ - - def SpecificDecoder(field_number, is_repeated, is_packed, key, new_default, - clear_if_default=False): - if is_packed: - local_DecodeVarint = _DecodeVarint - def DecodePackedField(buffer, pos, end, message, field_dict): - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - (endpoint, pos) = local_DecodeVarint(buffer, pos) - endpoint += pos - if endpoint > end: - raise _DecodeError('Truncated message.') - while pos < endpoint: - (element, pos) = decode_value(buffer, pos) - value.append(element) - if pos > endpoint: - del value[-1] # Discard corrupt value. - raise _DecodeError('Packed element was truncated.') - return pos - return DecodePackedField - elif is_repeated: - tag_bytes = encoder.TagBytes(field_number, wire_type) - tag_len = len(tag_bytes) - def DecodeRepeatedField(buffer, pos, end, message, field_dict): - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - while 1: - (element, new_pos) = decode_value(buffer, pos) - value.append(element) - # Predict that the next tag is another copy of the same repeated - # field. - pos = new_pos + tag_len - if buffer[new_pos:pos] != tag_bytes or new_pos >= end: - # Prediction failed. Return. - if new_pos > end: - raise _DecodeError('Truncated message.') - return new_pos - return DecodeRepeatedField - else: - def DecodeField(buffer, pos, end, message, field_dict): - (new_value, pos) = decode_value(buffer, pos) - if pos > end: - raise _DecodeError('Truncated message.') - if clear_if_default and not new_value: - field_dict.pop(key, None) - else: - field_dict[key] = new_value - return pos - return DecodeField - - return SpecificDecoder - - -def _ModifiedDecoder(wire_type, decode_value, modify_value): - """Like SimpleDecoder but additionally invokes modify_value on every value - before storing it. Usually modify_value is ZigZagDecode. - """ - - # Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but - # not enough to make a significant difference. - - def InnerDecode(buffer, pos): - (result, new_pos) = decode_value(buffer, pos) - return (modify_value(result), new_pos) - return _SimpleDecoder(wire_type, InnerDecode) - - -def _StructPackDecoder(wire_type, format): - """Return a constructor for a decoder for a fixed-width field. - - Args: - wire_type: The field's wire type. - format: The format string to pass to struct.unpack(). - """ - - value_size = struct.calcsize(format) - local_unpack = struct.unpack - - # Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but - # not enough to make a significant difference. - - # Note that we expect someone up-stack to catch struct.error and convert - # it to _DecodeError -- this way we don't have to set up exception- - # handling blocks every time we parse one value. - - def InnerDecode(buffer, pos): - new_pos = pos + value_size - result = local_unpack(format, buffer[pos:new_pos])[0] - return (result, new_pos) - return _SimpleDecoder(wire_type, InnerDecode) - - -def _FloatDecoder(): - """Returns a decoder for a float field. - - This code works around a bug in struct.unpack for non-finite 32-bit - floating-point values. - """ - - local_unpack = struct.unpack - - def InnerDecode(buffer, pos): - """Decode serialized float to a float and new position. - - Args: - buffer: memoryview of the serialized bytes - pos: int, position in the memory view to start at. - - Returns: - Tuple[float, int] of the deserialized float value and new position - in the serialized data. - """ - # We expect a 32-bit value in little-endian byte order. Bit 1 is the sign - # bit, bits 2-9 represent the exponent, and bits 10-32 are the significand. - new_pos = pos + 4 - float_bytes = buffer[pos:new_pos].tobytes() - - # If this value has all its exponent bits set, then it's non-finite. - # In Python 2.4, struct.unpack will convert it to a finite 64-bit value. - # To avoid that, we parse it specially. - if (float_bytes[3:4] in b'\x7F\xFF' and float_bytes[2:3] >= b'\x80'): - # If at least one significand bit is set... - if float_bytes[0:3] != b'\x00\x00\x80': - return (math.nan, new_pos) - # If sign bit is set... - if float_bytes[3:4] == b'\xFF': - return (-math.inf, new_pos) - return (math.inf, new_pos) - - # Note that we expect someone up-stack to catch struct.error and convert - # it to _DecodeError -- this way we don't have to set up exception- - # handling blocks every time we parse one value. - result = local_unpack('= b'\xF0') - and (double_bytes[0:7] != b'\x00\x00\x00\x00\x00\x00\xF0')): - return (math.nan, new_pos) - - # Note that we expect someone up-stack to catch struct.error and convert - # it to _DecodeError -- this way we don't have to set up exception- - # handling blocks every time we parse one value. - result = local_unpack(' end: - raise _DecodeError('Truncated message.') - while pos < endpoint: - value_start_pos = pos - (element, pos) = _DecodeSignedVarint32(buffer, pos) - # pylint: disable=protected-access - if element in enum_type.values_by_number: - value.append(element) - else: - if not message._unknown_fields: - message._unknown_fields = [] - tag_bytes = encoder.TagBytes(field_number, - wire_format.WIRETYPE_VARINT) - - message._unknown_fields.append( - (tag_bytes, buffer[value_start_pos:pos].tobytes())) - if message._unknown_field_set is None: - message._unknown_field_set = containers.UnknownFieldSet() - message._unknown_field_set._add( - field_number, wire_format.WIRETYPE_VARINT, element) - # pylint: enable=protected-access - if pos > endpoint: - if element in enum_type.values_by_number: - del value[-1] # Discard corrupt value. - else: - del message._unknown_fields[-1] - # pylint: disable=protected-access - del message._unknown_field_set._values[-1] - # pylint: enable=protected-access - raise _DecodeError('Packed element was truncated.') - return pos - return DecodePackedField - elif is_repeated: - tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_VARINT) - tag_len = len(tag_bytes) - def DecodeRepeatedField(buffer, pos, end, message, field_dict): - """Decode serialized repeated enum to its value and a new position. - - Args: - buffer: memoryview of the serialized bytes. - pos: int, position in the memory view to start at. - end: int, end position of serialized data - message: Message object to store unknown fields in - field_dict: Map[Descriptor, Any] to store decoded values in. - - Returns: - int, new position in serialized data. - """ - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - while 1: - (element, new_pos) = _DecodeSignedVarint32(buffer, pos) - # pylint: disable=protected-access - if element in enum_type.values_by_number: - value.append(element) - else: - if not message._unknown_fields: - message._unknown_fields = [] - message._unknown_fields.append( - (tag_bytes, buffer[pos:new_pos].tobytes())) - if message._unknown_field_set is None: - message._unknown_field_set = containers.UnknownFieldSet() - message._unknown_field_set._add( - field_number, wire_format.WIRETYPE_VARINT, element) - # pylint: enable=protected-access - # Predict that the next tag is another copy of the same repeated - # field. - pos = new_pos + tag_len - if buffer[new_pos:pos] != tag_bytes or new_pos >= end: - # Prediction failed. Return. - if new_pos > end: - raise _DecodeError('Truncated message.') - return new_pos - return DecodeRepeatedField - else: - def DecodeField(buffer, pos, end, message, field_dict): - """Decode serialized repeated enum to its value and a new position. - - Args: - buffer: memoryview of the serialized bytes. - pos: int, position in the memory view to start at. - end: int, end position of serialized data - message: Message object to store unknown fields in - field_dict: Map[Descriptor, Any] to store decoded values in. - - Returns: - int, new position in serialized data. - """ - value_start_pos = pos - (enum_value, pos) = _DecodeSignedVarint32(buffer, pos) - if pos > end: - raise _DecodeError('Truncated message.') - if clear_if_default and not enum_value: - field_dict.pop(key, None) - return pos - # pylint: disable=protected-access - if enum_value in enum_type.values_by_number: - field_dict[key] = enum_value - else: - if not message._unknown_fields: - message._unknown_fields = [] - tag_bytes = encoder.TagBytes(field_number, - wire_format.WIRETYPE_VARINT) - message._unknown_fields.append( - (tag_bytes, buffer[value_start_pos:pos].tobytes())) - if message._unknown_field_set is None: - message._unknown_field_set = containers.UnknownFieldSet() - message._unknown_field_set._add( - field_number, wire_format.WIRETYPE_VARINT, enum_value) - # pylint: enable=protected-access - return pos - return DecodeField - - -# -------------------------------------------------------------------- - - -Int32Decoder = _SimpleDecoder( - wire_format.WIRETYPE_VARINT, _DecodeSignedVarint32) - -Int64Decoder = _SimpleDecoder( - wire_format.WIRETYPE_VARINT, _DecodeSignedVarint) - -UInt32Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint32) -UInt64Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint) - -SInt32Decoder = _ModifiedDecoder( - wire_format.WIRETYPE_VARINT, _DecodeVarint32, wire_format.ZigZagDecode) -SInt64Decoder = _ModifiedDecoder( - wire_format.WIRETYPE_VARINT, _DecodeVarint, wire_format.ZigZagDecode) - -# Note that Python conveniently guarantees that when using the '<' prefix on -# formats, they will also have the same size across all platforms (as opposed -# to without the prefix, where their sizes depend on the C compiler's basic -# type sizes). -Fixed32Decoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED32, ' end: - raise _DecodeError('Truncated string.') - value.append(_ConvertToUnicode(buffer[pos:new_pos])) - # Predict that the next tag is another copy of the same repeated field. - pos = new_pos + tag_len - if buffer[new_pos:pos] != tag_bytes or new_pos == end: - # Prediction failed. Return. - return new_pos - return DecodeRepeatedField - else: - def DecodeField(buffer, pos, end, message, field_dict): - (size, pos) = local_DecodeVarint(buffer, pos) - new_pos = pos + size - if new_pos > end: - raise _DecodeError('Truncated string.') - if clear_if_default and not size: - field_dict.pop(key, None) - else: - field_dict[key] = _ConvertToUnicode(buffer[pos:new_pos]) - return new_pos - return DecodeField - - -def BytesDecoder(field_number, is_repeated, is_packed, key, new_default, - clear_if_default=False): - """Returns a decoder for a bytes field.""" - - local_DecodeVarint = _DecodeVarint - - assert not is_packed - if is_repeated: - tag_bytes = encoder.TagBytes(field_number, - wire_format.WIRETYPE_LENGTH_DELIMITED) - tag_len = len(tag_bytes) - def DecodeRepeatedField(buffer, pos, end, message, field_dict): - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - while 1: - (size, pos) = local_DecodeVarint(buffer, pos) - new_pos = pos + size - if new_pos > end: - raise _DecodeError('Truncated string.') - value.append(buffer[pos:new_pos].tobytes()) - # Predict that the next tag is another copy of the same repeated field. - pos = new_pos + tag_len - if buffer[new_pos:pos] != tag_bytes or new_pos == end: - # Prediction failed. Return. - return new_pos - return DecodeRepeatedField - else: - def DecodeField(buffer, pos, end, message, field_dict): - (size, pos) = local_DecodeVarint(buffer, pos) - new_pos = pos + size - if new_pos > end: - raise _DecodeError('Truncated string.') - if clear_if_default and not size: - field_dict.pop(key, None) - else: - field_dict[key] = buffer[pos:new_pos].tobytes() - return new_pos - return DecodeField - - -def GroupDecoder(field_number, is_repeated, is_packed, key, new_default): - """Returns a decoder for a group field.""" - - end_tag_bytes = encoder.TagBytes(field_number, - wire_format.WIRETYPE_END_GROUP) - end_tag_len = len(end_tag_bytes) - - assert not is_packed - if is_repeated: - tag_bytes = encoder.TagBytes(field_number, - wire_format.WIRETYPE_START_GROUP) - tag_len = len(tag_bytes) - def DecodeRepeatedField(buffer, pos, end, message, field_dict): - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - while 1: - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - # Read sub-message. - pos = value.add()._InternalParse(buffer, pos, end) - # Read end tag. - new_pos = pos+end_tag_len - if buffer[pos:new_pos] != end_tag_bytes or new_pos > end: - raise _DecodeError('Missing group end tag.') - # Predict that the next tag is another copy of the same repeated field. - pos = new_pos + tag_len - if buffer[new_pos:pos] != tag_bytes or new_pos == end: - # Prediction failed. Return. - return new_pos - return DecodeRepeatedField - else: - def DecodeField(buffer, pos, end, message, field_dict): - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - # Read sub-message. - pos = value._InternalParse(buffer, pos, end) - # Read end tag. - new_pos = pos+end_tag_len - if buffer[pos:new_pos] != end_tag_bytes or new_pos > end: - raise _DecodeError('Missing group end tag.') - return new_pos - return DecodeField - - -def MessageDecoder(field_number, is_repeated, is_packed, key, new_default): - """Returns a decoder for a message field.""" - - local_DecodeVarint = _DecodeVarint - - assert not is_packed - if is_repeated: - tag_bytes = encoder.TagBytes(field_number, - wire_format.WIRETYPE_LENGTH_DELIMITED) - tag_len = len(tag_bytes) - def DecodeRepeatedField(buffer, pos, end, message, field_dict): - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - while 1: - # Read length. - (size, pos) = local_DecodeVarint(buffer, pos) - new_pos = pos + size - if new_pos > end: - raise _DecodeError('Truncated message.') - # Read sub-message. - if value.add()._InternalParse(buffer, pos, new_pos) != new_pos: - # The only reason _InternalParse would return early is if it - # encountered an end-group tag. - raise _DecodeError('Unexpected end-group tag.') - # Predict that the next tag is another copy of the same repeated field. - pos = new_pos + tag_len - if buffer[new_pos:pos] != tag_bytes or new_pos == end: - # Prediction failed. Return. - return new_pos - return DecodeRepeatedField - else: - def DecodeField(buffer, pos, end, message, field_dict): - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - # Read length. - (size, pos) = local_DecodeVarint(buffer, pos) - new_pos = pos + size - if new_pos > end: - raise _DecodeError('Truncated message.') - # Read sub-message. - if value._InternalParse(buffer, pos, new_pos) != new_pos: - # The only reason _InternalParse would return early is if it encountered - # an end-group tag. - raise _DecodeError('Unexpected end-group tag.') - return new_pos - return DecodeField - - -# -------------------------------------------------------------------- - -MESSAGE_SET_ITEM_TAG = encoder.TagBytes(1, wire_format.WIRETYPE_START_GROUP) - -def MessageSetItemDecoder(descriptor): - """Returns a decoder for a MessageSet item. - - The parameter is the message Descriptor. - - The message set message looks like this: - message MessageSet { - repeated group Item = 1 { - required int32 type_id = 2; - required string message = 3; - } - } - """ - - type_id_tag_bytes = encoder.TagBytes(2, wire_format.WIRETYPE_VARINT) - message_tag_bytes = encoder.TagBytes(3, wire_format.WIRETYPE_LENGTH_DELIMITED) - item_end_tag_bytes = encoder.TagBytes(1, wire_format.WIRETYPE_END_GROUP) - - local_ReadTag = ReadTag - local_DecodeVarint = _DecodeVarint - local_SkipField = SkipField - - def DecodeItem(buffer, pos, end, message, field_dict): - """Decode serialized message set to its value and new position. - - Args: - buffer: memoryview of the serialized bytes. - pos: int, position in the memory view to start at. - end: int, end position of serialized data - message: Message object to store unknown fields in - field_dict: Map[Descriptor, Any] to store decoded values in. - - Returns: - int, new position in serialized data. - """ - message_set_item_start = pos - type_id = -1 - message_start = -1 - message_end = -1 - - # Technically, type_id and message can appear in any order, so we need - # a little loop here. - while 1: - (tag_bytes, pos) = local_ReadTag(buffer, pos) - if tag_bytes == type_id_tag_bytes: - (type_id, pos) = local_DecodeVarint(buffer, pos) - elif tag_bytes == message_tag_bytes: - (size, message_start) = local_DecodeVarint(buffer, pos) - pos = message_end = message_start + size - elif tag_bytes == item_end_tag_bytes: - break - else: - pos = SkipField(buffer, pos, end, tag_bytes) - if pos == -1: - raise _DecodeError('Missing group end tag.') - - if pos > end: - raise _DecodeError('Truncated message.') - - if type_id == -1: - raise _DecodeError('MessageSet item missing type_id.') - if message_start == -1: - raise _DecodeError('MessageSet item missing message.') - - extension = message.Extensions._FindExtensionByNumber(type_id) - # pylint: disable=protected-access - if extension is not None: - value = field_dict.get(extension) - if value is None: - message_type = extension.message_type - if not hasattr(message_type, '_concrete_class'): - # pylint: disable=protected-access - message._FACTORY.GetPrototype(message_type) - value = field_dict.setdefault( - extension, message_type._concrete_class()) - if value._InternalParse(buffer, message_start,message_end) != message_end: - # The only reason _InternalParse would return early is if it encountered - # an end-group tag. - raise _DecodeError('Unexpected end-group tag.') - else: - if not message._unknown_fields: - message._unknown_fields = [] - message._unknown_fields.append( - (MESSAGE_SET_ITEM_TAG, buffer[message_set_item_start:pos].tobytes())) - if message._unknown_field_set is None: - message._unknown_field_set = containers.UnknownFieldSet() - message._unknown_field_set._add( - type_id, - wire_format.WIRETYPE_LENGTH_DELIMITED, - buffer[message_start:message_end].tobytes()) - # pylint: enable=protected-access - - return pos - - return DecodeItem - -# -------------------------------------------------------------------- - -def MapDecoder(field_descriptor, new_default, is_message_map): - """Returns a decoder for a map field.""" - - key = field_descriptor - tag_bytes = encoder.TagBytes(field_descriptor.number, - wire_format.WIRETYPE_LENGTH_DELIMITED) - tag_len = len(tag_bytes) - local_DecodeVarint = _DecodeVarint - # Can't read _concrete_class yet; might not be initialized. - message_type = field_descriptor.message_type - - def DecodeMap(buffer, pos, end, message, field_dict): - submsg = message_type._concrete_class() - value = field_dict.get(key) - if value is None: - value = field_dict.setdefault(key, new_default(message)) - while 1: - # Read length. - (size, pos) = local_DecodeVarint(buffer, pos) - new_pos = pos + size - if new_pos > end: - raise _DecodeError('Truncated message.') - # Read sub-message. - submsg.Clear() - if submsg._InternalParse(buffer, pos, new_pos) != new_pos: - # The only reason _InternalParse would return early is if it - # encountered an end-group tag. - raise _DecodeError('Unexpected end-group tag.') - - if is_message_map: - value[submsg.key].CopyFrom(submsg.value) - else: - value[submsg.key] = submsg.value - - # Predict that the next tag is another copy of the same repeated field. - pos = new_pos + tag_len - if buffer[new_pos:pos] != tag_bytes or new_pos == end: - # Prediction failed. Return. - return new_pos - - return DecodeMap - -# -------------------------------------------------------------------- -# Optimization is not as heavy here because calls to SkipField() are rare, -# except for handling end-group tags. - -def _SkipVarint(buffer, pos, end): - """Skip a varint value. Returns the new position.""" - # Previously ord(buffer[pos]) raised IndexError when pos is out of range. - # With this code, ord(b'') raises TypeError. Both are handled in - # python_message.py to generate a 'Truncated message' error. - while ord(buffer[pos:pos+1].tobytes()) & 0x80: - pos += 1 - pos += 1 - if pos > end: - raise _DecodeError('Truncated message.') - return pos - -def _SkipFixed64(buffer, pos, end): - """Skip a fixed64 value. Returns the new position.""" - - pos += 8 - if pos > end: - raise _DecodeError('Truncated message.') - return pos - - -def _DecodeFixed64(buffer, pos): - """Decode a fixed64.""" - new_pos = pos + 8 - return (struct.unpack(' end: - raise _DecodeError('Truncated message.') - return pos - - -def _SkipGroup(buffer, pos, end): - """Skip sub-group. Returns the new position.""" - - while 1: - (tag_bytes, pos) = ReadTag(buffer, pos) - new_pos = SkipField(buffer, pos, end, tag_bytes) - if new_pos == -1: - return pos - pos = new_pos - - -def _DecodeUnknownFieldSet(buffer, pos, end_pos=None): - """Decode UnknownFieldSet. Returns the UnknownFieldSet and new position.""" - - unknown_field_set = containers.UnknownFieldSet() - while end_pos is None or pos < end_pos: - (tag_bytes, pos) = ReadTag(buffer, pos) - (tag, _) = _DecodeVarint(tag_bytes, 0) - field_number, wire_type = wire_format.UnpackTag(tag) - if wire_type == wire_format.WIRETYPE_END_GROUP: - break - (data, pos) = _DecodeUnknownField(buffer, pos, wire_type) - # pylint: disable=protected-access - unknown_field_set._add(field_number, wire_type, data) - - return (unknown_field_set, pos) - - -def _DecodeUnknownField(buffer, pos, wire_type): - """Decode a unknown field. Returns the UnknownField and new position.""" - - if wire_type == wire_format.WIRETYPE_VARINT: - (data, pos) = _DecodeVarint(buffer, pos) - elif wire_type == wire_format.WIRETYPE_FIXED64: - (data, pos) = _DecodeFixed64(buffer, pos) - elif wire_type == wire_format.WIRETYPE_FIXED32: - (data, pos) = _DecodeFixed32(buffer, pos) - elif wire_type == wire_format.WIRETYPE_LENGTH_DELIMITED: - (size, pos) = _DecodeVarint(buffer, pos) - data = buffer[pos:pos+size].tobytes() - pos += size - elif wire_type == wire_format.WIRETYPE_START_GROUP: - (data, pos) = _DecodeUnknownFieldSet(buffer, pos) - elif wire_type == wire_format.WIRETYPE_END_GROUP: - return (0, -1) - else: - raise _DecodeError('Wrong wire type in tag.') - - return (data, pos) - - -def _EndGroup(buffer, pos, end): - """Skipping an END_GROUP tag returns -1 to tell the parent loop to break.""" - - return -1 - - -def _SkipFixed32(buffer, pos, end): - """Skip a fixed32 value. Returns the new position.""" - - pos += 4 - if pos > end: - raise _DecodeError('Truncated message.') - return pos - - -def _DecodeFixed32(buffer, pos): - """Decode a fixed32.""" - - new_pos = pos + 4 - return (struct.unpack('B').pack - - def EncodeVarint(write, value, unused_deterministic=None): - bits = value & 0x7f - value >>= 7 - while value: - write(local_int2byte(0x80|bits)) - bits = value & 0x7f - value >>= 7 - return write(local_int2byte(bits)) - - return EncodeVarint - - -def _SignedVarintEncoder(): - """Return an encoder for a basic signed varint value (does not include - tag).""" - - local_int2byte = struct.Struct('>B').pack - - def EncodeSignedVarint(write, value, unused_deterministic=None): - if value < 0: - value += (1 << 64) - bits = value & 0x7f - value >>= 7 - while value: - write(local_int2byte(0x80|bits)) - bits = value & 0x7f - value >>= 7 - return write(local_int2byte(bits)) - - return EncodeSignedVarint - - -_EncodeVarint = _VarintEncoder() -_EncodeSignedVarint = _SignedVarintEncoder() - - -def _VarintBytes(value): - """Encode the given integer as a varint and return the bytes. This is only - called at startup time so it doesn't need to be fast.""" - - pieces = [] - _EncodeVarint(pieces.append, value, True) - return b"".join(pieces) - - -def TagBytes(field_number, wire_type): - """Encode the given tag and return the bytes. Only called at startup.""" - - return bytes(_VarintBytes(wire_format.PackTag(field_number, wire_type))) - -# -------------------------------------------------------------------- -# As with sizers (see above), we have a number of common encoder -# implementations. - - -def _SimpleEncoder(wire_type, encode_value, compute_value_size): - """Return a constructor for an encoder for fields of a particular type. - - Args: - wire_type: The field's wire type, for encoding tags. - encode_value: A function which encodes an individual value, e.g. - _EncodeVarint(). - compute_value_size: A function which computes the size of an individual - value, e.g. _VarintSize(). - """ - - def SpecificEncoder(field_number, is_repeated, is_packed): - if is_packed: - tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) - local_EncodeVarint = _EncodeVarint - def EncodePackedField(write, value, deterministic): - write(tag_bytes) - size = 0 - for element in value: - size += compute_value_size(element) - local_EncodeVarint(write, size, deterministic) - for element in value: - encode_value(write, element, deterministic) - return EncodePackedField - elif is_repeated: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeRepeatedField(write, value, deterministic): - for element in value: - write(tag_bytes) - encode_value(write, element, deterministic) - return EncodeRepeatedField - else: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeField(write, value, deterministic): - write(tag_bytes) - return encode_value(write, value, deterministic) - return EncodeField - - return SpecificEncoder - - -def _ModifiedEncoder(wire_type, encode_value, compute_value_size, modify_value): - """Like SimpleEncoder but additionally invokes modify_value on every value - before passing it to encode_value. Usually modify_value is ZigZagEncode.""" - - def SpecificEncoder(field_number, is_repeated, is_packed): - if is_packed: - tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) - local_EncodeVarint = _EncodeVarint - def EncodePackedField(write, value, deterministic): - write(tag_bytes) - size = 0 - for element in value: - size += compute_value_size(modify_value(element)) - local_EncodeVarint(write, size, deterministic) - for element in value: - encode_value(write, modify_value(element), deterministic) - return EncodePackedField - elif is_repeated: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeRepeatedField(write, value, deterministic): - for element in value: - write(tag_bytes) - encode_value(write, modify_value(element), deterministic) - return EncodeRepeatedField - else: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeField(write, value, deterministic): - write(tag_bytes) - return encode_value(write, modify_value(value), deterministic) - return EncodeField - - return SpecificEncoder - - -def _StructPackEncoder(wire_type, format): - """Return a constructor for an encoder for a fixed-width field. - - Args: - wire_type: The field's wire type, for encoding tags. - format: The format string to pass to struct.pack(). - """ - - value_size = struct.calcsize(format) - - def SpecificEncoder(field_number, is_repeated, is_packed): - local_struct_pack = struct.pack - if is_packed: - tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) - local_EncodeVarint = _EncodeVarint - def EncodePackedField(write, value, deterministic): - write(tag_bytes) - local_EncodeVarint(write, len(value) * value_size, deterministic) - for element in value: - write(local_struct_pack(format, element)) - return EncodePackedField - elif is_repeated: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeRepeatedField(write, value, unused_deterministic=None): - for element in value: - write(tag_bytes) - write(local_struct_pack(format, element)) - return EncodeRepeatedField - else: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeField(write, value, unused_deterministic=None): - write(tag_bytes) - return write(local_struct_pack(format, value)) - return EncodeField - - return SpecificEncoder - - -def _FloatingPointEncoder(wire_type, format): - """Return a constructor for an encoder for float fields. - - This is like StructPackEncoder, but catches errors that may be due to - passing non-finite floating-point values to struct.pack, and makes a - second attempt to encode those values. - - Args: - wire_type: The field's wire type, for encoding tags. - format: The format string to pass to struct.pack(). - """ - - value_size = struct.calcsize(format) - if value_size == 4: - def EncodeNonFiniteOrRaise(write, value): - # Remember that the serialized form uses little-endian byte order. - if value == _POS_INF: - write(b'\x00\x00\x80\x7F') - elif value == _NEG_INF: - write(b'\x00\x00\x80\xFF') - elif value != value: # NaN - write(b'\x00\x00\xC0\x7F') - else: - raise - elif value_size == 8: - def EncodeNonFiniteOrRaise(write, value): - if value == _POS_INF: - write(b'\x00\x00\x00\x00\x00\x00\xF0\x7F') - elif value == _NEG_INF: - write(b'\x00\x00\x00\x00\x00\x00\xF0\xFF') - elif value != value: # NaN - write(b'\x00\x00\x00\x00\x00\x00\xF8\x7F') - else: - raise - else: - raise ValueError('Can\'t encode floating-point values that are ' - '%d bytes long (only 4 or 8)' % value_size) - - def SpecificEncoder(field_number, is_repeated, is_packed): - local_struct_pack = struct.pack - if is_packed: - tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) - local_EncodeVarint = _EncodeVarint - def EncodePackedField(write, value, deterministic): - write(tag_bytes) - local_EncodeVarint(write, len(value) * value_size, deterministic) - for element in value: - # This try/except block is going to be faster than any code that - # we could write to check whether element is finite. - try: - write(local_struct_pack(format, element)) - except SystemError: - EncodeNonFiniteOrRaise(write, element) - return EncodePackedField - elif is_repeated: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeRepeatedField(write, value, unused_deterministic=None): - for element in value: - write(tag_bytes) - try: - write(local_struct_pack(format, element)) - except SystemError: - EncodeNonFiniteOrRaise(write, element) - return EncodeRepeatedField - else: - tag_bytes = TagBytes(field_number, wire_type) - def EncodeField(write, value, unused_deterministic=None): - write(tag_bytes) - try: - write(local_struct_pack(format, value)) - except SystemError: - EncodeNonFiniteOrRaise(write, value) - return EncodeField - - return SpecificEncoder - - -# ==================================================================== -# Here we declare an encoder constructor for each field type. These work -# very similarly to sizer constructors, described earlier. - - -Int32Encoder = Int64Encoder = EnumEncoder = _SimpleEncoder( - wire_format.WIRETYPE_VARINT, _EncodeSignedVarint, _SignedVarintSize) - -UInt32Encoder = UInt64Encoder = _SimpleEncoder( - wire_format.WIRETYPE_VARINT, _EncodeVarint, _VarintSize) - -SInt32Encoder = SInt64Encoder = _ModifiedEncoder( - wire_format.WIRETYPE_VARINT, _EncodeVarint, _VarintSize, - wire_format.ZigZagEncode) - -# Note that Python conveniently guarantees that when using the '<' prefix on -# formats, they will also have the same size across all platforms (as opposed -# to without the prefix, where their sizes depend on the C compiler's basic -# type sizes). -Fixed32Encoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED32, ' str - ValueType = int - - def __init__(self, enum_type): - """Inits EnumTypeWrapper with an EnumDescriptor.""" - self._enum_type = enum_type - self.DESCRIPTOR = enum_type # pylint: disable=invalid-name - - def Name(self, number): # pylint: disable=invalid-name - """Returns a string containing the name of an enum value.""" - try: - return self._enum_type.values_by_number[number].name - except KeyError: - pass # fall out to break exception chaining - - if not isinstance(number, int): - raise TypeError( - 'Enum value for {} must be an int, but got {} {!r}.'.format( - self._enum_type.name, type(number), number)) - else: - # repr here to handle the odd case when you pass in a boolean. - raise ValueError('Enum {} has no name defined for value {!r}'.format( - self._enum_type.name, number)) - - def Value(self, name): # pylint: disable=invalid-name - """Returns the value corresponding to the given enum name.""" - try: - return self._enum_type.values_by_name[name].number - except KeyError: - pass # fall out to break exception chaining - raise ValueError('Enum {} has no value defined for name {!r}'.format( - self._enum_type.name, name)) - - def keys(self): - """Return a list of the string names in the enum. - - Returns: - A list of strs, in the order they were defined in the .proto file. - """ - - return [value_descriptor.name - for value_descriptor in self._enum_type.values] - - def values(self): - """Return a list of the integer values in the enum. - - Returns: - A list of ints, in the order they were defined in the .proto file. - """ - - return [value_descriptor.number - for value_descriptor in self._enum_type.values] - - def items(self): - """Return a list of the (name, value) pairs of the enum. - - Returns: - A list of (str, int) pairs, in the order they were defined - in the .proto file. - """ - return [(value_descriptor.name, value_descriptor.number) - for value_descriptor in self._enum_type.values] - - def __getattr__(self, name): - """Returns the value corresponding to the given enum name.""" - try: - return super( - EnumTypeWrapper, - self).__getattribute__('_enum_type').values_by_name[name].number - except KeyError: - pass # fall out to break exception chaining - raise AttributeError('Enum {} has no value defined for name {!r}'.format( - self._enum_type.name, name)) diff --git a/opensafely/_vendor/google/protobuf/internal/extension_dict.py b/opensafely/_vendor/google/protobuf/internal/extension_dict.py deleted file mode 100644 index 8fa4712e..00000000 --- a/opensafely/_vendor/google/protobuf/internal/extension_dict.py +++ /dev/null @@ -1,213 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Contains _ExtensionDict class to represent extensions. -""" - -from opensafely._vendor.google.protobuf.internal import type_checkers -from opensafely._vendor.google.protobuf.descriptor import FieldDescriptor - - -def _VerifyExtensionHandle(message, extension_handle): - """Verify that the given extension handle is valid.""" - - if not isinstance(extension_handle, FieldDescriptor): - raise KeyError('HasExtension() expects an extension handle, got: %s' % - extension_handle) - - if not extension_handle.is_extension: - raise KeyError('"%s" is not an extension.' % extension_handle.full_name) - - if not extension_handle.containing_type: - raise KeyError('"%s" is missing a containing_type.' - % extension_handle.full_name) - - if extension_handle.containing_type is not message.DESCRIPTOR: - raise KeyError('Extension "%s" extends message type "%s", but this ' - 'message is of type "%s".' % - (extension_handle.full_name, - extension_handle.containing_type.full_name, - message.DESCRIPTOR.full_name)) - - -# TODO(robinson): Unify error handling of "unknown extension" crap. -# TODO(robinson): Support iteritems()-style iteration over all -# extensions with the "has" bits turned on? -class _ExtensionDict(object): - - """Dict-like container for Extension fields on proto instances. - - Note that in all cases we expect extension handles to be - FieldDescriptors. - """ - - def __init__(self, extended_message): - """ - Args: - extended_message: Message instance for which we are the Extensions dict. - """ - self._extended_message = extended_message - - def __getitem__(self, extension_handle): - """Returns the current value of the given extension handle.""" - - _VerifyExtensionHandle(self._extended_message, extension_handle) - - result = self._extended_message._fields.get(extension_handle) - if result is not None: - return result - - if extension_handle.label == FieldDescriptor.LABEL_REPEATED: - result = extension_handle._default_constructor(self._extended_message) - elif extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE: - message_type = extension_handle.message_type - if not hasattr(message_type, '_concrete_class'): - # pylint: disable=protected-access - self._extended_message._FACTORY.GetPrototype(message_type) - assert getattr(extension_handle.message_type, '_concrete_class', None), ( - 'Uninitialized concrete class found for field %r (message type %r)' - % (extension_handle.full_name, - extension_handle.message_type.full_name)) - result = extension_handle.message_type._concrete_class() - try: - result._SetListener(self._extended_message._listener_for_children) - except ReferenceError: - pass - else: - # Singular scalar -- just return the default without inserting into the - # dict. - return extension_handle.default_value - - # Atomically check if another thread has preempted us and, if not, swap - # in the new object we just created. If someone has preempted us, we - # take that object and discard ours. - # WARNING: We are relying on setdefault() being atomic. This is true - # in CPython but we haven't investigated others. This warning appears - # in several other locations in this file. - result = self._extended_message._fields.setdefault( - extension_handle, result) - - return result - - def __eq__(self, other): - if not isinstance(other, self.__class__): - return False - - my_fields = self._extended_message.ListFields() - other_fields = other._extended_message.ListFields() - - # Get rid of non-extension fields. - my_fields = [field for field in my_fields if field.is_extension] - other_fields = [field for field in other_fields if field.is_extension] - - return my_fields == other_fields - - def __ne__(self, other): - return not self == other - - def __len__(self): - fields = self._extended_message.ListFields() - # Get rid of non-extension fields. - extension_fields = [field for field in fields if field[0].is_extension] - return len(extension_fields) - - def __hash__(self): - raise TypeError('unhashable object') - - # Note that this is only meaningful for non-repeated, scalar extension - # fields. Note also that we may have to call _Modified() when we do - # successfully set a field this way, to set any necessary "has" bits in the - # ancestors of the extended message. - def __setitem__(self, extension_handle, value): - """If extension_handle specifies a non-repeated, scalar extension - field, sets the value of that field. - """ - - _VerifyExtensionHandle(self._extended_message, extension_handle) - - if (extension_handle.label == FieldDescriptor.LABEL_REPEATED or - extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE): - raise TypeError( - 'Cannot assign to extension "%s" because it is a repeated or ' - 'composite type.' % extension_handle.full_name) - - # It's slightly wasteful to lookup the type checker each time, - # but we expect this to be a vanishingly uncommon case anyway. - type_checker = type_checkers.GetTypeChecker(extension_handle) - # pylint: disable=protected-access - self._extended_message._fields[extension_handle] = ( - type_checker.CheckValue(value)) - self._extended_message._Modified() - - def __delitem__(self, extension_handle): - self._extended_message.ClearExtension(extension_handle) - - def _FindExtensionByName(self, name): - """Tries to find a known extension with the specified name. - - Args: - name: Extension full name. - - Returns: - Extension field descriptor. - """ - return self._extended_message._extensions_by_name.get(name, None) - - def _FindExtensionByNumber(self, number): - """Tries to find a known extension with the field number. - - Args: - number: Extension field number. - - Returns: - Extension field descriptor. - """ - return self._extended_message._extensions_by_number.get(number, None) - - def __iter__(self): - # Return a generator over the populated extension fields - return (f[0] for f in self._extended_message.ListFields() - if f[0].is_extension) - - def __contains__(self, extension_handle): - _VerifyExtensionHandle(self._extended_message, extension_handle) - - if extension_handle not in self._extended_message._fields: - return False - - if extension_handle.label == FieldDescriptor.LABEL_REPEATED: - return bool(self._extended_message._fields.get(extension_handle)) - - if extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE: - value = self._extended_message._fields.get(extension_handle) - # pylint: disable=protected-access - return value is not None and value._is_present_in_parent - - return True diff --git a/opensafely/_vendor/google/protobuf/internal/message_listener.py b/opensafely/_vendor/google/protobuf/internal/message_listener.py deleted file mode 100644 index 0fc255a7..00000000 --- a/opensafely/_vendor/google/protobuf/internal/message_listener.py +++ /dev/null @@ -1,78 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Defines a listener interface for observing certain -state transitions on Message objects. - -Also defines a null implementation of this interface. -""" - -__author__ = 'robinson@google.com (Will Robinson)' - - -class MessageListener(object): - - """Listens for modifications made to a message. Meant to be registered via - Message._SetListener(). - - Attributes: - dirty: If True, then calling Modified() would be a no-op. This can be - used to avoid these calls entirely in the common case. - """ - - def Modified(self): - """Called every time the message is modified in such a way that the parent - message may need to be updated. This currently means either: - (a) The message was modified for the first time, so the parent message - should henceforth mark the message as present. - (b) The message's cached byte size became dirty -- i.e. the message was - modified for the first time after a previous call to ByteSize(). - Therefore the parent should also mark its byte size as dirty. - Note that (a) implies (b), since new objects start out with a client cached - size (zero). However, we document (a) explicitly because it is important. - - Modified() will *only* be called in response to one of these two events -- - not every time the sub-message is modified. - - Note that if the listener's |dirty| attribute is true, then calling - Modified at the moment would be a no-op, so it can be skipped. Performance- - sensitive callers should check this attribute directly before calling since - it will be true most of the time. - """ - - raise NotImplementedError - - -class NullMessageListener(object): - - """No-op MessageListener implementation.""" - - def Modified(self): - pass diff --git a/opensafely/_vendor/google/protobuf/internal/python_message.py b/opensafely/_vendor/google/protobuf/internal/python_message.py deleted file mode 100644 index ce0cce65..00000000 --- a/opensafely/_vendor/google/protobuf/internal/python_message.py +++ /dev/null @@ -1,1539 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This code is meant to work on Python 2.4 and above only. -# -# TODO(robinson): Helpers for verbose, common checks like seeing if a -# descriptor's cpp_type is CPPTYPE_MESSAGE. - -"""Contains a metaclass and helper functions used to create -protocol message classes from Descriptor objects at runtime. - -Recall that a metaclass is the "type" of a class. -(A class is to a metaclass what an instance is to a class.) - -In this case, we use the GeneratedProtocolMessageType metaclass -to inject all the useful functionality into the classes -output by the protocol compiler at compile-time. - -The upshot of all this is that the real implementation -details for ALL pure-Python protocol buffers are *here in -this file*. -""" - -__author__ = 'robinson@google.com (Will Robinson)' - -from io import BytesIO -import struct -import sys -import weakref - -# We use "as" to avoid name collisions with variables. -from opensafely._vendor.google.protobuf.internal import api_implementation -from opensafely._vendor.google.protobuf.internal import containers -from opensafely._vendor.google.protobuf.internal import decoder -from opensafely._vendor.google.protobuf.internal import encoder -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf.internal import extension_dict -from opensafely._vendor.google.protobuf.internal import message_listener as message_listener_mod -from opensafely._vendor.google.protobuf.internal import type_checkers -from opensafely._vendor.google.protobuf.internal import well_known_types -from opensafely._vendor.google.protobuf.internal import wire_format -from opensafely._vendor.google.protobuf import descriptor as descriptor_mod -from opensafely._vendor.google.protobuf import message as message_mod -from opensafely._vendor.google.protobuf import text_format - -_FieldDescriptor = descriptor_mod.FieldDescriptor -_AnyFullTypeName = 'google.protobuf.Any' -_ExtensionDict = extension_dict._ExtensionDict - -class GeneratedProtocolMessageType(type): - - """Metaclass for protocol message classes created at runtime from Descriptors. - - We add implementations for all methods described in the Message class. We - also create properties to allow getting/setting all fields in the protocol - message. Finally, we create slots to prevent users from accidentally - "setting" nonexistent fields in the protocol message, which then wouldn't get - serialized / deserialized properly. - - The protocol compiler currently uses this metaclass to create protocol - message classes at runtime. Clients can also manually create their own - classes at runtime, as in this example: - - mydescriptor = Descriptor(.....) - factory = symbol_database.Default() - factory.pool.AddDescriptor(mydescriptor) - MyProtoClass = factory.GetPrototype(mydescriptor) - myproto_instance = MyProtoClass() - myproto.foo_field = 23 - ... - """ - - # Must be consistent with the protocol-compiler code in - # proto2/compiler/internal/generator.*. - _DESCRIPTOR_KEY = 'DESCRIPTOR' - - def __new__(cls, name, bases, dictionary): - """Custom allocation for runtime-generated class types. - - We override __new__ because this is apparently the only place - where we can meaningfully set __slots__ on the class we're creating(?). - (The interplay between metaclasses and slots is not very well-documented). - - Args: - name: Name of the class (ignored, but required by the - metaclass protocol). - bases: Base classes of the class we're constructing. - (Should be message.Message). We ignore this field, but - it's required by the metaclass protocol - dictionary: The class dictionary of the class we're - constructing. dictionary[_DESCRIPTOR_KEY] must contain - a Descriptor object describing this protocol message - type. - - Returns: - Newly-allocated class. - - Raises: - RuntimeError: Generated code only work with python cpp extension. - """ - descriptor = dictionary[GeneratedProtocolMessageType._DESCRIPTOR_KEY] - - if isinstance(descriptor, str): - raise RuntimeError('The generated code only work with python cpp ' - 'extension, but it is using pure python runtime.') - - # If a concrete class already exists for this descriptor, don't try to - # create another. Doing so will break any messages that already exist with - # the existing class. - # - # The C++ implementation appears to have its own internal `PyMessageFactory` - # to achieve similar results. - # - # This most commonly happens in `text_format.py` when using descriptors from - # a custom pool; it calls symbol_database.Global().getPrototype() on a - # descriptor which already has an existing concrete class. - new_class = getattr(descriptor, '_concrete_class', None) - if new_class: - return new_class - - if descriptor.full_name in well_known_types.WKTBASES: - bases += (well_known_types.WKTBASES[descriptor.full_name],) - _AddClassAttributesForNestedExtensions(descriptor, dictionary) - _AddSlots(descriptor, dictionary) - - superclass = super(GeneratedProtocolMessageType, cls) - new_class = superclass.__new__(cls, name, bases, dictionary) - return new_class - - def __init__(cls, name, bases, dictionary): - """Here we perform the majority of our work on the class. - We add enum getters, an __init__ method, implementations - of all Message methods, and properties for all fields - in the protocol type. - - Args: - name: Name of the class (ignored, but required by the - metaclass protocol). - bases: Base classes of the class we're constructing. - (Should be message.Message). We ignore this field, but - it's required by the metaclass protocol - dictionary: The class dictionary of the class we're - constructing. dictionary[_DESCRIPTOR_KEY] must contain - a Descriptor object describing this protocol message - type. - """ - descriptor = dictionary[GeneratedProtocolMessageType._DESCRIPTOR_KEY] - - # If this is an _existing_ class looked up via `_concrete_class` in the - # __new__ method above, then we don't need to re-initialize anything. - existing_class = getattr(descriptor, '_concrete_class', None) - if existing_class: - assert existing_class is cls, ( - 'Duplicate `GeneratedProtocolMessageType` created for descriptor %r' - % (descriptor.full_name)) - return - - cls._decoders_by_tag = {} - if (descriptor.has_options and - descriptor.GetOptions().message_set_wire_format): - cls._decoders_by_tag[decoder.MESSAGE_SET_ITEM_TAG] = ( - decoder.MessageSetItemDecoder(descriptor), None) - - # Attach stuff to each FieldDescriptor for quick lookup later on. - for field in descriptor.fields: - _AttachFieldHelpers(cls, field) - - descriptor._concrete_class = cls # pylint: disable=protected-access - _AddEnumValues(descriptor, cls) - _AddInitMethod(descriptor, cls) - _AddPropertiesForFields(descriptor, cls) - _AddPropertiesForExtensions(descriptor, cls) - _AddStaticMethods(cls) - _AddMessageMethods(descriptor, cls) - _AddPrivateHelperMethods(descriptor, cls) - - superclass = super(GeneratedProtocolMessageType, cls) - superclass.__init__(name, bases, dictionary) - - -# Stateless helpers for GeneratedProtocolMessageType below. -# Outside clients should not access these directly. -# -# I opted not to make any of these methods on the metaclass, to make it more -# clear that I'm not really using any state there and to keep clients from -# thinking that they have direct access to these construction helpers. - - -def _PropertyName(proto_field_name): - """Returns the name of the public property attribute which - clients can use to get and (in some cases) set the value - of a protocol message field. - - Args: - proto_field_name: The protocol message field name, exactly - as it appears (or would appear) in a .proto file. - """ - # TODO(robinson): Escape Python keywords (e.g., yield), and test this support. - # nnorwitz makes my day by writing: - # """ - # FYI. See the keyword module in the stdlib. This could be as simple as: - # - # if keyword.iskeyword(proto_field_name): - # return proto_field_name + "_" - # return proto_field_name - # """ - # Kenton says: The above is a BAD IDEA. People rely on being able to use - # getattr() and setattr() to reflectively manipulate field values. If we - # rename the properties, then every such user has to also make sure to apply - # the same transformation. Note that currently if you name a field "yield", - # you can still access it just fine using getattr/setattr -- it's not even - # that cumbersome to do so. - # TODO(kenton): Remove this method entirely if/when everyone agrees with my - # position. - return proto_field_name - - -def _AddSlots(message_descriptor, dictionary): - """Adds a __slots__ entry to dictionary, containing the names of all valid - attributes for this message type. - - Args: - message_descriptor: A Descriptor instance describing this message type. - dictionary: Class dictionary to which we'll add a '__slots__' entry. - """ - dictionary['__slots__'] = ['_cached_byte_size', - '_cached_byte_size_dirty', - '_fields', - '_unknown_fields', - '_unknown_field_set', - '_is_present_in_parent', - '_listener', - '_listener_for_children', - '__weakref__', - '_oneofs'] - - -def _IsMessageSetExtension(field): - return (field.is_extension and - field.containing_type.has_options and - field.containing_type.GetOptions().message_set_wire_format and - field.type == _FieldDescriptor.TYPE_MESSAGE and - field.label == _FieldDescriptor.LABEL_OPTIONAL) - - -def _IsMapField(field): - return (field.type == _FieldDescriptor.TYPE_MESSAGE and - field.message_type.has_options and - field.message_type.GetOptions().map_entry) - - -def _IsMessageMapField(field): - value_type = field.message_type.fields_by_name['value'] - return value_type.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE - - -def _AttachFieldHelpers(cls, field_descriptor): - is_repeated = (field_descriptor.label == _FieldDescriptor.LABEL_REPEATED) - is_packable = (is_repeated and - wire_format.IsTypePackable(field_descriptor.type)) - is_proto3 = field_descriptor.containing_type.syntax == 'proto3' - if not is_packable: - is_packed = False - elif field_descriptor.containing_type.syntax == 'proto2': - is_packed = (field_descriptor.has_options and - field_descriptor.GetOptions().packed) - else: - has_packed_false = (field_descriptor.has_options and - field_descriptor.GetOptions().HasField('packed') and - field_descriptor.GetOptions().packed == False) - is_packed = not has_packed_false - is_map_entry = _IsMapField(field_descriptor) - - if is_map_entry: - field_encoder = encoder.MapEncoder(field_descriptor) - sizer = encoder.MapSizer(field_descriptor, - _IsMessageMapField(field_descriptor)) - elif _IsMessageSetExtension(field_descriptor): - field_encoder = encoder.MessageSetItemEncoder(field_descriptor.number) - sizer = encoder.MessageSetItemSizer(field_descriptor.number) - else: - field_encoder = type_checkers.TYPE_TO_ENCODER[field_descriptor.type]( - field_descriptor.number, is_repeated, is_packed) - sizer = type_checkers.TYPE_TO_SIZER[field_descriptor.type]( - field_descriptor.number, is_repeated, is_packed) - - field_descriptor._encoder = field_encoder - field_descriptor._sizer = sizer - field_descriptor._default_constructor = _DefaultValueConstructorForField( - field_descriptor) - - def AddDecoder(wiretype, is_packed): - tag_bytes = encoder.TagBytes(field_descriptor.number, wiretype) - decode_type = field_descriptor.type - if (decode_type == _FieldDescriptor.TYPE_ENUM and - type_checkers.SupportsOpenEnums(field_descriptor)): - decode_type = _FieldDescriptor.TYPE_INT32 - - oneof_descriptor = None - clear_if_default = False - if field_descriptor.containing_oneof is not None: - oneof_descriptor = field_descriptor - elif (is_proto3 and not is_repeated and - field_descriptor.cpp_type != _FieldDescriptor.CPPTYPE_MESSAGE): - clear_if_default = True - - if is_map_entry: - is_message_map = _IsMessageMapField(field_descriptor) - - field_decoder = decoder.MapDecoder( - field_descriptor, _GetInitializeDefaultForMap(field_descriptor), - is_message_map) - elif decode_type == _FieldDescriptor.TYPE_STRING: - field_decoder = decoder.StringDecoder( - field_descriptor.number, is_repeated, is_packed, - field_descriptor, field_descriptor._default_constructor, - clear_if_default) - elif field_descriptor.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - field_decoder = type_checkers.TYPE_TO_DECODER[decode_type]( - field_descriptor.number, is_repeated, is_packed, - field_descriptor, field_descriptor._default_constructor) - else: - field_decoder = type_checkers.TYPE_TO_DECODER[decode_type]( - field_descriptor.number, is_repeated, is_packed, - # pylint: disable=protected-access - field_descriptor, field_descriptor._default_constructor, - clear_if_default) - - cls._decoders_by_tag[tag_bytes] = (field_decoder, oneof_descriptor) - - AddDecoder(type_checkers.FIELD_TYPE_TO_WIRE_TYPE[field_descriptor.type], - False) - - if is_repeated and wire_format.IsTypePackable(field_descriptor.type): - # To support wire compatibility of adding packed = true, add a decoder for - # packed values regardless of the field's options. - AddDecoder(wire_format.WIRETYPE_LENGTH_DELIMITED, True) - - -def _AddClassAttributesForNestedExtensions(descriptor, dictionary): - extensions = descriptor.extensions_by_name - for extension_name, extension_field in extensions.items(): - assert extension_name not in dictionary - dictionary[extension_name] = extension_field - - -def _AddEnumValues(descriptor, cls): - """Sets class-level attributes for all enum fields defined in this message. - - Also exporting a class-level object that can name enum values. - - Args: - descriptor: Descriptor object for this message type. - cls: Class we're constructing for this message type. - """ - for enum_type in descriptor.enum_types: - setattr(cls, enum_type.name, enum_type_wrapper.EnumTypeWrapper(enum_type)) - for enum_value in enum_type.values: - setattr(cls, enum_value.name, enum_value.number) - - -def _GetInitializeDefaultForMap(field): - if field.label != _FieldDescriptor.LABEL_REPEATED: - raise ValueError('map_entry set on non-repeated field %s' % ( - field.name)) - fields_by_name = field.message_type.fields_by_name - key_checker = type_checkers.GetTypeChecker(fields_by_name['key']) - - value_field = fields_by_name['value'] - if _IsMessageMapField(field): - def MakeMessageMapDefault(message): - return containers.MessageMap( - message._listener_for_children, value_field.message_type, key_checker, - field.message_type) - return MakeMessageMapDefault - else: - value_checker = type_checkers.GetTypeChecker(value_field) - def MakePrimitiveMapDefault(message): - return containers.ScalarMap( - message._listener_for_children, key_checker, value_checker, - field.message_type) - return MakePrimitiveMapDefault - -def _DefaultValueConstructorForField(field): - """Returns a function which returns a default value for a field. - - Args: - field: FieldDescriptor object for this field. - - The returned function has one argument: - message: Message instance containing this field, or a weakref proxy - of same. - - That function in turn returns a default value for this field. The default - value may refer back to |message| via a weak reference. - """ - - if _IsMapField(field): - return _GetInitializeDefaultForMap(field) - - if field.label == _FieldDescriptor.LABEL_REPEATED: - if field.has_default_value and field.default_value != []: - raise ValueError('Repeated field default value not empty list: %s' % ( - field.default_value)) - if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - # We can't look at _concrete_class yet since it might not have - # been set. (Depends on order in which we initialize the classes). - message_type = field.message_type - def MakeRepeatedMessageDefault(message): - return containers.RepeatedCompositeFieldContainer( - message._listener_for_children, field.message_type) - return MakeRepeatedMessageDefault - else: - type_checker = type_checkers.GetTypeChecker(field) - def MakeRepeatedScalarDefault(message): - return containers.RepeatedScalarFieldContainer( - message._listener_for_children, type_checker) - return MakeRepeatedScalarDefault - - if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - # _concrete_class may not yet be initialized. - message_type = field.message_type - def MakeSubMessageDefault(message): - assert getattr(message_type, '_concrete_class', None), ( - 'Uninitialized concrete class found for field %r (message type %r)' - % (field.full_name, message_type.full_name)) - result = message_type._concrete_class() - result._SetListener( - _OneofListener(message, field) - if field.containing_oneof is not None - else message._listener_for_children) - return result - return MakeSubMessageDefault - - def MakeScalarDefault(message): - # TODO(protobuf-team): This may be broken since there may not be - # default_value. Combine with has_default_value somehow. - return field.default_value - return MakeScalarDefault - - -def _ReraiseTypeErrorWithFieldName(message_name, field_name): - """Re-raise the currently-handled TypeError with the field name added.""" - exc = sys.exc_info()[1] - if len(exc.args) == 1 and type(exc) is TypeError: - # simple TypeError; add field name to exception message - exc = TypeError('%s for field %s.%s' % (str(exc), message_name, field_name)) - - # re-raise possibly-amended exception with original traceback: - raise exc.with_traceback(sys.exc_info()[2]) - - -def _AddInitMethod(message_descriptor, cls): - """Adds an __init__ method to cls.""" - - def _GetIntegerEnumValue(enum_type, value): - """Convert a string or integer enum value to an integer. - - If the value is a string, it is converted to the enum value in - enum_type with the same name. If the value is not a string, it's - returned as-is. (No conversion or bounds-checking is done.) - """ - if isinstance(value, str): - try: - return enum_type.values_by_name[value].number - except KeyError: - raise ValueError('Enum type %s: unknown label "%s"' % ( - enum_type.full_name, value)) - return value - - def init(self, **kwargs): - self._cached_byte_size = 0 - self._cached_byte_size_dirty = len(kwargs) > 0 - self._fields = {} - # Contains a mapping from oneof field descriptors to the descriptor - # of the currently set field in that oneof field. - self._oneofs = {} - - # _unknown_fields is () when empty for efficiency, and will be turned into - # a list if fields are added. - self._unknown_fields = () - # _unknown_field_set is None when empty for efficiency, and will be - # turned into UnknownFieldSet struct if fields are added. - self._unknown_field_set = None # pylint: disable=protected-access - self._is_present_in_parent = False - self._listener = message_listener_mod.NullMessageListener() - self._listener_for_children = _Listener(self) - for field_name, field_value in kwargs.items(): - field = _GetFieldByName(message_descriptor, field_name) - if field is None: - raise TypeError('%s() got an unexpected keyword argument "%s"' % - (message_descriptor.name, field_name)) - if field_value is None: - # field=None is the same as no field at all. - continue - if field.label == _FieldDescriptor.LABEL_REPEATED: - copy = field._default_constructor(self) - if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: # Composite - if _IsMapField(field): - if _IsMessageMapField(field): - for key in field_value: - copy[key].MergeFrom(field_value[key]) - else: - copy.update(field_value) - else: - for val in field_value: - if isinstance(val, dict): - copy.add(**val) - else: - copy.add().MergeFrom(val) - else: # Scalar - if field.cpp_type == _FieldDescriptor.CPPTYPE_ENUM: - field_value = [_GetIntegerEnumValue(field.enum_type, val) - for val in field_value] - copy.extend(field_value) - self._fields[field] = copy - elif field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - copy = field._default_constructor(self) - new_val = field_value - if isinstance(field_value, dict): - new_val = field.message_type._concrete_class(**field_value) - try: - copy.MergeFrom(new_val) - except TypeError: - _ReraiseTypeErrorWithFieldName(message_descriptor.name, field_name) - self._fields[field] = copy - else: - if field.cpp_type == _FieldDescriptor.CPPTYPE_ENUM: - field_value = _GetIntegerEnumValue(field.enum_type, field_value) - try: - setattr(self, field_name, field_value) - except TypeError: - _ReraiseTypeErrorWithFieldName(message_descriptor.name, field_name) - - init.__module__ = None - init.__doc__ = None - cls.__init__ = init - - -def _GetFieldByName(message_descriptor, field_name): - """Returns a field descriptor by field name. - - Args: - message_descriptor: A Descriptor describing all fields in message. - field_name: The name of the field to retrieve. - Returns: - The field descriptor associated with the field name. - """ - try: - return message_descriptor.fields_by_name[field_name] - except KeyError: - raise ValueError('Protocol message %s has no "%s" field.' % - (message_descriptor.name, field_name)) - - -def _AddPropertiesForFields(descriptor, cls): - """Adds properties for all fields in this protocol message type.""" - for field in descriptor.fields: - _AddPropertiesForField(field, cls) - - if descriptor.is_extendable: - # _ExtensionDict is just an adaptor with no state so we allocate a new one - # every time it is accessed. - cls.Extensions = property(lambda self: _ExtensionDict(self)) - - -def _AddPropertiesForField(field, cls): - """Adds a public property for a protocol message field. - Clients can use this property to get and (in the case - of non-repeated scalar fields) directly set the value - of a protocol message field. - - Args: - field: A FieldDescriptor for this field. - cls: The class we're constructing. - """ - # Catch it if we add other types that we should - # handle specially here. - assert _FieldDescriptor.MAX_CPPTYPE == 10 - - constant_name = field.name.upper() + '_FIELD_NUMBER' - setattr(cls, constant_name, field.number) - - if field.label == _FieldDescriptor.LABEL_REPEATED: - _AddPropertiesForRepeatedField(field, cls) - elif field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - _AddPropertiesForNonRepeatedCompositeField(field, cls) - else: - _AddPropertiesForNonRepeatedScalarField(field, cls) - - -class _FieldProperty(property): - __slots__ = ('DESCRIPTOR',) - - def __init__(self, descriptor, getter, setter, doc): - property.__init__(self, getter, setter, doc=doc) - self.DESCRIPTOR = descriptor - - -def _AddPropertiesForRepeatedField(field, cls): - """Adds a public property for a "repeated" protocol message field. Clients - can use this property to get the value of the field, which will be either a - RepeatedScalarFieldContainer or RepeatedCompositeFieldContainer (see - below). - - Note that when clients add values to these containers, we perform - type-checking in the case of repeated scalar fields, and we also set any - necessary "has" bits as a side-effect. - - Args: - field: A FieldDescriptor for this field. - cls: The class we're constructing. - """ - proto_field_name = field.name - property_name = _PropertyName(proto_field_name) - - def getter(self): - field_value = self._fields.get(field) - if field_value is None: - # Construct a new object to represent this field. - field_value = field._default_constructor(self) - - # Atomically check if another thread has preempted us and, if not, swap - # in the new object we just created. If someone has preempted us, we - # take that object and discard ours. - # WARNING: We are relying on setdefault() being atomic. This is true - # in CPython but we haven't investigated others. This warning appears - # in several other locations in this file. - field_value = self._fields.setdefault(field, field_value) - return field_value - getter.__module__ = None - getter.__doc__ = 'Getter for %s.' % proto_field_name - - # We define a setter just so we can throw an exception with a more - # helpful error message. - def setter(self, new_value): - raise AttributeError('Assignment not allowed to repeated field ' - '"%s" in protocol message object.' % proto_field_name) - - doc = 'Magic attribute generated for "%s" proto field.' % proto_field_name - setattr(cls, property_name, _FieldProperty(field, getter, setter, doc=doc)) - - -def _AddPropertiesForNonRepeatedScalarField(field, cls): - """Adds a public property for a nonrepeated, scalar protocol message field. - Clients can use this property to get and directly set the value of the field. - Note that when the client sets the value of a field by using this property, - all necessary "has" bits are set as a side-effect, and we also perform - type-checking. - - Args: - field: A FieldDescriptor for this field. - cls: The class we're constructing. - """ - proto_field_name = field.name - property_name = _PropertyName(proto_field_name) - type_checker = type_checkers.GetTypeChecker(field) - default_value = field.default_value - is_proto3 = field.containing_type.syntax == 'proto3' - - def getter(self): - # TODO(protobuf-team): This may be broken since there may not be - # default_value. Combine with has_default_value somehow. - return self._fields.get(field, default_value) - getter.__module__ = None - getter.__doc__ = 'Getter for %s.' % proto_field_name - - clear_when_set_to_default = is_proto3 and not field.containing_oneof - - def field_setter(self, new_value): - # pylint: disable=protected-access - # Testing the value for truthiness captures all of the proto3 defaults - # (0, 0.0, enum 0, and False). - try: - new_value = type_checker.CheckValue(new_value) - except TypeError as e: - raise TypeError( - 'Cannot set %s to %.1024r: %s' % (field.full_name, new_value, e)) - if clear_when_set_to_default and not new_value: - self._fields.pop(field, None) - else: - self._fields[field] = new_value - # Check _cached_byte_size_dirty inline to improve performance, since scalar - # setters are called frequently. - if not self._cached_byte_size_dirty: - self._Modified() - - if field.containing_oneof: - def setter(self, new_value): - field_setter(self, new_value) - self._UpdateOneofState(field) - else: - setter = field_setter - - setter.__module__ = None - setter.__doc__ = 'Setter for %s.' % proto_field_name - - # Add a property to encapsulate the getter/setter. - doc = 'Magic attribute generated for "%s" proto field.' % proto_field_name - setattr(cls, property_name, _FieldProperty(field, getter, setter, doc=doc)) - - -def _AddPropertiesForNonRepeatedCompositeField(field, cls): - """Adds a public property for a nonrepeated, composite protocol message field. - A composite field is a "group" or "message" field. - - Clients can use this property to get the value of the field, but cannot - assign to the property directly. - - Args: - field: A FieldDescriptor for this field. - cls: The class we're constructing. - """ - # TODO(robinson): Remove duplication with similar method - # for non-repeated scalars. - proto_field_name = field.name - property_name = _PropertyName(proto_field_name) - - def getter(self): - field_value = self._fields.get(field) - if field_value is None: - # Construct a new object to represent this field. - field_value = field._default_constructor(self) - - # Atomically check if another thread has preempted us and, if not, swap - # in the new object we just created. If someone has preempted us, we - # take that object and discard ours. - # WARNING: We are relying on setdefault() being atomic. This is true - # in CPython but we haven't investigated others. This warning appears - # in several other locations in this file. - field_value = self._fields.setdefault(field, field_value) - return field_value - getter.__module__ = None - getter.__doc__ = 'Getter for %s.' % proto_field_name - - # We define a setter just so we can throw an exception with a more - # helpful error message. - def setter(self, new_value): - raise AttributeError('Assignment not allowed to composite field ' - '"%s" in protocol message object.' % proto_field_name) - - # Add a property to encapsulate the getter. - doc = 'Magic attribute generated for "%s" proto field.' % proto_field_name - setattr(cls, property_name, _FieldProperty(field, getter, setter, doc=doc)) - - -def _AddPropertiesForExtensions(descriptor, cls): - """Adds properties for all fields in this protocol message type.""" - extensions = descriptor.extensions_by_name - for extension_name, extension_field in extensions.items(): - constant_name = extension_name.upper() + '_FIELD_NUMBER' - setattr(cls, constant_name, extension_field.number) - - # TODO(amauryfa): Migrate all users of these attributes to functions like - # pool.FindExtensionByNumber(descriptor). - if descriptor.file is not None: - # TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available. - pool = descriptor.file.pool - cls._extensions_by_number = pool._extensions_by_number[descriptor] - cls._extensions_by_name = pool._extensions_by_name[descriptor] - -def _AddStaticMethods(cls): - # TODO(robinson): This probably needs to be thread-safe(?) - def RegisterExtension(extension_handle): - extension_handle.containing_type = cls.DESCRIPTOR - # TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available. - # pylint: disable=protected-access - cls.DESCRIPTOR.file.pool._AddExtensionDescriptor(extension_handle) - _AttachFieldHelpers(cls, extension_handle) - cls.RegisterExtension = staticmethod(RegisterExtension) - - def FromString(s): - message = cls() - message.MergeFromString(s) - return message - cls.FromString = staticmethod(FromString) - - -def _IsPresent(item): - """Given a (FieldDescriptor, value) tuple from _fields, return true if the - value should be included in the list returned by ListFields().""" - - if item[0].label == _FieldDescriptor.LABEL_REPEATED: - return bool(item[1]) - elif item[0].cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - return item[1]._is_present_in_parent - else: - return True - - -def _AddListFieldsMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - - def ListFields(self): - all_fields = [item for item in self._fields.items() if _IsPresent(item)] - all_fields.sort(key = lambda item: item[0].number) - return all_fields - - cls.ListFields = ListFields - -_PROTO3_ERROR_TEMPLATE = \ - ('Protocol message %s has no non-repeated submessage field "%s" ' - 'nor marked as optional') -_PROTO2_ERROR_TEMPLATE = 'Protocol message %s has no non-repeated field "%s"' - -def _AddHasFieldMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - - is_proto3 = (message_descriptor.syntax == "proto3") - error_msg = _PROTO3_ERROR_TEMPLATE if is_proto3 else _PROTO2_ERROR_TEMPLATE - - hassable_fields = {} - for field in message_descriptor.fields: - if field.label == _FieldDescriptor.LABEL_REPEATED: - continue - # For proto3, only submessages and fields inside a oneof have presence. - if (is_proto3 and field.cpp_type != _FieldDescriptor.CPPTYPE_MESSAGE and - not field.containing_oneof): - continue - hassable_fields[field.name] = field - - # Has methods are supported for oneof descriptors. - for oneof in message_descriptor.oneofs: - hassable_fields[oneof.name] = oneof - - def HasField(self, field_name): - try: - field = hassable_fields[field_name] - except KeyError: - raise ValueError(error_msg % (message_descriptor.full_name, field_name)) - - if isinstance(field, descriptor_mod.OneofDescriptor): - try: - return HasField(self, self._oneofs[field].name) - except KeyError: - return False - else: - if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - value = self._fields.get(field) - return value is not None and value._is_present_in_parent - else: - return field in self._fields - - cls.HasField = HasField - - -def _AddClearFieldMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - def ClearField(self, field_name): - try: - field = message_descriptor.fields_by_name[field_name] - except KeyError: - try: - field = message_descriptor.oneofs_by_name[field_name] - if field in self._oneofs: - field = self._oneofs[field] - else: - return - except KeyError: - raise ValueError('Protocol message %s has no "%s" field.' % - (message_descriptor.name, field_name)) - - if field in self._fields: - # To match the C++ implementation, we need to invalidate iterators - # for map fields when ClearField() happens. - if hasattr(self._fields[field], 'InvalidateIterators'): - self._fields[field].InvalidateIterators() - - # Note: If the field is a sub-message, its listener will still point - # at us. That's fine, because the worst than can happen is that it - # will call _Modified() and invalidate our byte size. Big deal. - del self._fields[field] - - if self._oneofs.get(field.containing_oneof, None) is field: - del self._oneofs[field.containing_oneof] - - # Always call _Modified() -- even if nothing was changed, this is - # a mutating method, and thus calling it should cause the field to become - # present in the parent message. - self._Modified() - - cls.ClearField = ClearField - - -def _AddClearExtensionMethod(cls): - """Helper for _AddMessageMethods().""" - def ClearExtension(self, extension_handle): - extension_dict._VerifyExtensionHandle(self, extension_handle) - - # Similar to ClearField(), above. - if extension_handle in self._fields: - del self._fields[extension_handle] - self._Modified() - cls.ClearExtension = ClearExtension - - -def _AddHasExtensionMethod(cls): - """Helper for _AddMessageMethods().""" - def HasExtension(self, extension_handle): - extension_dict._VerifyExtensionHandle(self, extension_handle) - if extension_handle.label == _FieldDescriptor.LABEL_REPEATED: - raise KeyError('"%s" is repeated.' % extension_handle.full_name) - - if extension_handle.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - value = self._fields.get(extension_handle) - return value is not None and value._is_present_in_parent - else: - return extension_handle in self._fields - cls.HasExtension = HasExtension - -def _InternalUnpackAny(msg): - """Unpacks Any message and returns the unpacked message. - - This internal method is different from public Any Unpack method which takes - the target message as argument. _InternalUnpackAny method does not have - target message type and need to find the message type in descriptor pool. - - Args: - msg: An Any message to be unpacked. - - Returns: - The unpacked message. - """ - # TODO(amauryfa): Don't use the factory of generated messages. - # To make Any work with custom factories, use the message factory of the - # parent message. - # pylint: disable=g-import-not-at-top - from opensafely._vendor.google.protobuf import symbol_database - factory = symbol_database.Default() - - type_url = msg.type_url - - if not type_url: - return None - - # TODO(haberman): For now we just strip the hostname. Better logic will be - # required. - type_name = type_url.split('/')[-1] - descriptor = factory.pool.FindMessageTypeByName(type_name) - - if descriptor is None: - return None - - message_class = factory.GetPrototype(descriptor) - message = message_class() - - message.ParseFromString(msg.value) - return message - - -def _AddEqualsMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - def __eq__(self, other): - if (not isinstance(other, message_mod.Message) or - other.DESCRIPTOR != self.DESCRIPTOR): - return False - - if self is other: - return True - - if self.DESCRIPTOR.full_name == _AnyFullTypeName: - any_a = _InternalUnpackAny(self) - any_b = _InternalUnpackAny(other) - if any_a and any_b: - return any_a == any_b - - if not self.ListFields() == other.ListFields(): - return False - - # TODO(jieluo): Fix UnknownFieldSet to consider MessageSet extensions, - # then use it for the comparison. - unknown_fields = list(self._unknown_fields) - unknown_fields.sort() - other_unknown_fields = list(other._unknown_fields) - other_unknown_fields.sort() - return unknown_fields == other_unknown_fields - - cls.__eq__ = __eq__ - - -def _AddStrMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - def __str__(self): - return text_format.MessageToString(self) - cls.__str__ = __str__ - - -def _AddReprMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - def __repr__(self): - return text_format.MessageToString(self) - cls.__repr__ = __repr__ - - -def _AddUnicodeMethod(unused_message_descriptor, cls): - """Helper for _AddMessageMethods().""" - - def __unicode__(self): - return text_format.MessageToString(self, as_utf8=True).decode('utf-8') - cls.__unicode__ = __unicode__ - - -def _BytesForNonRepeatedElement(value, field_number, field_type): - """Returns the number of bytes needed to serialize a non-repeated element. - The returned byte count includes space for tag information and any - other additional space associated with serializing value. - - Args: - value: Value we're serializing. - field_number: Field number of this value. (Since the field number - is stored as part of a varint-encoded tag, this has an impact - on the total bytes required to serialize the value). - field_type: The type of the field. One of the TYPE_* constants - within FieldDescriptor. - """ - try: - fn = type_checkers.TYPE_TO_BYTE_SIZE_FN[field_type] - return fn(field_number, value) - except KeyError: - raise message_mod.EncodeError('Unrecognized field type: %d' % field_type) - - -def _AddByteSizeMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - - def ByteSize(self): - if not self._cached_byte_size_dirty: - return self._cached_byte_size - - size = 0 - descriptor = self.DESCRIPTOR - if descriptor.GetOptions().map_entry: - # Fields of map entry should always be serialized. - size = descriptor.fields_by_name['key']._sizer(self.key) - size += descriptor.fields_by_name['value']._sizer(self.value) - else: - for field_descriptor, field_value in self.ListFields(): - size += field_descriptor._sizer(field_value) - for tag_bytes, value_bytes in self._unknown_fields: - size += len(tag_bytes) + len(value_bytes) - - self._cached_byte_size = size - self._cached_byte_size_dirty = False - self._listener_for_children.dirty = False - return size - - cls.ByteSize = ByteSize - - -def _AddSerializeToStringMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - - def SerializeToString(self, **kwargs): - # Check if the message has all of its required fields set. - if not self.IsInitialized(): - raise message_mod.EncodeError( - 'Message %s is missing required fields: %s' % ( - self.DESCRIPTOR.full_name, ','.join(self.FindInitializationErrors()))) - return self.SerializePartialToString(**kwargs) - cls.SerializeToString = SerializeToString - - -def _AddSerializePartialToStringMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - - def SerializePartialToString(self, **kwargs): - out = BytesIO() - self._InternalSerialize(out.write, **kwargs) - return out.getvalue() - cls.SerializePartialToString = SerializePartialToString - - def InternalSerialize(self, write_bytes, deterministic=None): - if deterministic is None: - deterministic = ( - api_implementation.IsPythonDefaultSerializationDeterministic()) - else: - deterministic = bool(deterministic) - - descriptor = self.DESCRIPTOR - if descriptor.GetOptions().map_entry: - # Fields of map entry should always be serialized. - descriptor.fields_by_name['key']._encoder( - write_bytes, self.key, deterministic) - descriptor.fields_by_name['value']._encoder( - write_bytes, self.value, deterministic) - else: - for field_descriptor, field_value in self.ListFields(): - field_descriptor._encoder(write_bytes, field_value, deterministic) - for tag_bytes, value_bytes in self._unknown_fields: - write_bytes(tag_bytes) - write_bytes(value_bytes) - cls._InternalSerialize = InternalSerialize - - -def _AddMergeFromStringMethod(message_descriptor, cls): - """Helper for _AddMessageMethods().""" - def MergeFromString(self, serialized): - serialized = memoryview(serialized) - length = len(serialized) - try: - if self._InternalParse(serialized, 0, length) != length: - # The only reason _InternalParse would return early is if it - # encountered an end-group tag. - raise message_mod.DecodeError('Unexpected end-group tag.') - except (IndexError, TypeError): - # Now ord(buf[p:p+1]) == ord('') gets TypeError. - raise message_mod.DecodeError('Truncated message.') - except struct.error as e: - raise message_mod.DecodeError(e) - return length # Return this for legacy reasons. - cls.MergeFromString = MergeFromString - - local_ReadTag = decoder.ReadTag - local_SkipField = decoder.SkipField - decoders_by_tag = cls._decoders_by_tag - - def InternalParse(self, buffer, pos, end): - """Create a message from serialized bytes. - - Args: - self: Message, instance of the proto message object. - buffer: memoryview of the serialized data. - pos: int, position to start in the serialized data. - end: int, end position of the serialized data. - - Returns: - Message object. - """ - # Guard against internal misuse, since this function is called internally - # quite extensively, and its easy to accidentally pass bytes. - assert isinstance(buffer, memoryview) - self._Modified() - field_dict = self._fields - # pylint: disable=protected-access - unknown_field_set = self._unknown_field_set - while pos != end: - (tag_bytes, new_pos) = local_ReadTag(buffer, pos) - field_decoder, field_desc = decoders_by_tag.get(tag_bytes, (None, None)) - if field_decoder is None: - if not self._unknown_fields: # pylint: disable=protected-access - self._unknown_fields = [] # pylint: disable=protected-access - if unknown_field_set is None: - # pylint: disable=protected-access - self._unknown_field_set = containers.UnknownFieldSet() - # pylint: disable=protected-access - unknown_field_set = self._unknown_field_set - # pylint: disable=protected-access - (tag, _) = decoder._DecodeVarint(tag_bytes, 0) - field_number, wire_type = wire_format.UnpackTag(tag) - if field_number == 0: - raise message_mod.DecodeError('Field number 0 is illegal.') - # TODO(jieluo): remove old_pos. - old_pos = new_pos - (data, new_pos) = decoder._DecodeUnknownField( - buffer, new_pos, wire_type) # pylint: disable=protected-access - if new_pos == -1: - return pos - # pylint: disable=protected-access - unknown_field_set._add(field_number, wire_type, data) - # TODO(jieluo): remove _unknown_fields. - new_pos = local_SkipField(buffer, old_pos, end, tag_bytes) - if new_pos == -1: - return pos - self._unknown_fields.append( - (tag_bytes, buffer[old_pos:new_pos].tobytes())) - pos = new_pos - else: - pos = field_decoder(buffer, new_pos, end, self, field_dict) - if field_desc: - self._UpdateOneofState(field_desc) - return pos - cls._InternalParse = InternalParse - - -def _AddIsInitializedMethod(message_descriptor, cls): - """Adds the IsInitialized and FindInitializationError methods to the - protocol message class.""" - - required_fields = [field for field in message_descriptor.fields - if field.label == _FieldDescriptor.LABEL_REQUIRED] - - def IsInitialized(self, errors=None): - """Checks if all required fields of a message are set. - - Args: - errors: A list which, if provided, will be populated with the field - paths of all missing required fields. - - Returns: - True iff the specified message has all required fields set. - """ - - # Performance is critical so we avoid HasField() and ListFields(). - - for field in required_fields: - if (field not in self._fields or - (field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE and - not self._fields[field]._is_present_in_parent)): - if errors is not None: - errors.extend(self.FindInitializationErrors()) - return False - - for field, value in list(self._fields.items()): # dict can change size! - if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - if field.label == _FieldDescriptor.LABEL_REPEATED: - if (field.message_type.has_options and - field.message_type.GetOptions().map_entry): - continue - for element in value: - if not element.IsInitialized(): - if errors is not None: - errors.extend(self.FindInitializationErrors()) - return False - elif value._is_present_in_parent and not value.IsInitialized(): - if errors is not None: - errors.extend(self.FindInitializationErrors()) - return False - - return True - - cls.IsInitialized = IsInitialized - - def FindInitializationErrors(self): - """Finds required fields which are not initialized. - - Returns: - A list of strings. Each string is a path to an uninitialized field from - the top-level message, e.g. "foo.bar[5].baz". - """ - - errors = [] # simplify things - - for field in required_fields: - if not self.HasField(field.name): - errors.append(field.name) - - for field, value in self.ListFields(): - if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - if field.is_extension: - name = '(%s)' % field.full_name - else: - name = field.name - - if _IsMapField(field): - if _IsMessageMapField(field): - for key in value: - element = value[key] - prefix = '%s[%s].' % (name, key) - sub_errors = element.FindInitializationErrors() - errors += [prefix + error for error in sub_errors] - else: - # ScalarMaps can't have any initialization errors. - pass - elif field.label == _FieldDescriptor.LABEL_REPEATED: - for i in range(len(value)): - element = value[i] - prefix = '%s[%d].' % (name, i) - sub_errors = element.FindInitializationErrors() - errors += [prefix + error for error in sub_errors] - else: - prefix = name + '.' - sub_errors = value.FindInitializationErrors() - errors += [prefix + error for error in sub_errors] - - return errors - - cls.FindInitializationErrors = FindInitializationErrors - - -def _FullyQualifiedClassName(klass): - module = klass.__module__ - name = getattr(klass, '__qualname__', klass.__name__) - if module in (None, 'builtins', '__builtin__'): - return name - return module + '.' + name - - -def _AddMergeFromMethod(cls): - LABEL_REPEATED = _FieldDescriptor.LABEL_REPEATED - CPPTYPE_MESSAGE = _FieldDescriptor.CPPTYPE_MESSAGE - - def MergeFrom(self, msg): - if not isinstance(msg, cls): - raise TypeError( - 'Parameter to MergeFrom() must be instance of same class: ' - 'expected %s got %s.' % (_FullyQualifiedClassName(cls), - _FullyQualifiedClassName(msg.__class__))) - - assert msg is not self - self._Modified() - - fields = self._fields - - for field, value in msg._fields.items(): - if field.label == LABEL_REPEATED: - field_value = fields.get(field) - if field_value is None: - # Construct a new object to represent this field. - field_value = field._default_constructor(self) - fields[field] = field_value - field_value.MergeFrom(value) - elif field.cpp_type == CPPTYPE_MESSAGE: - if value._is_present_in_parent: - field_value = fields.get(field) - if field_value is None: - # Construct a new object to represent this field. - field_value = field._default_constructor(self) - fields[field] = field_value - field_value.MergeFrom(value) - else: - self._fields[field] = value - if field.containing_oneof: - self._UpdateOneofState(field) - - if msg._unknown_fields: - if not self._unknown_fields: - self._unknown_fields = [] - self._unknown_fields.extend(msg._unknown_fields) - # pylint: disable=protected-access - if self._unknown_field_set is None: - self._unknown_field_set = containers.UnknownFieldSet() - self._unknown_field_set._extend(msg._unknown_field_set) - - cls.MergeFrom = MergeFrom - - -def _AddWhichOneofMethod(message_descriptor, cls): - def WhichOneof(self, oneof_name): - """Returns the name of the currently set field inside a oneof, or None.""" - try: - field = message_descriptor.oneofs_by_name[oneof_name] - except KeyError: - raise ValueError( - 'Protocol message has no oneof "%s" field.' % oneof_name) - - nested_field = self._oneofs.get(field, None) - if nested_field is not None and self.HasField(nested_field.name): - return nested_field.name - else: - return None - - cls.WhichOneof = WhichOneof - - -def _Clear(self): - # Clear fields. - self._fields = {} - self._unknown_fields = () - # pylint: disable=protected-access - if self._unknown_field_set is not None: - self._unknown_field_set._clear() - self._unknown_field_set = None - - self._oneofs = {} - self._Modified() - - -def _UnknownFields(self): - if self._unknown_field_set is None: # pylint: disable=protected-access - # pylint: disable=protected-access - self._unknown_field_set = containers.UnknownFieldSet() - return self._unknown_field_set # pylint: disable=protected-access - - -def _DiscardUnknownFields(self): - self._unknown_fields = [] - self._unknown_field_set = None # pylint: disable=protected-access - for field, value in self.ListFields(): - if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: - if _IsMapField(field): - if _IsMessageMapField(field): - for key in value: - value[key].DiscardUnknownFields() - elif field.label == _FieldDescriptor.LABEL_REPEATED: - for sub_message in value: - sub_message.DiscardUnknownFields() - else: - value.DiscardUnknownFields() - - -def _SetListener(self, listener): - if listener is None: - self._listener = message_listener_mod.NullMessageListener() - else: - self._listener = listener - - -def _AddMessageMethods(message_descriptor, cls): - """Adds implementations of all Message methods to cls.""" - _AddListFieldsMethod(message_descriptor, cls) - _AddHasFieldMethod(message_descriptor, cls) - _AddClearFieldMethod(message_descriptor, cls) - if message_descriptor.is_extendable: - _AddClearExtensionMethod(cls) - _AddHasExtensionMethod(cls) - _AddEqualsMethod(message_descriptor, cls) - _AddStrMethod(message_descriptor, cls) - _AddReprMethod(message_descriptor, cls) - _AddUnicodeMethod(message_descriptor, cls) - _AddByteSizeMethod(message_descriptor, cls) - _AddSerializeToStringMethod(message_descriptor, cls) - _AddSerializePartialToStringMethod(message_descriptor, cls) - _AddMergeFromStringMethod(message_descriptor, cls) - _AddIsInitializedMethod(message_descriptor, cls) - _AddMergeFromMethod(cls) - _AddWhichOneofMethod(message_descriptor, cls) - # Adds methods which do not depend on cls. - cls.Clear = _Clear - cls.UnknownFields = _UnknownFields - cls.DiscardUnknownFields = _DiscardUnknownFields - cls._SetListener = _SetListener - - -def _AddPrivateHelperMethods(message_descriptor, cls): - """Adds implementation of private helper methods to cls.""" - - def Modified(self): - """Sets the _cached_byte_size_dirty bit to true, - and propagates this to our listener iff this was a state change. - """ - - # Note: Some callers check _cached_byte_size_dirty before calling - # _Modified() as an extra optimization. So, if this method is ever - # changed such that it does stuff even when _cached_byte_size_dirty is - # already true, the callers need to be updated. - if not self._cached_byte_size_dirty: - self._cached_byte_size_dirty = True - self._listener_for_children.dirty = True - self._is_present_in_parent = True - self._listener.Modified() - - def _UpdateOneofState(self, field): - """Sets field as the active field in its containing oneof. - - Will also delete currently active field in the oneof, if it is different - from the argument. Does not mark the message as modified. - """ - other_field = self._oneofs.setdefault(field.containing_oneof, field) - if other_field is not field: - del self._fields[other_field] - self._oneofs[field.containing_oneof] = field - - cls._Modified = Modified - cls.SetInParent = Modified - cls._UpdateOneofState = _UpdateOneofState - - -class _Listener(object): - - """MessageListener implementation that a parent message registers with its - child message. - - In order to support semantics like: - - foo.bar.baz.qux = 23 - assert foo.HasField('bar') - - ...child objects must have back references to their parents. - This helper class is at the heart of this support. - """ - - def __init__(self, parent_message): - """Args: - parent_message: The message whose _Modified() method we should call when - we receive Modified() messages. - """ - # This listener establishes a back reference from a child (contained) object - # to its parent (containing) object. We make this a weak reference to avoid - # creating cyclic garbage when the client finishes with the 'parent' object - # in the tree. - if isinstance(parent_message, weakref.ProxyType): - self._parent_message_weakref = parent_message - else: - self._parent_message_weakref = weakref.proxy(parent_message) - - # As an optimization, we also indicate directly on the listener whether - # or not the parent message is dirty. This way we can avoid traversing - # up the tree in the common case. - self.dirty = False - - def Modified(self): - if self.dirty: - return - try: - # Propagate the signal to our parents iff this is the first field set. - self._parent_message_weakref._Modified() - except ReferenceError: - # We can get here if a client has kept a reference to a child object, - # and is now setting a field on it, but the child's parent has been - # garbage-collected. This is not an error. - pass - - -class _OneofListener(_Listener): - """Special listener implementation for setting composite oneof fields.""" - - def __init__(self, parent_message, field): - """Args: - parent_message: The message whose _Modified() method we should call when - we receive Modified() messages. - field: The descriptor of the field being set in the parent message. - """ - super(_OneofListener, self).__init__(parent_message) - self._field = field - - def Modified(self): - """Also updates the state of the containing oneof in the parent message.""" - try: - self._parent_message_weakref._UpdateOneofState(self._field) - super(_OneofListener, self).Modified() - except ReferenceError: - pass diff --git a/opensafely/_vendor/google/protobuf/internal/type_checkers.py b/opensafely/_vendor/google/protobuf/internal/type_checkers.py deleted file mode 100644 index 35f1b4ab..00000000 --- a/opensafely/_vendor/google/protobuf/internal/type_checkers.py +++ /dev/null @@ -1,435 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Provides type checking routines. - -This module defines type checking utilities in the forms of dictionaries: - -VALUE_CHECKERS: A dictionary of field types and a value validation object. -TYPE_TO_BYTE_SIZE_FN: A dictionary with field types and a size computing - function. -TYPE_TO_SERIALIZE_METHOD: A dictionary with field types and serialization - function. -FIELD_TYPE_TO_WIRE_TYPE: A dictionary with field typed and their - corresponding wire types. -TYPE_TO_DESERIALIZE_METHOD: A dictionary with field types and deserialization - function. -""" - -__author__ = 'robinson@google.com (Will Robinson)' - -import ctypes -import numbers - -from opensafely._vendor.google.protobuf.internal import decoder -from opensafely._vendor.google.protobuf.internal import encoder -from opensafely._vendor.google.protobuf.internal import wire_format -from opensafely._vendor.google.protobuf import descriptor - -_FieldDescriptor = descriptor.FieldDescriptor - - -def TruncateToFourByteFloat(original): - return ctypes.c_float(original).value - - -def ToShortestFloat(original): - """Returns the shortest float that has same value in wire.""" - # All 4 byte floats have between 6 and 9 significant digits, so we - # start with 6 as the lower bound. - # It has to be iterative because use '.9g' directly can not get rid - # of the noises for most values. For example if set a float_field=0.9 - # use '.9g' will print 0.899999976. - precision = 6 - rounded = float('{0:.{1}g}'.format(original, precision)) - while TruncateToFourByteFloat(rounded) != original: - precision += 1 - rounded = float('{0:.{1}g}'.format(original, precision)) - return rounded - - -def SupportsOpenEnums(field_descriptor): - return field_descriptor.containing_type.syntax == 'proto3' - - -def GetTypeChecker(field): - """Returns a type checker for a message field of the specified types. - - Args: - field: FieldDescriptor object for this field. - - Returns: - An instance of TypeChecker which can be used to verify the types - of values assigned to a field of the specified type. - """ - if (field.cpp_type == _FieldDescriptor.CPPTYPE_STRING and - field.type == _FieldDescriptor.TYPE_STRING): - return UnicodeValueChecker() - if field.cpp_type == _FieldDescriptor.CPPTYPE_ENUM: - if SupportsOpenEnums(field): - # When open enums are supported, any int32 can be assigned. - return _VALUE_CHECKERS[_FieldDescriptor.CPPTYPE_INT32] - else: - return EnumValueChecker(field.enum_type) - return _VALUE_CHECKERS[field.cpp_type] - - -# None of the typecheckers below make any attempt to guard against people -# subclassing builtin types and doing weird things. We're not trying to -# protect against malicious clients here, just people accidentally shooting -# themselves in the foot in obvious ways. -class TypeChecker(object): - - """Type checker used to catch type errors as early as possible - when the client is setting scalar fields in protocol messages. - """ - - def __init__(self, *acceptable_types): - self._acceptable_types = acceptable_types - - def CheckValue(self, proposed_value): - """Type check the provided value and return it. - - The returned value might have been normalized to another type. - """ - if not isinstance(proposed_value, self._acceptable_types): - message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), self._acceptable_types)) - raise TypeError(message) - return proposed_value - - -class TypeCheckerWithDefault(TypeChecker): - - def __init__(self, default_value, *acceptable_types): - TypeChecker.__init__(self, *acceptable_types) - self._default_value = default_value - - def DefaultValue(self): - return self._default_value - - -class BoolValueChecker(object): - """Type checker used for bool fields.""" - - def CheckValue(self, proposed_value): - if not hasattr(proposed_value, '__index__') or ( - type(proposed_value).__module__ == 'numpy' and - type(proposed_value).__name__ == 'ndarray'): - message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), (bool, int))) - raise TypeError(message) - return bool(proposed_value) - - def DefaultValue(self): - return False - - -# IntValueChecker and its subclasses perform integer type-checks -# and bounds-checks. -class IntValueChecker(object): - - """Checker used for integer fields. Performs type-check and range check.""" - - def CheckValue(self, proposed_value): - if not hasattr(proposed_value, '__index__') or ( - type(proposed_value).__module__ == 'numpy' and - type(proposed_value).__name__ == 'ndarray'): - message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), (int,))) - raise TypeError(message) - - if not self._MIN <= int(proposed_value) <= self._MAX: - raise ValueError('Value out of range: %d' % proposed_value) - # We force all values to int to make alternate implementations where the - # distinction is more significant (e.g. the C++ implementation) simpler. - proposed_value = int(proposed_value) - return proposed_value - - def DefaultValue(self): - return 0 - - -class EnumValueChecker(object): - - """Checker used for enum fields. Performs type-check and range check.""" - - def __init__(self, enum_type): - self._enum_type = enum_type - - def CheckValue(self, proposed_value): - if not isinstance(proposed_value, numbers.Integral): - message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), (int,))) - raise TypeError(message) - if int(proposed_value) not in self._enum_type.values_by_number: - raise ValueError('Unknown enum value: %d' % proposed_value) - return proposed_value - - def DefaultValue(self): - return self._enum_type.values[0].number - - -class UnicodeValueChecker(object): - - """Checker used for string fields. - - Always returns a unicode value, even if the input is of type str. - """ - - def CheckValue(self, proposed_value): - if not isinstance(proposed_value, (bytes, str)): - message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), (bytes, str))) - raise TypeError(message) - - # If the value is of type 'bytes' make sure that it is valid UTF-8 data. - if isinstance(proposed_value, bytes): - try: - proposed_value = proposed_value.decode('utf-8') - except UnicodeDecodeError: - raise ValueError('%.1024r has type bytes, but isn\'t valid UTF-8 ' - 'encoding. Non-UTF-8 strings must be converted to ' - 'unicode objects before being added.' % - (proposed_value)) - else: - try: - proposed_value.encode('utf8') - except UnicodeEncodeError: - raise ValueError('%.1024r isn\'t a valid unicode string and ' - 'can\'t be encoded in UTF-8.'% - (proposed_value)) - - return proposed_value - - def DefaultValue(self): - return u"" - - -class Int32ValueChecker(IntValueChecker): - # We're sure to use ints instead of longs here since comparison may be more - # efficient. - _MIN = -2147483648 - _MAX = 2147483647 - - -class Uint32ValueChecker(IntValueChecker): - _MIN = 0 - _MAX = (1 << 32) - 1 - - -class Int64ValueChecker(IntValueChecker): - _MIN = -(1 << 63) - _MAX = (1 << 63) - 1 - - -class Uint64ValueChecker(IntValueChecker): - _MIN = 0 - _MAX = (1 << 64) - 1 - - -# The max 4 bytes float is about 3.4028234663852886e+38 -_FLOAT_MAX = float.fromhex('0x1.fffffep+127') -_FLOAT_MIN = -_FLOAT_MAX -_INF = float('inf') -_NEG_INF = float('-inf') - - -class DoubleValueChecker(object): - """Checker used for double fields. - - Performs type-check and range check. - """ - - def CheckValue(self, proposed_value): - """Check and convert proposed_value to float.""" - if (not hasattr(proposed_value, '__float__') and - not hasattr(proposed_value, '__index__')) or ( - type(proposed_value).__module__ == 'numpy' and - type(proposed_value).__name__ == 'ndarray'): - message = ('%.1024r has type %s, but expected one of: int, float' % - (proposed_value, type(proposed_value))) - raise TypeError(message) - return float(proposed_value) - - def DefaultValue(self): - return 0.0 - - -class FloatValueChecker(DoubleValueChecker): - """Checker used for float fields. - - Performs type-check and range check. - - Values exceeding a 32-bit float will be converted to inf/-inf. - """ - - def CheckValue(self, proposed_value): - """Check and convert proposed_value to float.""" - converted_value = super().CheckValue(proposed_value) - # This inf rounding matches the C++ proto SafeDoubleToFloat logic. - if converted_value > _FLOAT_MAX: - return _INF - if converted_value < _FLOAT_MIN: - return _NEG_INF - - return TruncateToFourByteFloat(converted_value) - -# Type-checkers for all scalar CPPTYPEs. -_VALUE_CHECKERS = { - _FieldDescriptor.CPPTYPE_INT32: Int32ValueChecker(), - _FieldDescriptor.CPPTYPE_INT64: Int64ValueChecker(), - _FieldDescriptor.CPPTYPE_UINT32: Uint32ValueChecker(), - _FieldDescriptor.CPPTYPE_UINT64: Uint64ValueChecker(), - _FieldDescriptor.CPPTYPE_DOUBLE: DoubleValueChecker(), - _FieldDescriptor.CPPTYPE_FLOAT: FloatValueChecker(), - _FieldDescriptor.CPPTYPE_BOOL: BoolValueChecker(), - _FieldDescriptor.CPPTYPE_STRING: TypeCheckerWithDefault(b'', bytes), -} - - -# Map from field type to a function F, such that F(field_num, value) -# gives the total byte size for a value of the given type. This -# byte size includes tag information and any other additional space -# associated with serializing "value". -TYPE_TO_BYTE_SIZE_FN = { - _FieldDescriptor.TYPE_DOUBLE: wire_format.DoubleByteSize, - _FieldDescriptor.TYPE_FLOAT: wire_format.FloatByteSize, - _FieldDescriptor.TYPE_INT64: wire_format.Int64ByteSize, - _FieldDescriptor.TYPE_UINT64: wire_format.UInt64ByteSize, - _FieldDescriptor.TYPE_INT32: wire_format.Int32ByteSize, - _FieldDescriptor.TYPE_FIXED64: wire_format.Fixed64ByteSize, - _FieldDescriptor.TYPE_FIXED32: wire_format.Fixed32ByteSize, - _FieldDescriptor.TYPE_BOOL: wire_format.BoolByteSize, - _FieldDescriptor.TYPE_STRING: wire_format.StringByteSize, - _FieldDescriptor.TYPE_GROUP: wire_format.GroupByteSize, - _FieldDescriptor.TYPE_MESSAGE: wire_format.MessageByteSize, - _FieldDescriptor.TYPE_BYTES: wire_format.BytesByteSize, - _FieldDescriptor.TYPE_UINT32: wire_format.UInt32ByteSize, - _FieldDescriptor.TYPE_ENUM: wire_format.EnumByteSize, - _FieldDescriptor.TYPE_SFIXED32: wire_format.SFixed32ByteSize, - _FieldDescriptor.TYPE_SFIXED64: wire_format.SFixed64ByteSize, - _FieldDescriptor.TYPE_SINT32: wire_format.SInt32ByteSize, - _FieldDescriptor.TYPE_SINT64: wire_format.SInt64ByteSize - } - - -# Maps from field types to encoder constructors. -TYPE_TO_ENCODER = { - _FieldDescriptor.TYPE_DOUBLE: encoder.DoubleEncoder, - _FieldDescriptor.TYPE_FLOAT: encoder.FloatEncoder, - _FieldDescriptor.TYPE_INT64: encoder.Int64Encoder, - _FieldDescriptor.TYPE_UINT64: encoder.UInt64Encoder, - _FieldDescriptor.TYPE_INT32: encoder.Int32Encoder, - _FieldDescriptor.TYPE_FIXED64: encoder.Fixed64Encoder, - _FieldDescriptor.TYPE_FIXED32: encoder.Fixed32Encoder, - _FieldDescriptor.TYPE_BOOL: encoder.BoolEncoder, - _FieldDescriptor.TYPE_STRING: encoder.StringEncoder, - _FieldDescriptor.TYPE_GROUP: encoder.GroupEncoder, - _FieldDescriptor.TYPE_MESSAGE: encoder.MessageEncoder, - _FieldDescriptor.TYPE_BYTES: encoder.BytesEncoder, - _FieldDescriptor.TYPE_UINT32: encoder.UInt32Encoder, - _FieldDescriptor.TYPE_ENUM: encoder.EnumEncoder, - _FieldDescriptor.TYPE_SFIXED32: encoder.SFixed32Encoder, - _FieldDescriptor.TYPE_SFIXED64: encoder.SFixed64Encoder, - _FieldDescriptor.TYPE_SINT32: encoder.SInt32Encoder, - _FieldDescriptor.TYPE_SINT64: encoder.SInt64Encoder, - } - - -# Maps from field types to sizer constructors. -TYPE_TO_SIZER = { - _FieldDescriptor.TYPE_DOUBLE: encoder.DoubleSizer, - _FieldDescriptor.TYPE_FLOAT: encoder.FloatSizer, - _FieldDescriptor.TYPE_INT64: encoder.Int64Sizer, - _FieldDescriptor.TYPE_UINT64: encoder.UInt64Sizer, - _FieldDescriptor.TYPE_INT32: encoder.Int32Sizer, - _FieldDescriptor.TYPE_FIXED64: encoder.Fixed64Sizer, - _FieldDescriptor.TYPE_FIXED32: encoder.Fixed32Sizer, - _FieldDescriptor.TYPE_BOOL: encoder.BoolSizer, - _FieldDescriptor.TYPE_STRING: encoder.StringSizer, - _FieldDescriptor.TYPE_GROUP: encoder.GroupSizer, - _FieldDescriptor.TYPE_MESSAGE: encoder.MessageSizer, - _FieldDescriptor.TYPE_BYTES: encoder.BytesSizer, - _FieldDescriptor.TYPE_UINT32: encoder.UInt32Sizer, - _FieldDescriptor.TYPE_ENUM: encoder.EnumSizer, - _FieldDescriptor.TYPE_SFIXED32: encoder.SFixed32Sizer, - _FieldDescriptor.TYPE_SFIXED64: encoder.SFixed64Sizer, - _FieldDescriptor.TYPE_SINT32: encoder.SInt32Sizer, - _FieldDescriptor.TYPE_SINT64: encoder.SInt64Sizer, - } - - -# Maps from field type to a decoder constructor. -TYPE_TO_DECODER = { - _FieldDescriptor.TYPE_DOUBLE: decoder.DoubleDecoder, - _FieldDescriptor.TYPE_FLOAT: decoder.FloatDecoder, - _FieldDescriptor.TYPE_INT64: decoder.Int64Decoder, - _FieldDescriptor.TYPE_UINT64: decoder.UInt64Decoder, - _FieldDescriptor.TYPE_INT32: decoder.Int32Decoder, - _FieldDescriptor.TYPE_FIXED64: decoder.Fixed64Decoder, - _FieldDescriptor.TYPE_FIXED32: decoder.Fixed32Decoder, - _FieldDescriptor.TYPE_BOOL: decoder.BoolDecoder, - _FieldDescriptor.TYPE_STRING: decoder.StringDecoder, - _FieldDescriptor.TYPE_GROUP: decoder.GroupDecoder, - _FieldDescriptor.TYPE_MESSAGE: decoder.MessageDecoder, - _FieldDescriptor.TYPE_BYTES: decoder.BytesDecoder, - _FieldDescriptor.TYPE_UINT32: decoder.UInt32Decoder, - _FieldDescriptor.TYPE_ENUM: decoder.EnumDecoder, - _FieldDescriptor.TYPE_SFIXED32: decoder.SFixed32Decoder, - _FieldDescriptor.TYPE_SFIXED64: decoder.SFixed64Decoder, - _FieldDescriptor.TYPE_SINT32: decoder.SInt32Decoder, - _FieldDescriptor.TYPE_SINT64: decoder.SInt64Decoder, - } - -# Maps from field type to expected wiretype. -FIELD_TYPE_TO_WIRE_TYPE = { - _FieldDescriptor.TYPE_DOUBLE: wire_format.WIRETYPE_FIXED64, - _FieldDescriptor.TYPE_FLOAT: wire_format.WIRETYPE_FIXED32, - _FieldDescriptor.TYPE_INT64: wire_format.WIRETYPE_VARINT, - _FieldDescriptor.TYPE_UINT64: wire_format.WIRETYPE_VARINT, - _FieldDescriptor.TYPE_INT32: wire_format.WIRETYPE_VARINT, - _FieldDescriptor.TYPE_FIXED64: wire_format.WIRETYPE_FIXED64, - _FieldDescriptor.TYPE_FIXED32: wire_format.WIRETYPE_FIXED32, - _FieldDescriptor.TYPE_BOOL: wire_format.WIRETYPE_VARINT, - _FieldDescriptor.TYPE_STRING: - wire_format.WIRETYPE_LENGTH_DELIMITED, - _FieldDescriptor.TYPE_GROUP: wire_format.WIRETYPE_START_GROUP, - _FieldDescriptor.TYPE_MESSAGE: - wire_format.WIRETYPE_LENGTH_DELIMITED, - _FieldDescriptor.TYPE_BYTES: - wire_format.WIRETYPE_LENGTH_DELIMITED, - _FieldDescriptor.TYPE_UINT32: wire_format.WIRETYPE_VARINT, - _FieldDescriptor.TYPE_ENUM: wire_format.WIRETYPE_VARINT, - _FieldDescriptor.TYPE_SFIXED32: wire_format.WIRETYPE_FIXED32, - _FieldDescriptor.TYPE_SFIXED64: wire_format.WIRETYPE_FIXED64, - _FieldDescriptor.TYPE_SINT32: wire_format.WIRETYPE_VARINT, - _FieldDescriptor.TYPE_SINT64: wire_format.WIRETYPE_VARINT, - } diff --git a/opensafely/_vendor/google/protobuf/internal/well_known_types.py b/opensafely/_vendor/google/protobuf/internal/well_known_types.py deleted file mode 100644 index 2be1fef3..00000000 --- a/opensafely/_vendor/google/protobuf/internal/well_known_types.py +++ /dev/null @@ -1,878 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Contains well known classes. - -This files defines well known classes which need extra maintenance including: - - Any - - Duration - - FieldMask - - Struct - - Timestamp -""" - -__author__ = 'jieluo@google.com (Jie Luo)' - -import calendar -import collections.abc -import datetime - -from opensafely._vendor.google.protobuf.descriptor import FieldDescriptor - -_TIMESTAMPFOMAT = '%Y-%m-%dT%H:%M:%S' -_NANOS_PER_SECOND = 1000000000 -_NANOS_PER_MILLISECOND = 1000000 -_NANOS_PER_MICROSECOND = 1000 -_MILLIS_PER_SECOND = 1000 -_MICROS_PER_SECOND = 1000000 -_SECONDS_PER_DAY = 24 * 3600 -_DURATION_SECONDS_MAX = 315576000000 - - -class Any(object): - """Class for Any Message type.""" - - __slots__ = () - - def Pack(self, msg, type_url_prefix='type.googleapis.com/', - deterministic=None): - """Packs the specified message into current Any message.""" - if len(type_url_prefix) < 1 or type_url_prefix[-1] != '/': - self.type_url = '%s/%s' % (type_url_prefix, msg.DESCRIPTOR.full_name) - else: - self.type_url = '%s%s' % (type_url_prefix, msg.DESCRIPTOR.full_name) - self.value = msg.SerializeToString(deterministic=deterministic) - - def Unpack(self, msg): - """Unpacks the current Any message into specified message.""" - descriptor = msg.DESCRIPTOR - if not self.Is(descriptor): - return False - msg.ParseFromString(self.value) - return True - - def TypeName(self): - """Returns the protobuf type name of the inner message.""" - # Only last part is to be used: b/25630112 - return self.type_url.split('/')[-1] - - def Is(self, descriptor): - """Checks if this Any represents the given protobuf type.""" - return '/' in self.type_url and self.TypeName() == descriptor.full_name - - -_EPOCH_DATETIME_NAIVE = datetime.datetime.utcfromtimestamp(0) -_EPOCH_DATETIME_AWARE = datetime.datetime.fromtimestamp( - 0, tz=datetime.timezone.utc) - - -class Timestamp(object): - """Class for Timestamp message type.""" - - __slots__ = () - - def ToJsonString(self): - """Converts Timestamp to RFC 3339 date string format. - - Returns: - A string converted from timestamp. The string is always Z-normalized - and uses 3, 6 or 9 fractional digits as required to represent the - exact time. Example of the return format: '1972-01-01T10:00:20.021Z' - """ - nanos = self.nanos % _NANOS_PER_SECOND - total_sec = self.seconds + (self.nanos - nanos) // _NANOS_PER_SECOND - seconds = total_sec % _SECONDS_PER_DAY - days = (total_sec - seconds) // _SECONDS_PER_DAY - dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(days, seconds) - - result = dt.isoformat() - if (nanos % 1e9) == 0: - # If there are 0 fractional digits, the fractional - # point '.' should be omitted when serializing. - return result + 'Z' - if (nanos % 1e6) == 0: - # Serialize 3 fractional digits. - return result + '.%03dZ' % (nanos / 1e6) - if (nanos % 1e3) == 0: - # Serialize 6 fractional digits. - return result + '.%06dZ' % (nanos / 1e3) - # Serialize 9 fractional digits. - return result + '.%09dZ' % nanos - - def FromJsonString(self, value): - """Parse a RFC 3339 date string format to Timestamp. - - Args: - value: A date string. Any fractional digits (or none) and any offset are - accepted as long as they fit into nano-seconds precision. - Example of accepted format: '1972-01-01T10:00:20.021-05:00' - - Raises: - ValueError: On parsing problems. - """ - if not isinstance(value, str): - raise ValueError('Timestamp JSON value not a string: {!r}'.format(value)) - timezone_offset = value.find('Z') - if timezone_offset == -1: - timezone_offset = value.find('+') - if timezone_offset == -1: - timezone_offset = value.rfind('-') - if timezone_offset == -1: - raise ValueError( - 'Failed to parse timestamp: missing valid timezone offset.') - time_value = value[0:timezone_offset] - # Parse datetime and nanos. - point_position = time_value.find('.') - if point_position == -1: - second_value = time_value - nano_value = '' - else: - second_value = time_value[:point_position] - nano_value = time_value[point_position + 1:] - if 't' in second_value: - raise ValueError( - 'time data \'{0}\' does not match format \'%Y-%m-%dT%H:%M:%S\', ' - 'lowercase \'t\' is not accepted'.format(second_value)) - date_object = datetime.datetime.strptime(second_value, _TIMESTAMPFOMAT) - td = date_object - datetime.datetime(1970, 1, 1) - seconds = td.seconds + td.days * _SECONDS_PER_DAY - if len(nano_value) > 9: - raise ValueError( - 'Failed to parse Timestamp: nanos {0} more than ' - '9 fractional digits.'.format(nano_value)) - if nano_value: - nanos = round(float('0.' + nano_value) * 1e9) - else: - nanos = 0 - # Parse timezone offsets. - if value[timezone_offset] == 'Z': - if len(value) != timezone_offset + 1: - raise ValueError('Failed to parse timestamp: invalid trailing' - ' data {0}.'.format(value)) - else: - timezone = value[timezone_offset:] - pos = timezone.find(':') - if pos == -1: - raise ValueError( - 'Invalid timezone offset value: {0}.'.format(timezone)) - if timezone[0] == '+': - seconds -= (int(timezone[1:pos])*60+int(timezone[pos+1:]))*60 - else: - seconds += (int(timezone[1:pos])*60+int(timezone[pos+1:]))*60 - # Set seconds and nanos - self.seconds = int(seconds) - self.nanos = int(nanos) - - def GetCurrentTime(self): - """Get the current UTC into Timestamp.""" - self.FromDatetime(datetime.datetime.utcnow()) - - def ToNanoseconds(self): - """Converts Timestamp to nanoseconds since epoch.""" - return self.seconds * _NANOS_PER_SECOND + self.nanos - - def ToMicroseconds(self): - """Converts Timestamp to microseconds since epoch.""" - return (self.seconds * _MICROS_PER_SECOND + - self.nanos // _NANOS_PER_MICROSECOND) - - def ToMilliseconds(self): - """Converts Timestamp to milliseconds since epoch.""" - return (self.seconds * _MILLIS_PER_SECOND + - self.nanos // _NANOS_PER_MILLISECOND) - - def ToSeconds(self): - """Converts Timestamp to seconds since epoch.""" - return self.seconds - - def FromNanoseconds(self, nanos): - """Converts nanoseconds since epoch to Timestamp.""" - self.seconds = nanos // _NANOS_PER_SECOND - self.nanos = nanos % _NANOS_PER_SECOND - - def FromMicroseconds(self, micros): - """Converts microseconds since epoch to Timestamp.""" - self.seconds = micros // _MICROS_PER_SECOND - self.nanos = (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND - - def FromMilliseconds(self, millis): - """Converts milliseconds since epoch to Timestamp.""" - self.seconds = millis // _MILLIS_PER_SECOND - self.nanos = (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND - - def FromSeconds(self, seconds): - """Converts seconds since epoch to Timestamp.""" - self.seconds = seconds - self.nanos = 0 - - def ToDatetime(self, tzinfo=None): - """Converts Timestamp to a datetime. - - Args: - tzinfo: A datetime.tzinfo subclass; defaults to None. - - Returns: - If tzinfo is None, returns a timezone-naive UTC datetime (with no timezone - information, i.e. not aware that it's UTC). - - Otherwise, returns a timezone-aware datetime in the input timezone. - """ - delta = datetime.timedelta( - seconds=self.seconds, - microseconds=_RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND)) - if tzinfo is None: - return _EPOCH_DATETIME_NAIVE + delta - else: - return _EPOCH_DATETIME_AWARE.astimezone(tzinfo) + delta - - def FromDatetime(self, dt): - """Converts datetime to Timestamp. - - Args: - dt: A datetime. If it's timezone-naive, it's assumed to be in UTC. - """ - # Using this guide: http://wiki.python.org/moin/WorkingWithTime - # And this conversion guide: http://docs.python.org/library/time.html - - # Turn the date parameter into a tuple (struct_time) that can then be - # manipulated into a long value of seconds. During the conversion from - # struct_time to long, the source date in UTC, and so it follows that the - # correct transformation is calendar.timegm() - self.seconds = calendar.timegm(dt.utctimetuple()) - self.nanos = dt.microsecond * _NANOS_PER_MICROSECOND - - -class Duration(object): - """Class for Duration message type.""" - - __slots__ = () - - def ToJsonString(self): - """Converts Duration to string format. - - Returns: - A string converted from self. The string format will contains - 3, 6, or 9 fractional digits depending on the precision required to - represent the exact Duration value. For example: "1s", "1.010s", - "1.000000100s", "-3.100s" - """ - _CheckDurationValid(self.seconds, self.nanos) - if self.seconds < 0 or self.nanos < 0: - result = '-' - seconds = - self.seconds + int((0 - self.nanos) // 1e9) - nanos = (0 - self.nanos) % 1e9 - else: - result = '' - seconds = self.seconds + int(self.nanos // 1e9) - nanos = self.nanos % 1e9 - result += '%d' % seconds - if (nanos % 1e9) == 0: - # If there are 0 fractional digits, the fractional - # point '.' should be omitted when serializing. - return result + 's' - if (nanos % 1e6) == 0: - # Serialize 3 fractional digits. - return result + '.%03ds' % (nanos / 1e6) - if (nanos % 1e3) == 0: - # Serialize 6 fractional digits. - return result + '.%06ds' % (nanos / 1e3) - # Serialize 9 fractional digits. - return result + '.%09ds' % nanos - - def FromJsonString(self, value): - """Converts a string to Duration. - - Args: - value: A string to be converted. The string must end with 's'. Any - fractional digits (or none) are accepted as long as they fit into - precision. For example: "1s", "1.01s", "1.0000001s", "-3.100s - - Raises: - ValueError: On parsing problems. - """ - if not isinstance(value, str): - raise ValueError('Duration JSON value not a string: {!r}'.format(value)) - if len(value) < 1 or value[-1] != 's': - raise ValueError( - 'Duration must end with letter "s": {0}.'.format(value)) - try: - pos = value.find('.') - if pos == -1: - seconds = int(value[:-1]) - nanos = 0 - else: - seconds = int(value[:pos]) - if value[0] == '-': - nanos = int(round(float('-0{0}'.format(value[pos: -1])) *1e9)) - else: - nanos = int(round(float('0{0}'.format(value[pos: -1])) *1e9)) - _CheckDurationValid(seconds, nanos) - self.seconds = seconds - self.nanos = nanos - except ValueError as e: - raise ValueError( - 'Couldn\'t parse duration: {0} : {1}.'.format(value, e)) - - def ToNanoseconds(self): - """Converts a Duration to nanoseconds.""" - return self.seconds * _NANOS_PER_SECOND + self.nanos - - def ToMicroseconds(self): - """Converts a Duration to microseconds.""" - micros = _RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND) - return self.seconds * _MICROS_PER_SECOND + micros - - def ToMilliseconds(self): - """Converts a Duration to milliseconds.""" - millis = _RoundTowardZero(self.nanos, _NANOS_PER_MILLISECOND) - return self.seconds * _MILLIS_PER_SECOND + millis - - def ToSeconds(self): - """Converts a Duration to seconds.""" - return self.seconds - - def FromNanoseconds(self, nanos): - """Converts nanoseconds to Duration.""" - self._NormalizeDuration(nanos // _NANOS_PER_SECOND, - nanos % _NANOS_PER_SECOND) - - def FromMicroseconds(self, micros): - """Converts microseconds to Duration.""" - self._NormalizeDuration( - micros // _MICROS_PER_SECOND, - (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND) - - def FromMilliseconds(self, millis): - """Converts milliseconds to Duration.""" - self._NormalizeDuration( - millis // _MILLIS_PER_SECOND, - (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND) - - def FromSeconds(self, seconds): - """Converts seconds to Duration.""" - self.seconds = seconds - self.nanos = 0 - - def ToTimedelta(self): - """Converts Duration to timedelta.""" - return datetime.timedelta( - seconds=self.seconds, microseconds=_RoundTowardZero( - self.nanos, _NANOS_PER_MICROSECOND)) - - def FromTimedelta(self, td): - """Converts timedelta to Duration.""" - self._NormalizeDuration(td.seconds + td.days * _SECONDS_PER_DAY, - td.microseconds * _NANOS_PER_MICROSECOND) - - def _NormalizeDuration(self, seconds, nanos): - """Set Duration by seconds and nanos.""" - # Force nanos to be negative if the duration is negative. - if seconds < 0 and nanos > 0: - seconds += 1 - nanos -= _NANOS_PER_SECOND - self.seconds = seconds - self.nanos = nanos - - -def _CheckDurationValid(seconds, nanos): - if seconds < -_DURATION_SECONDS_MAX or seconds > _DURATION_SECONDS_MAX: - raise ValueError( - 'Duration is not valid: Seconds {0} must be in range ' - '[-315576000000, 315576000000].'.format(seconds)) - if nanos <= -_NANOS_PER_SECOND or nanos >= _NANOS_PER_SECOND: - raise ValueError( - 'Duration is not valid: Nanos {0} must be in range ' - '[-999999999, 999999999].'.format(nanos)) - if (nanos < 0 and seconds > 0) or (nanos > 0 and seconds < 0): - raise ValueError( - 'Duration is not valid: Sign mismatch.') - - -def _RoundTowardZero(value, divider): - """Truncates the remainder part after division.""" - # For some languages, the sign of the remainder is implementation - # dependent if any of the operands is negative. Here we enforce - # "rounded toward zero" semantics. For example, for (-5) / 2 an - # implementation may give -3 as the result with the remainder being - # 1. This function ensures we always return -2 (closer to zero). - result = value // divider - remainder = value % divider - if result < 0 and remainder > 0: - return result + 1 - else: - return result - - -class FieldMask(object): - """Class for FieldMask message type.""" - - __slots__ = () - - def ToJsonString(self): - """Converts FieldMask to string according to proto3 JSON spec.""" - camelcase_paths = [] - for path in self.paths: - camelcase_paths.append(_SnakeCaseToCamelCase(path)) - return ','.join(camelcase_paths) - - def FromJsonString(self, value): - """Converts string to FieldMask according to proto3 JSON spec.""" - if not isinstance(value, str): - raise ValueError('FieldMask JSON value not a string: {!r}'.format(value)) - self.Clear() - if value: - for path in value.split(','): - self.paths.append(_CamelCaseToSnakeCase(path)) - - def IsValidForDescriptor(self, message_descriptor): - """Checks whether the FieldMask is valid for Message Descriptor.""" - for path in self.paths: - if not _IsValidPath(message_descriptor, path): - return False - return True - - def AllFieldsFromDescriptor(self, message_descriptor): - """Gets all direct fields of Message Descriptor to FieldMask.""" - self.Clear() - for field in message_descriptor.fields: - self.paths.append(field.name) - - def CanonicalFormFromMask(self, mask): - """Converts a FieldMask to the canonical form. - - Removes paths that are covered by another path. For example, - "foo.bar" is covered by "foo" and will be removed if "foo" - is also in the FieldMask. Then sorts all paths in alphabetical order. - - Args: - mask: The original FieldMask to be converted. - """ - tree = _FieldMaskTree(mask) - tree.ToFieldMask(self) - - def Union(self, mask1, mask2): - """Merges mask1 and mask2 into this FieldMask.""" - _CheckFieldMaskMessage(mask1) - _CheckFieldMaskMessage(mask2) - tree = _FieldMaskTree(mask1) - tree.MergeFromFieldMask(mask2) - tree.ToFieldMask(self) - - def Intersect(self, mask1, mask2): - """Intersects mask1 and mask2 into this FieldMask.""" - _CheckFieldMaskMessage(mask1) - _CheckFieldMaskMessage(mask2) - tree = _FieldMaskTree(mask1) - intersection = _FieldMaskTree() - for path in mask2.paths: - tree.IntersectPath(path, intersection) - intersection.ToFieldMask(self) - - def MergeMessage( - self, source, destination, - replace_message_field=False, replace_repeated_field=False): - """Merges fields specified in FieldMask from source to destination. - - Args: - source: Source message. - destination: The destination message to be merged into. - replace_message_field: Replace message field if True. Merge message - field if False. - replace_repeated_field: Replace repeated field if True. Append - elements of repeated field if False. - """ - tree = _FieldMaskTree(self) - tree.MergeMessage( - source, destination, replace_message_field, replace_repeated_field) - - -def _IsValidPath(message_descriptor, path): - """Checks whether the path is valid for Message Descriptor.""" - parts = path.split('.') - last = parts.pop() - for name in parts: - field = message_descriptor.fields_by_name.get(name) - if (field is None or - field.label == FieldDescriptor.LABEL_REPEATED or - field.type != FieldDescriptor.TYPE_MESSAGE): - return False - message_descriptor = field.message_type - return last in message_descriptor.fields_by_name - - -def _CheckFieldMaskMessage(message): - """Raises ValueError if message is not a FieldMask.""" - message_descriptor = message.DESCRIPTOR - if (message_descriptor.name != 'FieldMask' or - message_descriptor.file.name != 'google/protobuf/field_mask.proto'): - raise ValueError('Message {0} is not a FieldMask.'.format( - message_descriptor.full_name)) - - -def _SnakeCaseToCamelCase(path_name): - """Converts a path name from snake_case to camelCase.""" - result = [] - after_underscore = False - for c in path_name: - if c.isupper(): - raise ValueError( - 'Fail to print FieldMask to Json string: Path name ' - '{0} must not contain uppercase letters.'.format(path_name)) - if after_underscore: - if c.islower(): - result.append(c.upper()) - after_underscore = False - else: - raise ValueError( - 'Fail to print FieldMask to Json string: The ' - 'character after a "_" must be a lowercase letter ' - 'in path name {0}.'.format(path_name)) - elif c == '_': - after_underscore = True - else: - result += c - - if after_underscore: - raise ValueError('Fail to print FieldMask to Json string: Trailing "_" ' - 'in path name {0}.'.format(path_name)) - return ''.join(result) - - -def _CamelCaseToSnakeCase(path_name): - """Converts a field name from camelCase to snake_case.""" - result = [] - for c in path_name: - if c == '_': - raise ValueError('Fail to parse FieldMask: Path name ' - '{0} must not contain "_"s.'.format(path_name)) - if c.isupper(): - result += '_' - result += c.lower() - else: - result += c - return ''.join(result) - - -class _FieldMaskTree(object): - """Represents a FieldMask in a tree structure. - - For example, given a FieldMask "foo.bar,foo.baz,bar.baz", - the FieldMaskTree will be: - [_root] -+- foo -+- bar - | | - | +- baz - | - +- bar --- baz - In the tree, each leaf node represents a field path. - """ - - __slots__ = ('_root',) - - def __init__(self, field_mask=None): - """Initializes the tree by FieldMask.""" - self._root = {} - if field_mask: - self.MergeFromFieldMask(field_mask) - - def MergeFromFieldMask(self, field_mask): - """Merges a FieldMask to the tree.""" - for path in field_mask.paths: - self.AddPath(path) - - def AddPath(self, path): - """Adds a field path into the tree. - - If the field path to add is a sub-path of an existing field path - in the tree (i.e., a leaf node), it means the tree already matches - the given path so nothing will be added to the tree. If the path - matches an existing non-leaf node in the tree, that non-leaf node - will be turned into a leaf node with all its children removed because - the path matches all the node's children. Otherwise, a new path will - be added. - - Args: - path: The field path to add. - """ - node = self._root - for name in path.split('.'): - if name not in node: - node[name] = {} - elif not node[name]: - # Pre-existing empty node implies we already have this entire tree. - return - node = node[name] - # Remove any sub-trees we might have had. - node.clear() - - def ToFieldMask(self, field_mask): - """Converts the tree to a FieldMask.""" - field_mask.Clear() - _AddFieldPaths(self._root, '', field_mask) - - def IntersectPath(self, path, intersection): - """Calculates the intersection part of a field path with this tree. - - Args: - path: The field path to calculates. - intersection: The out tree to record the intersection part. - """ - node = self._root - for name in path.split('.'): - if name not in node: - return - elif not node[name]: - intersection.AddPath(path) - return - node = node[name] - intersection.AddLeafNodes(path, node) - - def AddLeafNodes(self, prefix, node): - """Adds leaf nodes begin with prefix to this tree.""" - if not node: - self.AddPath(prefix) - for name in node: - child_path = prefix + '.' + name - self.AddLeafNodes(child_path, node[name]) - - def MergeMessage( - self, source, destination, - replace_message, replace_repeated): - """Merge all fields specified by this tree from source to destination.""" - _MergeMessage( - self._root, source, destination, replace_message, replace_repeated) - - -def _StrConvert(value): - """Converts value to str if it is not.""" - # This file is imported by c extension and some methods like ClearField - # requires string for the field name. py2/py3 has different text - # type and may use unicode. - if not isinstance(value, str): - return value.encode('utf-8') - return value - - -def _MergeMessage( - node, source, destination, replace_message, replace_repeated): - """Merge all fields specified by a sub-tree from source to destination.""" - source_descriptor = source.DESCRIPTOR - for name in node: - child = node[name] - field = source_descriptor.fields_by_name[name] - if field is None: - raise ValueError('Error: Can\'t find field {0} in message {1}.'.format( - name, source_descriptor.full_name)) - if child: - # Sub-paths are only allowed for singular message fields. - if (field.label == FieldDescriptor.LABEL_REPEATED or - field.cpp_type != FieldDescriptor.CPPTYPE_MESSAGE): - raise ValueError('Error: Field {0} in message {1} is not a singular ' - 'message field and cannot have sub-fields.'.format( - name, source_descriptor.full_name)) - if source.HasField(name): - _MergeMessage( - child, getattr(source, name), getattr(destination, name), - replace_message, replace_repeated) - continue - if field.label == FieldDescriptor.LABEL_REPEATED: - if replace_repeated: - destination.ClearField(_StrConvert(name)) - repeated_source = getattr(source, name) - repeated_destination = getattr(destination, name) - repeated_destination.MergeFrom(repeated_source) - else: - if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE: - if replace_message: - destination.ClearField(_StrConvert(name)) - if source.HasField(name): - getattr(destination, name).MergeFrom(getattr(source, name)) - else: - setattr(destination, name, getattr(source, name)) - - -def _AddFieldPaths(node, prefix, field_mask): - """Adds the field paths descended from node to field_mask.""" - if not node and prefix: - field_mask.paths.append(prefix) - return - for name in sorted(node): - if prefix: - child_path = prefix + '.' + name - else: - child_path = name - _AddFieldPaths(node[name], child_path, field_mask) - - -def _SetStructValue(struct_value, value): - if value is None: - struct_value.null_value = 0 - elif isinstance(value, bool): - # Note: this check must come before the number check because in Python - # True and False are also considered numbers. - struct_value.bool_value = value - elif isinstance(value, str): - struct_value.string_value = value - elif isinstance(value, (int, float)): - struct_value.number_value = value - elif isinstance(value, (dict, Struct)): - struct_value.struct_value.Clear() - struct_value.struct_value.update(value) - elif isinstance(value, (list, ListValue)): - struct_value.list_value.Clear() - struct_value.list_value.extend(value) - else: - raise ValueError('Unexpected type') - - -def _GetStructValue(struct_value): - which = struct_value.WhichOneof('kind') - if which == 'struct_value': - return struct_value.struct_value - elif which == 'null_value': - return None - elif which == 'number_value': - return struct_value.number_value - elif which == 'string_value': - return struct_value.string_value - elif which == 'bool_value': - return struct_value.bool_value - elif which == 'list_value': - return struct_value.list_value - elif which is None: - raise ValueError('Value not set') - - -class Struct(object): - """Class for Struct message type.""" - - __slots__ = () - - def __getitem__(self, key): - return _GetStructValue(self.fields[key]) - - def __contains__(self, item): - return item in self.fields - - def __setitem__(self, key, value): - _SetStructValue(self.fields[key], value) - - def __delitem__(self, key): - del self.fields[key] - - def __len__(self): - return len(self.fields) - - def __iter__(self): - return iter(self.fields) - - def keys(self): # pylint: disable=invalid-name - return self.fields.keys() - - def values(self): # pylint: disable=invalid-name - return [self[key] for key in self] - - def items(self): # pylint: disable=invalid-name - return [(key, self[key]) for key in self] - - def get_or_create_list(self, key): - """Returns a list for this key, creating if it didn't exist already.""" - if not self.fields[key].HasField('list_value'): - # Clear will mark list_value modified which will indeed create a list. - self.fields[key].list_value.Clear() - return self.fields[key].list_value - - def get_or_create_struct(self, key): - """Returns a struct for this key, creating if it didn't exist already.""" - if not self.fields[key].HasField('struct_value'): - # Clear will mark struct_value modified which will indeed create a struct. - self.fields[key].struct_value.Clear() - return self.fields[key].struct_value - - def update(self, dictionary): # pylint: disable=invalid-name - for key, value in dictionary.items(): - _SetStructValue(self.fields[key], value) - -collections.abc.MutableMapping.register(Struct) - - -class ListValue(object): - """Class for ListValue message type.""" - - __slots__ = () - - def __len__(self): - return len(self.values) - - def append(self, value): - _SetStructValue(self.values.add(), value) - - def extend(self, elem_seq): - for value in elem_seq: - self.append(value) - - def __getitem__(self, index): - """Retrieves item by the specified index.""" - return _GetStructValue(self.values.__getitem__(index)) - - def __setitem__(self, index, value): - _SetStructValue(self.values.__getitem__(index), value) - - def __delitem__(self, key): - del self.values[key] - - def items(self): - for i in range(len(self)): - yield self[i] - - def add_struct(self): - """Appends and returns a struct value as the next value in the list.""" - struct_value = self.values.add().struct_value - # Clear will mark struct_value modified which will indeed create a struct. - struct_value.Clear() - return struct_value - - def add_list(self): - """Appends and returns a list value as the next value in the list.""" - list_value = self.values.add().list_value - # Clear will mark list_value modified which will indeed create a list. - list_value.Clear() - return list_value - -collections.abc.MutableSequence.register(ListValue) - - -WKTBASES = { - 'google.protobuf.Any': Any, - 'google.protobuf.Duration': Duration, - 'google.protobuf.FieldMask': FieldMask, - 'google.protobuf.ListValue': ListValue, - 'google.protobuf.Struct': Struct, - 'google.protobuf.Timestamp': Timestamp, -} diff --git a/opensafely/_vendor/google/protobuf/internal/wire_format.py b/opensafely/_vendor/google/protobuf/internal/wire_format.py deleted file mode 100644 index cbd939f3..00000000 --- a/opensafely/_vendor/google/protobuf/internal/wire_format.py +++ /dev/null @@ -1,268 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Constants and static functions to support protocol buffer wire format.""" - -__author__ = 'robinson@google.com (Will Robinson)' - -import struct -from opensafely._vendor.google.protobuf import descriptor -from opensafely._vendor.google.protobuf import message - - -TAG_TYPE_BITS = 3 # Number of bits used to hold type info in a proto tag. -TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1 # 0x7 - -# These numbers identify the wire type of a protocol buffer value. -# We use the least-significant TAG_TYPE_BITS bits of the varint-encoded -# tag-and-type to store one of these WIRETYPE_* constants. -# These values must match WireType enum in google/protobuf/wire_format.h. -WIRETYPE_VARINT = 0 -WIRETYPE_FIXED64 = 1 -WIRETYPE_LENGTH_DELIMITED = 2 -WIRETYPE_START_GROUP = 3 -WIRETYPE_END_GROUP = 4 -WIRETYPE_FIXED32 = 5 -_WIRETYPE_MAX = 5 - - -# Bounds for various integer types. -INT32_MAX = int((1 << 31) - 1) -INT32_MIN = int(-(1 << 31)) -UINT32_MAX = (1 << 32) - 1 - -INT64_MAX = (1 << 63) - 1 -INT64_MIN = -(1 << 63) -UINT64_MAX = (1 << 64) - 1 - -# "struct" format strings that will encode/decode the specified formats. -FORMAT_UINT32_LITTLE_ENDIAN = '> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK) - - -def ZigZagEncode(value): - """ZigZag Transform: Encodes signed integers so that they can be - effectively used with varint encoding. See wire_format.h for - more details. - """ - if value >= 0: - return value << 1 - return (value << 1) ^ (~0) - - -def ZigZagDecode(value): - """Inverse of ZigZagEncode().""" - if not value & 0x1: - return value >> 1 - return (value >> 1) ^ (~0) - - - -# The *ByteSize() functions below return the number of bytes required to -# serialize "field number + type" information and then serialize the value. - - -def Int32ByteSize(field_number, int32): - return Int64ByteSize(field_number, int32) - - -def Int32ByteSizeNoTag(int32): - return _VarUInt64ByteSizeNoTag(0xffffffffffffffff & int32) - - -def Int64ByteSize(field_number, int64): - # Have to convert to uint before calling UInt64ByteSize(). - return UInt64ByteSize(field_number, 0xffffffffffffffff & int64) - - -def UInt32ByteSize(field_number, uint32): - return UInt64ByteSize(field_number, uint32) - - -def UInt64ByteSize(field_number, uint64): - return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(uint64) - - -def SInt32ByteSize(field_number, int32): - return UInt32ByteSize(field_number, ZigZagEncode(int32)) - - -def SInt64ByteSize(field_number, int64): - return UInt64ByteSize(field_number, ZigZagEncode(int64)) - - -def Fixed32ByteSize(field_number, fixed32): - return TagByteSize(field_number) + 4 - - -def Fixed64ByteSize(field_number, fixed64): - return TagByteSize(field_number) + 8 - - -def SFixed32ByteSize(field_number, sfixed32): - return TagByteSize(field_number) + 4 - - -def SFixed64ByteSize(field_number, sfixed64): - return TagByteSize(field_number) + 8 - - -def FloatByteSize(field_number, flt): - return TagByteSize(field_number) + 4 - - -def DoubleByteSize(field_number, double): - return TagByteSize(field_number) + 8 - - -def BoolByteSize(field_number, b): - return TagByteSize(field_number) + 1 - - -def EnumByteSize(field_number, enum): - return UInt32ByteSize(field_number, enum) - - -def StringByteSize(field_number, string): - return BytesByteSize(field_number, string.encode('utf-8')) - - -def BytesByteSize(field_number, b): - return (TagByteSize(field_number) - + _VarUInt64ByteSizeNoTag(len(b)) - + len(b)) - - -def GroupByteSize(field_number, message): - return (2 * TagByteSize(field_number) # START and END group. - + message.ByteSize()) - - -def MessageByteSize(field_number, message): - return (TagByteSize(field_number) - + _VarUInt64ByteSizeNoTag(message.ByteSize()) - + message.ByteSize()) - - -def MessageSetItemByteSize(field_number, msg): - # First compute the sizes of the tags. - # There are 2 tags for the beginning and ending of the repeated group, that - # is field number 1, one with field number 2 (type_id) and one with field - # number 3 (message). - total_size = (2 * TagByteSize(1) + TagByteSize(2) + TagByteSize(3)) - - # Add the number of bytes for type_id. - total_size += _VarUInt64ByteSizeNoTag(field_number) - - message_size = msg.ByteSize() - - # The number of bytes for encoding the length of the message. - total_size += _VarUInt64ByteSizeNoTag(message_size) - - # The size of the message. - total_size += message_size - return total_size - - -def TagByteSize(field_number): - """Returns the bytes required to serialize a tag with this field number.""" - # Just pass in type 0, since the type won't affect the tag+type size. - return _VarUInt64ByteSizeNoTag(PackTag(field_number, 0)) - - -# Private helper function for the *ByteSize() functions above. - -def _VarUInt64ByteSizeNoTag(uint64): - """Returns the number of bytes required to serialize a single varint - using boundary value comparisons. (unrolled loop optimization -WPierce) - uint64 must be unsigned. - """ - if uint64 <= 0x7f: return 1 - if uint64 <= 0x3fff: return 2 - if uint64 <= 0x1fffff: return 3 - if uint64 <= 0xfffffff: return 4 - if uint64 <= 0x7ffffffff: return 5 - if uint64 <= 0x3ffffffffff: return 6 - if uint64 <= 0x1ffffffffffff: return 7 - if uint64 <= 0xffffffffffffff: return 8 - if uint64 <= 0x7fffffffffffffff: return 9 - if uint64 > UINT64_MAX: - raise message.EncodeError('Value out of range: %d' % uint64) - return 10 - - -NON_PACKABLE_TYPES = ( - descriptor.FieldDescriptor.TYPE_STRING, - descriptor.FieldDescriptor.TYPE_GROUP, - descriptor.FieldDescriptor.TYPE_MESSAGE, - descriptor.FieldDescriptor.TYPE_BYTES -) - - -def IsTypePackable(field_type): - """Return true iff packable = true is valid for fields of this type. - - Args: - field_type: a FieldDescriptor::Type value. - - Returns: - True iff fields of this type are packable. - """ - return field_type not in NON_PACKABLE_TYPES diff --git a/opensafely/_vendor/google/protobuf/json_format.py b/opensafely/_vendor/google/protobuf/json_format.py deleted file mode 100644 index c1baa5d0..00000000 --- a/opensafely/_vendor/google/protobuf/json_format.py +++ /dev/null @@ -1,912 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Contains routines for printing protocol messages in JSON format. - -Simple usage example: - - # Create a proto object and serialize it to a json format string. - message = my_proto_pb2.MyMessage(foo='bar') - json_string = json_format.MessageToJson(message) - - # Parse a json format string to proto object. - message = json_format.Parse(json_string, my_proto_pb2.MyMessage()) -""" - -__author__ = 'jieluo@google.com (Jie Luo)' - - -import base64 -from collections import OrderedDict -import json -import math -from operator import methodcaller -import re -import sys - -from opensafely._vendor.google.protobuf.internal import type_checkers -from opensafely._vendor.google.protobuf import descriptor -from opensafely._vendor.google.protobuf import symbol_database - - -_TIMESTAMPFOMAT = '%Y-%m-%dT%H:%M:%S' -_INT_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_INT32, - descriptor.FieldDescriptor.CPPTYPE_UINT32, - descriptor.FieldDescriptor.CPPTYPE_INT64, - descriptor.FieldDescriptor.CPPTYPE_UINT64]) -_INT64_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_INT64, - descriptor.FieldDescriptor.CPPTYPE_UINT64]) -_FLOAT_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_FLOAT, - descriptor.FieldDescriptor.CPPTYPE_DOUBLE]) -_INFINITY = 'Infinity' -_NEG_INFINITY = '-Infinity' -_NAN = 'NaN' - -_UNPAIRED_SURROGATE_PATTERN = re.compile( - u'[\ud800-\udbff](?![\udc00-\udfff])|(? self.max_recursion_depth: - raise ParseError('Message too deep. Max recursion depth is {0}'.format( - self.max_recursion_depth)) - message_descriptor = message.DESCRIPTOR - full_name = message_descriptor.full_name - if not path: - path = message_descriptor.name - if _IsWrapperMessage(message_descriptor): - self._ConvertWrapperMessage(value, message, path) - elif full_name in _WKTJSONMETHODS: - methodcaller(_WKTJSONMETHODS[full_name][1], value, message, path)(self) - else: - self._ConvertFieldValuePair(value, message, path) - self.recursion_depth -= 1 - - def _ConvertFieldValuePair(self, js, message, path): - """Convert field value pairs into regular message. - - Args: - js: A JSON object to convert the field value pairs. - message: A regular protocol message to record the data. - path: parent path to log parse error info. - - Raises: - ParseError: In case of problems converting. - """ - names = [] - message_descriptor = message.DESCRIPTOR - fields_by_json_name = dict((f.json_name, f) - for f in message_descriptor.fields) - for name in js: - try: - field = fields_by_json_name.get(name, None) - if not field: - field = message_descriptor.fields_by_name.get(name, None) - if not field and _VALID_EXTENSION_NAME.match(name): - if not message_descriptor.is_extendable: - raise ParseError( - 'Message type {0} does not have extensions at {1}'.format( - message_descriptor.full_name, path)) - identifier = name[1:-1] # strip [] brackets - # pylint: disable=protected-access - field = message.Extensions._FindExtensionByName(identifier) - # pylint: enable=protected-access - if not field: - # Try looking for extension by the message type name, dropping the - # field name following the final . separator in full_name. - identifier = '.'.join(identifier.split('.')[:-1]) - # pylint: disable=protected-access - field = message.Extensions._FindExtensionByName(identifier) - # pylint: enable=protected-access - if not field: - if self.ignore_unknown_fields: - continue - raise ParseError( - ('Message type "{0}" has no field named "{1}" at "{2}".\n' - ' Available Fields(except extensions): "{3}"').format( - message_descriptor.full_name, name, path, - [f.json_name for f in message_descriptor.fields])) - if name in names: - raise ParseError('Message type "{0}" should not have multiple ' - '"{1}" fields at "{2}".'.format( - message.DESCRIPTOR.full_name, name, path)) - names.append(name) - value = js[name] - # Check no other oneof field is parsed. - if field.containing_oneof is not None and value is not None: - oneof_name = field.containing_oneof.name - if oneof_name in names: - raise ParseError('Message type "{0}" should not have multiple ' - '"{1}" oneof fields at "{2}".'.format( - message.DESCRIPTOR.full_name, oneof_name, - path)) - names.append(oneof_name) - - if value is None: - if (field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE - and field.message_type.full_name == 'google.protobuf.Value'): - sub_message = getattr(message, field.name) - sub_message.null_value = 0 - elif (field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM - and field.enum_type.full_name == 'google.protobuf.NullValue'): - setattr(message, field.name, 0) - else: - message.ClearField(field.name) - continue - - # Parse field value. - if _IsMapEntry(field): - message.ClearField(field.name) - self._ConvertMapFieldValue(value, message, field, - '{0}.{1}'.format(path, name)) - elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED: - message.ClearField(field.name) - if not isinstance(value, list): - raise ParseError('repeated field {0} must be in [] which is ' - '{1} at {2}'.format(name, value, path)) - if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: - # Repeated message field. - for index, item in enumerate(value): - sub_message = getattr(message, field.name).add() - # None is a null_value in Value. - if (item is None and - sub_message.DESCRIPTOR.full_name != 'google.protobuf.Value'): - raise ParseError('null is not allowed to be used as an element' - ' in a repeated field at {0}.{1}[{2}]'.format( - path, name, index)) - self.ConvertMessage(item, sub_message, - '{0}.{1}[{2}]'.format(path, name, index)) - else: - # Repeated scalar field. - for index, item in enumerate(value): - if item is None: - raise ParseError('null is not allowed to be used as an element' - ' in a repeated field at {0}.{1}[{2}]'.format( - path, name, index)) - getattr(message, field.name).append( - _ConvertScalarFieldValue( - item, field, '{0}.{1}[{2}]'.format(path, name, index))) - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: - if field.is_extension: - sub_message = message.Extensions[field] - else: - sub_message = getattr(message, field.name) - sub_message.SetInParent() - self.ConvertMessage(value, sub_message, '{0}.{1}'.format(path, name)) - else: - if field.is_extension: - message.Extensions[field] = _ConvertScalarFieldValue( - value, field, '{0}.{1}'.format(path, name)) - else: - setattr( - message, field.name, - _ConvertScalarFieldValue(value, field, - '{0}.{1}'.format(path, name))) - except ParseError as e: - if field and field.containing_oneof is None: - raise ParseError('Failed to parse {0} field: {1}.'.format(name, e)) - else: - raise ParseError(str(e)) - except ValueError as e: - raise ParseError('Failed to parse {0} field: {1}.'.format(name, e)) - except TypeError as e: - raise ParseError('Failed to parse {0} field: {1}.'.format(name, e)) - - def _ConvertAnyMessage(self, value, message, path): - """Convert a JSON representation into Any message.""" - if isinstance(value, dict) and not value: - return - try: - type_url = value['@type'] - except KeyError: - raise ParseError( - '@type is missing when parsing any message at {0}'.format(path)) - - try: - sub_message = _CreateMessageFromTypeUrl(type_url, self.descriptor_pool) - except TypeError as e: - raise ParseError('{0} at {1}'.format(e, path)) - message_descriptor = sub_message.DESCRIPTOR - full_name = message_descriptor.full_name - if _IsWrapperMessage(message_descriptor): - self._ConvertWrapperMessage(value['value'], sub_message, - '{0}.value'.format(path)) - elif full_name in _WKTJSONMETHODS: - methodcaller(_WKTJSONMETHODS[full_name][1], value['value'], sub_message, - '{0}.value'.format(path))( - self) - else: - del value['@type'] - self._ConvertFieldValuePair(value, sub_message, path) - value['@type'] = type_url - # Sets Any message - message.value = sub_message.SerializeToString() - message.type_url = type_url - - def _ConvertGenericMessage(self, value, message, path): - """Convert a JSON representation into message with FromJsonString.""" - # Duration, Timestamp, FieldMask have a FromJsonString method to do the - # conversion. Users can also call the method directly. - try: - message.FromJsonString(value) - except ValueError as e: - raise ParseError('{0} at {1}'.format(e, path)) - - def _ConvertValueMessage(self, value, message, path): - """Convert a JSON representation into Value message.""" - if isinstance(value, dict): - self._ConvertStructMessage(value, message.struct_value, path) - elif isinstance(value, list): - self._ConvertListValueMessage(value, message.list_value, path) - elif value is None: - message.null_value = 0 - elif isinstance(value, bool): - message.bool_value = value - elif isinstance(value, str): - message.string_value = value - elif isinstance(value, _INT_OR_FLOAT): - message.number_value = value - else: - raise ParseError('Value {0} has unexpected type {1} at {2}'.format( - value, type(value), path)) - - def _ConvertListValueMessage(self, value, message, path): - """Convert a JSON representation into ListValue message.""" - if not isinstance(value, list): - raise ParseError('ListValue must be in [] which is {0} at {1}'.format( - value, path)) - message.ClearField('values') - for index, item in enumerate(value): - self._ConvertValueMessage(item, message.values.add(), - '{0}[{1}]'.format(path, index)) - - def _ConvertStructMessage(self, value, message, path): - """Convert a JSON representation into Struct message.""" - if not isinstance(value, dict): - raise ParseError('Struct must be in a dict which is {0} at {1}'.format( - value, path)) - # Clear will mark the struct as modified so it will be created even if - # there are no values. - message.Clear() - for key in value: - self._ConvertValueMessage(value[key], message.fields[key], - '{0}.{1}'.format(path, key)) - return - - def _ConvertWrapperMessage(self, value, message, path): - """Convert a JSON representation into Wrapper message.""" - field = message.DESCRIPTOR.fields_by_name['value'] - setattr( - message, 'value', - _ConvertScalarFieldValue(value, field, path='{0}.value'.format(path))) - - def _ConvertMapFieldValue(self, value, message, field, path): - """Convert map field value for a message map field. - - Args: - value: A JSON object to convert the map field value. - message: A protocol message to record the converted data. - field: The descriptor of the map field to be converted. - path: parent path to log parse error info. - - Raises: - ParseError: In case of convert problems. - """ - if not isinstance(value, dict): - raise ParseError( - 'Map field {0} must be in a dict which is {1} at {2}'.format( - field.name, value, path)) - key_field = field.message_type.fields_by_name['key'] - value_field = field.message_type.fields_by_name['value'] - for key in value: - key_value = _ConvertScalarFieldValue(key, key_field, - '{0}.key'.format(path), True) - if value_field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: - self.ConvertMessage(value[key], - getattr(message, field.name)[key_value], - '{0}[{1}]'.format(path, key_value)) - else: - getattr(message, field.name)[key_value] = _ConvertScalarFieldValue( - value[key], value_field, path='{0}[{1}]'.format(path, key_value)) - - -def _ConvertScalarFieldValue(value, field, path, require_str=False): - """Convert a single scalar field value. - - Args: - value: A scalar value to convert the scalar field value. - field: The descriptor of the field to convert. - path: parent path to log parse error info. - require_str: If True, the field value must be a str. - - Returns: - The converted scalar field value - - Raises: - ParseError: In case of convert problems. - """ - try: - if field.cpp_type in _INT_TYPES: - return _ConvertInteger(value) - elif field.cpp_type in _FLOAT_TYPES: - return _ConvertFloat(value, field) - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_BOOL: - return _ConvertBool(value, require_str) - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING: - if field.type == descriptor.FieldDescriptor.TYPE_BYTES: - if isinstance(value, str): - encoded = value.encode('utf-8') - else: - encoded = value - # Add extra padding '=' - padded_value = encoded + b'=' * (4 - len(encoded) % 4) - return base64.urlsafe_b64decode(padded_value) - else: - # Checking for unpaired surrogates appears to be unreliable, - # depending on the specific Python version, so we check manually. - if _UNPAIRED_SURROGATE_PATTERN.search(value): - raise ParseError('Unpaired surrogate') - return value - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM: - # Convert an enum value. - enum_value = field.enum_type.values_by_name.get(value, None) - if enum_value is None: - try: - number = int(value) - enum_value = field.enum_type.values_by_number.get(number, None) - except ValueError: - raise ParseError('Invalid enum value {0} for enum type {1}'.format( - value, field.enum_type.full_name)) - if enum_value is None: - if field.file.syntax == 'proto3': - # Proto3 accepts unknown enums. - return number - raise ParseError('Invalid enum value {0} for enum type {1}'.format( - value, field.enum_type.full_name)) - return enum_value.number - except ParseError as e: - raise ParseError('{0} at {1}'.format(e, path)) - - -def _ConvertInteger(value): - """Convert an integer. - - Args: - value: A scalar value to convert. - - Returns: - The integer value. - - Raises: - ParseError: If an integer couldn't be consumed. - """ - if isinstance(value, float) and not value.is_integer(): - raise ParseError('Couldn\'t parse integer: {0}'.format(value)) - - if isinstance(value, str) and value.find(' ') != -1: - raise ParseError('Couldn\'t parse integer: "{0}"'.format(value)) - - if isinstance(value, bool): - raise ParseError('Bool value {0} is not acceptable for ' - 'integer field'.format(value)) - - return int(value) - - -def _ConvertFloat(value, field): - """Convert an floating point number.""" - if isinstance(value, float): - if math.isnan(value): - raise ParseError('Couldn\'t parse NaN, use quoted "NaN" instead') - if math.isinf(value): - if value > 0: - raise ParseError('Couldn\'t parse Infinity or value too large, ' - 'use quoted "Infinity" instead') - else: - raise ParseError('Couldn\'t parse -Infinity or value too small, ' - 'use quoted "-Infinity" instead') - if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_FLOAT: - # pylint: disable=protected-access - if value > type_checkers._FLOAT_MAX: - raise ParseError('Float value too large') - # pylint: disable=protected-access - if value < type_checkers._FLOAT_MIN: - raise ParseError('Float value too small') - if value == 'nan': - raise ParseError('Couldn\'t parse float "nan", use "NaN" instead') - try: - # Assume Python compatible syntax. - return float(value) - except ValueError: - # Check alternative spellings. - if value == _NEG_INFINITY: - return float('-inf') - elif value == _INFINITY: - return float('inf') - elif value == _NAN: - return float('nan') - else: - raise ParseError('Couldn\'t parse float: {0}'.format(value)) - - -def _ConvertBool(value, require_str): - """Convert a boolean value. - - Args: - value: A scalar value to convert. - require_str: If True, value must be a str. - - Returns: - The bool parsed. - - Raises: - ParseError: If a boolean value couldn't be consumed. - """ - if require_str: - if value == 'true': - return True - elif value == 'false': - return False - else: - raise ParseError('Expected "true" or "false", not {0}'.format(value)) - - if not isinstance(value, bool): - raise ParseError('Expected true or false without quotes') - return value - -_WKTJSONMETHODS = { - 'google.protobuf.Any': ['_AnyMessageToJsonObject', - '_ConvertAnyMessage'], - 'google.protobuf.Duration': ['_GenericMessageToJsonObject', - '_ConvertGenericMessage'], - 'google.protobuf.FieldMask': ['_GenericMessageToJsonObject', - '_ConvertGenericMessage'], - 'google.protobuf.ListValue': ['_ListValueMessageToJsonObject', - '_ConvertListValueMessage'], - 'google.protobuf.Struct': ['_StructMessageToJsonObject', - '_ConvertStructMessage'], - 'google.protobuf.Timestamp': ['_GenericMessageToJsonObject', - '_ConvertGenericMessage'], - 'google.protobuf.Value': ['_ValueMessageToJsonObject', - '_ConvertValueMessage'] -} diff --git a/opensafely/_vendor/google/protobuf/message.py b/opensafely/_vendor/google/protobuf/message.py deleted file mode 100644 index d941becc..00000000 --- a/opensafely/_vendor/google/protobuf/message.py +++ /dev/null @@ -1,424 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# TODO(robinson): We should just make these methods all "pure-virtual" and move -# all implementation out, into reflection.py for now. - - -"""Contains an abstract base class for protocol messages.""" - -__author__ = 'robinson@google.com (Will Robinson)' - -class Error(Exception): - """Base error type for this module.""" - pass - - -class DecodeError(Error): - """Exception raised when deserializing messages.""" - pass - - -class EncodeError(Error): - """Exception raised when serializing messages.""" - pass - - -class Message(object): - - """Abstract base class for protocol messages. - - Protocol message classes are almost always generated by the protocol - compiler. These generated types subclass Message and implement the methods - shown below. - """ - - # TODO(robinson): Link to an HTML document here. - - # TODO(robinson): Document that instances of this class will also - # have an Extensions attribute with __getitem__ and __setitem__. - # Again, not sure how to best convey this. - - # TODO(robinson): Document that the class must also have a static - # RegisterExtension(extension_field) method. - # Not sure how to best express at this point. - - # TODO(robinson): Document these fields and methods. - - __slots__ = [] - - #: The :class:`google.protobuf.descriptor.Descriptor` for this message type. - DESCRIPTOR = None - - def __deepcopy__(self, memo=None): - clone = type(self)() - clone.MergeFrom(self) - return clone - - def __eq__(self, other_msg): - """Recursively compares two messages by value and structure.""" - raise NotImplementedError - - def __ne__(self, other_msg): - # Can't just say self != other_msg, since that would infinitely recurse. :) - return not self == other_msg - - def __hash__(self): - raise TypeError('unhashable object') - - def __str__(self): - """Outputs a human-readable representation of the message.""" - raise NotImplementedError - - def __unicode__(self): - """Outputs a human-readable representation of the message.""" - raise NotImplementedError - - def MergeFrom(self, other_msg): - """Merges the contents of the specified message into current message. - - This method merges the contents of the specified message into the current - message. Singular fields that are set in the specified message overwrite - the corresponding fields in the current message. Repeated fields are - appended. Singular sub-messages and groups are recursively merged. - - Args: - other_msg (Message): A message to merge into the current message. - """ - raise NotImplementedError - - def CopyFrom(self, other_msg): - """Copies the content of the specified message into the current message. - - The method clears the current message and then merges the specified - message using MergeFrom. - - Args: - other_msg (Message): A message to copy into the current one. - """ - if self is other_msg: - return - self.Clear() - self.MergeFrom(other_msg) - - def Clear(self): - """Clears all data that was set in the message.""" - raise NotImplementedError - - def SetInParent(self): - """Mark this as present in the parent. - - This normally happens automatically when you assign a field of a - sub-message, but sometimes you want to make the sub-message - present while keeping it empty. If you find yourself using this, - you may want to reconsider your design. - """ - raise NotImplementedError - - def IsInitialized(self): - """Checks if the message is initialized. - - Returns: - bool: The method returns True if the message is initialized (i.e. all of - its required fields are set). - """ - raise NotImplementedError - - # TODO(robinson): MergeFromString() should probably return None and be - # implemented in terms of a helper that returns the # of bytes read. Our - # deserialization routines would use the helper when recursively - # deserializing, but the end user would almost always just want the no-return - # MergeFromString(). - - def MergeFromString(self, serialized): - """Merges serialized protocol buffer data into this message. - - When we find a field in `serialized` that is already present - in this message: - - - If it's a "repeated" field, we append to the end of our list. - - Else, if it's a scalar, we overwrite our field. - - Else, (it's a nonrepeated composite), we recursively merge - into the existing composite. - - Args: - serialized (bytes): Any object that allows us to call - ``memoryview(serialized)`` to access a string of bytes using the - buffer interface. - - Returns: - int: The number of bytes read from `serialized`. - For non-group messages, this will always be `len(serialized)`, - but for messages which are actually groups, this will - generally be less than `len(serialized)`, since we must - stop when we reach an ``END_GROUP`` tag. Note that if - we *do* stop because of an ``END_GROUP`` tag, the number - of bytes returned does not include the bytes - for the ``END_GROUP`` tag information. - - Raises: - DecodeError: if the input cannot be parsed. - """ - # TODO(robinson): Document handling of unknown fields. - # TODO(robinson): When we switch to a helper, this will return None. - raise NotImplementedError - - def ParseFromString(self, serialized): - """Parse serialized protocol buffer data into this message. - - Like :func:`MergeFromString()`, except we clear the object first. - - Raises: - message.DecodeError if the input cannot be parsed. - """ - self.Clear() - return self.MergeFromString(serialized) - - def SerializeToString(self, **kwargs): - """Serializes the protocol message to a binary string. - - Keyword Args: - deterministic (bool): If true, requests deterministic serialization - of the protobuf, with predictable ordering of map keys. - - Returns: - A binary string representation of the message if all of the required - fields in the message are set (i.e. the message is initialized). - - Raises: - EncodeError: if the message isn't initialized (see :func:`IsInitialized`). - """ - raise NotImplementedError - - def SerializePartialToString(self, **kwargs): - """Serializes the protocol message to a binary string. - - This method is similar to SerializeToString but doesn't check if the - message is initialized. - - Keyword Args: - deterministic (bool): If true, requests deterministic serialization - of the protobuf, with predictable ordering of map keys. - - Returns: - bytes: A serialized representation of the partial message. - """ - raise NotImplementedError - - # TODO(robinson): Decide whether we like these better - # than auto-generated has_foo() and clear_foo() methods - # on the instances themselves. This way is less consistent - # with C++, but it makes reflection-type access easier and - # reduces the number of magically autogenerated things. - # - # TODO(robinson): Be sure to document (and test) exactly - # which field names are accepted here. Are we case-sensitive? - # What do we do with fields that share names with Python keywords - # like 'lambda' and 'yield'? - # - # nnorwitz says: - # """ - # Typically (in python), an underscore is appended to names that are - # keywords. So they would become lambda_ or yield_. - # """ - def ListFields(self): - """Returns a list of (FieldDescriptor, value) tuples for present fields. - - A message field is non-empty if HasField() would return true. A singular - primitive field is non-empty if HasField() would return true in proto2 or it - is non zero in proto3. A repeated field is non-empty if it contains at least - one element. The fields are ordered by field number. - - Returns: - list[tuple(FieldDescriptor, value)]: field descriptors and values - for all fields in the message which are not empty. The values vary by - field type. - """ - raise NotImplementedError - - def HasField(self, field_name): - """Checks if a certain field is set for the message. - - For a oneof group, checks if any field inside is set. Note that if the - field_name is not defined in the message descriptor, :exc:`ValueError` will - be raised. - - Args: - field_name (str): The name of the field to check for presence. - - Returns: - bool: Whether a value has been set for the named field. - - Raises: - ValueError: if the `field_name` is not a member of this message. - """ - raise NotImplementedError - - def ClearField(self, field_name): - """Clears the contents of a given field. - - Inside a oneof group, clears the field set. If the name neither refers to a - defined field or oneof group, :exc:`ValueError` is raised. - - Args: - field_name (str): The name of the field to check for presence. - - Raises: - ValueError: if the `field_name` is not a member of this message. - """ - raise NotImplementedError - - def WhichOneof(self, oneof_group): - """Returns the name of the field that is set inside a oneof group. - - If no field is set, returns None. - - Args: - oneof_group (str): the name of the oneof group to check. - - Returns: - str or None: The name of the group that is set, or None. - - Raises: - ValueError: no group with the given name exists - """ - raise NotImplementedError - - def HasExtension(self, extension_handle): - """Checks if a certain extension is present for this message. - - Extensions are retrieved using the :attr:`Extensions` mapping (if present). - - Args: - extension_handle: The handle for the extension to check. - - Returns: - bool: Whether the extension is present for this message. - - Raises: - KeyError: if the extension is repeated. Similar to repeated fields, - there is no separate notion of presence: a "not present" repeated - extension is an empty list. - """ - raise NotImplementedError - - def ClearExtension(self, extension_handle): - """Clears the contents of a given extension. - - Args: - extension_handle: The handle for the extension to clear. - """ - raise NotImplementedError - - def UnknownFields(self): - """Returns the UnknownFieldSet. - - Returns: - UnknownFieldSet: The unknown fields stored in this message. - """ - raise NotImplementedError - - def DiscardUnknownFields(self): - """Clears all fields in the :class:`UnknownFieldSet`. - - This operation is recursive for nested message. - """ - raise NotImplementedError - - def ByteSize(self): - """Returns the serialized size of this message. - - Recursively calls ByteSize() on all contained messages. - - Returns: - int: The number of bytes required to serialize this message. - """ - raise NotImplementedError - - @classmethod - def FromString(cls, s): - raise NotImplementedError - - @staticmethod - def RegisterExtension(extension_handle): - raise NotImplementedError - - def _SetListener(self, message_listener): - """Internal method used by the protocol message implementation. - Clients should not call this directly. - - Sets a listener that this message will call on certain state transitions. - - The purpose of this method is to register back-edges from children to - parents at runtime, for the purpose of setting "has" bits and - byte-size-dirty bits in the parent and ancestor objects whenever a child or - descendant object is modified. - - If the client wants to disconnect this Message from the object tree, she - explicitly sets callback to None. - - If message_listener is None, unregisters any existing listener. Otherwise, - message_listener must implement the MessageListener interface in - internal/message_listener.py, and we discard any listener registered - via a previous _SetListener() call. - """ - raise NotImplementedError - - def __getstate__(self): - """Support the pickle protocol.""" - return dict(serialized=self.SerializePartialToString()) - - def __setstate__(self, state): - """Support the pickle protocol.""" - self.__init__() - serialized = state['serialized'] - # On Python 3, using encoding='latin1' is required for unpickling - # protos pickled by Python 2. - if not isinstance(serialized, bytes): - serialized = serialized.encode('latin1') - self.ParseFromString(serialized) - - def __reduce__(self): - message_descriptor = self.DESCRIPTOR - if message_descriptor.containing_type is None: - return type(self), (), self.__getstate__() - # the message type must be nested. - # Python does not pickle nested classes; use the symbol_database on the - # receiving end. - container = message_descriptor - return (_InternalConstructMessage, (container.full_name,), - self.__getstate__()) - - -def _InternalConstructMessage(full_name): - """Constructs a nested message.""" - from opensafely._vendor.google.protobuf import symbol_database # pylint:disable=g-import-not-at-top - - return symbol_database.Default().GetSymbol(full_name)() diff --git a/opensafely/_vendor/google/protobuf/message_factory.py b/opensafely/_vendor/google/protobuf/message_factory.py deleted file mode 100644 index 6cac3410..00000000 --- a/opensafely/_vendor/google/protobuf/message_factory.py +++ /dev/null @@ -1,185 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Provides a factory class for generating dynamic messages. - -The easiest way to use this class is if you have access to the FileDescriptor -protos containing the messages you want to create you can just do the following: - -message_classes = message_factory.GetMessages(iterable_of_file_descriptors) -my_proto_instance = message_classes['some.proto.package.MessageName']() -""" - -__author__ = 'matthewtoia@google.com (Matt Toia)' - -from opensafely._vendor.google.protobuf.internal import api_implementation -from opensafely._vendor.google.protobuf import descriptor_pool -from opensafely._vendor.google.protobuf import message - -if api_implementation.Type() == 'cpp': - from opensafely._vendor.google.protobuf.pyext import cpp_message as message_impl -else: - from opensafely._vendor.google.protobuf.internal import python_message as message_impl - - -# The type of all Message classes. -_GENERATED_PROTOCOL_MESSAGE_TYPE = message_impl.GeneratedProtocolMessageType - - -class MessageFactory(object): - """Factory for creating Proto2 messages from descriptors in a pool.""" - - def __init__(self, pool=None): - """Initializes a new factory.""" - self.pool = pool or descriptor_pool.DescriptorPool() - - # local cache of all classes built from protobuf descriptors - self._classes = {} - - def GetPrototype(self, descriptor): - """Obtains a proto2 message class based on the passed in descriptor. - - Passing a descriptor with a fully qualified name matching a previous - invocation will cause the same class to be returned. - - Args: - descriptor: The descriptor to build from. - - Returns: - A class describing the passed in descriptor. - """ - if descriptor not in self._classes: - result_class = self.CreatePrototype(descriptor) - # The assignment to _classes is redundant for the base implementation, but - # might avoid confusion in cases where CreatePrototype gets overridden and - # does not call the base implementation. - self._classes[descriptor] = result_class - return result_class - return self._classes[descriptor] - - def CreatePrototype(self, descriptor): - """Builds a proto2 message class based on the passed in descriptor. - - Don't call this function directly, it always creates a new class. Call - GetPrototype() instead. This method is meant to be overridden in subblasses - to perform additional operations on the newly constructed class. - - Args: - descriptor: The descriptor to build from. - - Returns: - A class describing the passed in descriptor. - """ - descriptor_name = descriptor.name - result_class = _GENERATED_PROTOCOL_MESSAGE_TYPE( - descriptor_name, - (message.Message,), - { - 'DESCRIPTOR': descriptor, - # If module not set, it wrongly points to message_factory module. - '__module__': None, - }) - result_class._FACTORY = self # pylint: disable=protected-access - # Assign in _classes before doing recursive calls to avoid infinite - # recursion. - self._classes[descriptor] = result_class - for field in descriptor.fields: - if field.message_type: - self.GetPrototype(field.message_type) - for extension in result_class.DESCRIPTOR.extensions: - if extension.containing_type not in self._classes: - self.GetPrototype(extension.containing_type) - extended_class = self._classes[extension.containing_type] - extended_class.RegisterExtension(extension) - return result_class - - def GetMessages(self, files): - """Gets all the messages from a specified file. - - This will find and resolve dependencies, failing if the descriptor - pool cannot satisfy them. - - Args: - files: The file names to extract messages from. - - Returns: - A dictionary mapping proto names to the message classes. This will include - any dependent messages as well as any messages defined in the same file as - a specified message. - """ - result = {} - for file_name in files: - file_desc = self.pool.FindFileByName(file_name) - for desc in file_desc.message_types_by_name.values(): - result[desc.full_name] = self.GetPrototype(desc) - - # While the extension FieldDescriptors are created by the descriptor pool, - # the python classes created in the factory need them to be registered - # explicitly, which is done below. - # - # The call to RegisterExtension will specifically check if the - # extension was already registered on the object and either - # ignore the registration if the original was the same, or raise - # an error if they were different. - - for extension in file_desc.extensions_by_name.values(): - if extension.containing_type not in self._classes: - self.GetPrototype(extension.containing_type) - extended_class = self._classes[extension.containing_type] - extended_class.RegisterExtension(extension) - return result - - -_FACTORY = MessageFactory() - - -def GetMessages(file_protos): - """Builds a dictionary of all the messages available in a set of files. - - Args: - file_protos: Iterable of FileDescriptorProto to build messages out of. - - Returns: - A dictionary mapping proto names to the message classes. This will include - any dependent messages as well as any messages defined in the same file as - a specified message. - """ - # The cpp implementation of the protocol buffer library requires to add the - # message in topological order of the dependency graph. - file_by_name = {file_proto.name: file_proto for file_proto in file_protos} - def _AddFile(file_proto): - for dependency in file_proto.dependency: - if dependency in file_by_name: - # Remove from elements to be visited, in order to cut cycles. - _AddFile(file_by_name.pop(dependency)) - _FACTORY.pool.Add(file_proto) - while file_by_name: - _AddFile(file_by_name.popitem()[1]) - return _FACTORY.GetMessages([file_proto.name for file_proto in file_protos]) diff --git a/opensafely/_vendor/google/protobuf/proto_builder.py b/opensafely/_vendor/google/protobuf/proto_builder.py deleted file mode 100644 index fb8e275d..00000000 --- a/opensafely/_vendor/google/protobuf/proto_builder.py +++ /dev/null @@ -1,134 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Dynamic Protobuf class creator.""" - -from collections import OrderedDict -import hashlib -import os - -from opensafely._vendor.google.protobuf import descriptor_pb2 -from opensafely._vendor.google.protobuf import descriptor -from opensafely._vendor.google.protobuf import message_factory - - -def _GetMessageFromFactory(factory, full_name): - """Get a proto class from the MessageFactory by name. - - Args: - factory: a MessageFactory instance. - full_name: str, the fully qualified name of the proto type. - Returns: - A class, for the type identified by full_name. - Raises: - KeyError, if the proto is not found in the factory's descriptor pool. - """ - proto_descriptor = factory.pool.FindMessageTypeByName(full_name) - proto_cls = factory.GetPrototype(proto_descriptor) - return proto_cls - - -def MakeSimpleProtoClass(fields, full_name=None, pool=None): - """Create a Protobuf class whose fields are basic types. - - Note: this doesn't validate field names! - - Args: - fields: dict of {name: field_type} mappings for each field in the proto. If - this is an OrderedDict the order will be maintained, otherwise the - fields will be sorted by name. - full_name: optional str, the fully-qualified name of the proto type. - pool: optional DescriptorPool instance. - Returns: - a class, the new protobuf class with a FileDescriptor. - """ - factory = message_factory.MessageFactory(pool=pool) - - if full_name is not None: - try: - proto_cls = _GetMessageFromFactory(factory, full_name) - return proto_cls - except KeyError: - # The factory's DescriptorPool doesn't know about this class yet. - pass - - # Get a list of (name, field_type) tuples from the fields dict. If fields was - # an OrderedDict we keep the order, but otherwise we sort the field to ensure - # consistent ordering. - field_items = fields.items() - if not isinstance(fields, OrderedDict): - field_items = sorted(field_items) - - # Use a consistent file name that is unlikely to conflict with any imported - # proto files. - fields_hash = hashlib.sha1() - for f_name, f_type in field_items: - fields_hash.update(f_name.encode('utf-8')) - fields_hash.update(str(f_type).encode('utf-8')) - proto_file_name = fields_hash.hexdigest() + '.proto' - - # If the proto is anonymous, use the same hash to name it. - if full_name is None: - full_name = ('net.proto2.python.public.proto_builder.AnonymousProto_' + - fields_hash.hexdigest()) - try: - proto_cls = _GetMessageFromFactory(factory, full_name) - return proto_cls - except KeyError: - # The factory's DescriptorPool doesn't know about this class yet. - pass - - # This is the first time we see this proto: add a new descriptor to the pool. - factory.pool.Add( - _MakeFileDescriptorProto(proto_file_name, full_name, field_items)) - return _GetMessageFromFactory(factory, full_name) - - -def _MakeFileDescriptorProto(proto_file_name, full_name, field_items): - """Populate FileDescriptorProto for MessageFactory's DescriptorPool.""" - package, name = full_name.rsplit('.', 1) - file_proto = descriptor_pb2.FileDescriptorProto() - file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name) - file_proto.package = package - desc_proto = file_proto.message_type.add() - desc_proto.name = name - for f_number, (f_name, f_type) in enumerate(field_items, 1): - field_proto = desc_proto.field.add() - field_proto.name = f_name - # # If the number falls in the reserved range, reassign it to the correct - # # number after the range. - if f_number >= descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER: - f_number += ( - descriptor.FieldDescriptor.LAST_RESERVED_FIELD_NUMBER - - descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER + 1) - field_proto.number = f_number - field_proto.label = descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL - field_proto.type = f_type - return file_proto diff --git a/opensafely/_vendor/google/protobuf/pyext/__init__.py b/opensafely/_vendor/google/protobuf/pyext/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/protobuf/pyext/cpp_message.py b/opensafely/_vendor/google/protobuf/pyext/cpp_message.py deleted file mode 100644 index 63bdb613..00000000 --- a/opensafely/_vendor/google/protobuf/pyext/cpp_message.py +++ /dev/null @@ -1,65 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Protocol message implementation hooks for C++ implementation. - -Contains helper functions used to create protocol message classes from -Descriptor objects at runtime backed by the protocol buffer C++ API. -""" - -__author__ = 'tibell@google.com (Johan Tibell)' - -from opensafely._vendor.google.protobuf.pyext import _message - - -class GeneratedProtocolMessageType(_message.MessageMeta): - - """Metaclass for protocol message classes created at runtime from Descriptors. - - The protocol compiler currently uses this metaclass to create protocol - message classes at runtime. Clients can also manually create their own - classes at runtime, as in this example: - - mydescriptor = Descriptor(.....) - factory = symbol_database.Default() - factory.pool.AddDescriptor(mydescriptor) - MyProtoClass = factory.GetPrototype(mydescriptor) - myproto_instance = MyProtoClass() - myproto.foo_field = 23 - ... - - The above example will not work for nested types. If you wish to include them, - use reflection.MakeClass() instead of manually instantiating the class in - order to create the appropriate class structure. - """ - - # Must be consistent with the protocol-compiler code in - # proto2/compiler/internal/generator.*. - _DESCRIPTOR_KEY = 'DESCRIPTOR' diff --git a/opensafely/_vendor/google/protobuf/reflection.py b/opensafely/_vendor/google/protobuf/reflection.py deleted file mode 100644 index 08abf284..00000000 --- a/opensafely/_vendor/google/protobuf/reflection.py +++ /dev/null @@ -1,95 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This code is meant to work on Python 2.4 and above only. - -"""Contains a metaclass and helper functions used to create -protocol message classes from Descriptor objects at runtime. - -Recall that a metaclass is the "type" of a class. -(A class is to a metaclass what an instance is to a class.) - -In this case, we use the GeneratedProtocolMessageType metaclass -to inject all the useful functionality into the classes -output by the protocol compiler at compile-time. - -The upshot of all this is that the real implementation -details for ALL pure-Python protocol buffers are *here in -this file*. -""" - -__author__ = 'robinson@google.com (Will Robinson)' - - -from opensafely._vendor.google.protobuf import message_factory -from opensafely._vendor.google.protobuf import symbol_database - -# The type of all Message classes. -# Part of the public interface, but normally only used by message factories. -GeneratedProtocolMessageType = message_factory._GENERATED_PROTOCOL_MESSAGE_TYPE - -MESSAGE_CLASS_CACHE = {} - - -# Deprecated. Please NEVER use reflection.ParseMessage(). -def ParseMessage(descriptor, byte_str): - """Generate a new Message instance from this Descriptor and a byte string. - - DEPRECATED: ParseMessage is deprecated because it is using MakeClass(). - Please use MessageFactory.GetPrototype() instead. - - Args: - descriptor: Protobuf Descriptor object - byte_str: Serialized protocol buffer byte string - - Returns: - Newly created protobuf Message object. - """ - result_class = MakeClass(descriptor) - new_msg = result_class() - new_msg.ParseFromString(byte_str) - return new_msg - - -# Deprecated. Please NEVER use reflection.MakeClass(). -def MakeClass(descriptor): - """Construct a class object for a protobuf described by descriptor. - - DEPRECATED: use MessageFactory.GetPrototype() instead. - - Args: - descriptor: A descriptor.Descriptor object describing the protobuf. - Returns: - The Message class object described by the descriptor. - """ - # Original implementation leads to duplicate message classes, which won't play - # well with extensions. Message factory info is also missing. - # Redirect to message_factory. - return symbol_database.Default().GetPrototype(descriptor) diff --git a/opensafely/_vendor/google/protobuf/service.py b/opensafely/_vendor/google/protobuf/service.py deleted file mode 100644 index 56252463..00000000 --- a/opensafely/_vendor/google/protobuf/service.py +++ /dev/null @@ -1,228 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""DEPRECATED: Declares the RPC service interfaces. - -This module declares the abstract interfaces underlying proto2 RPC -services. These are intended to be independent of any particular RPC -implementation, so that proto2 services can be used on top of a variety -of implementations. Starting with version 2.3.0, RPC implementations should -not try to build on these, but should instead provide code generator plugins -which generate code specific to the particular RPC implementation. This way -the generated code can be more appropriate for the implementation in use -and can avoid unnecessary layers of indirection. -""" - -__author__ = 'petar@google.com (Petar Petrov)' - - -class RpcException(Exception): - """Exception raised on failed blocking RPC method call.""" - pass - - -class Service(object): - - """Abstract base interface for protocol-buffer-based RPC services. - - Services themselves are abstract classes (implemented either by servers or as - stubs), but they subclass this base interface. The methods of this - interface can be used to call the methods of the service without knowing - its exact type at compile time (analogous to the Message interface). - """ - - def GetDescriptor(): - """Retrieves this service's descriptor.""" - raise NotImplementedError - - def CallMethod(self, method_descriptor, rpc_controller, - request, done): - """Calls a method of the service specified by method_descriptor. - - If "done" is None then the call is blocking and the response - message will be returned directly. Otherwise the call is asynchronous - and "done" will later be called with the response value. - - In the blocking case, RpcException will be raised on error. - - Preconditions: - - * method_descriptor.service == GetDescriptor - * request is of the exact same classes as returned by - GetRequestClass(method). - * After the call has started, the request must not be modified. - * "rpc_controller" is of the correct type for the RPC implementation being - used by this Service. For stubs, the "correct type" depends on the - RpcChannel which the stub is using. - - Postconditions: - - * "done" will be called when the method is complete. This may be - before CallMethod() returns or it may be at some point in the future. - * If the RPC failed, the response value passed to "done" will be None. - Further details about the failure can be found by querying the - RpcController. - """ - raise NotImplementedError - - def GetRequestClass(self, method_descriptor): - """Returns the class of the request message for the specified method. - - CallMethod() requires that the request is of a particular subclass of - Message. GetRequestClass() gets the default instance of this required - type. - - Example: - method = service.GetDescriptor().FindMethodByName("Foo") - request = stub.GetRequestClass(method)() - request.ParseFromString(input) - service.CallMethod(method, request, callback) - """ - raise NotImplementedError - - def GetResponseClass(self, method_descriptor): - """Returns the class of the response message for the specified method. - - This method isn't really needed, as the RpcChannel's CallMethod constructs - the response protocol message. It's provided anyway in case it is useful - for the caller to know the response type in advance. - """ - raise NotImplementedError - - -class RpcController(object): - - """An RpcController mediates a single method call. - - The primary purpose of the controller is to provide a way to manipulate - settings specific to the RPC implementation and to find out about RPC-level - errors. The methods provided by the RpcController interface are intended - to be a "least common denominator" set of features which we expect all - implementations to support. Specific implementations may provide more - advanced features (e.g. deadline propagation). - """ - - # Client-side methods below - - def Reset(self): - """Resets the RpcController to its initial state. - - After the RpcController has been reset, it may be reused in - a new call. Must not be called while an RPC is in progress. - """ - raise NotImplementedError - - def Failed(self): - """Returns true if the call failed. - - After a call has finished, returns true if the call failed. The possible - reasons for failure depend on the RPC implementation. Failed() must not - be called before a call has finished. If Failed() returns true, the - contents of the response message are undefined. - """ - raise NotImplementedError - - def ErrorText(self): - """If Failed is true, returns a human-readable description of the error.""" - raise NotImplementedError - - def StartCancel(self): - """Initiate cancellation. - - Advises the RPC system that the caller desires that the RPC call be - canceled. The RPC system may cancel it immediately, may wait awhile and - then cancel it, or may not even cancel the call at all. If the call is - canceled, the "done" callback will still be called and the RpcController - will indicate that the call failed at that time. - """ - raise NotImplementedError - - # Server-side methods below - - def SetFailed(self, reason): - """Sets a failure reason. - - Causes Failed() to return true on the client side. "reason" will be - incorporated into the message returned by ErrorText(). If you find - you need to return machine-readable information about failures, you - should incorporate it into your response protocol buffer and should - NOT call SetFailed(). - """ - raise NotImplementedError - - def IsCanceled(self): - """Checks if the client cancelled the RPC. - - If true, indicates that the client canceled the RPC, so the server may - as well give up on replying to it. The server should still call the - final "done" callback. - """ - raise NotImplementedError - - def NotifyOnCancel(self, callback): - """Sets a callback to invoke on cancel. - - Asks that the given callback be called when the RPC is canceled. The - callback will always be called exactly once. If the RPC completes without - being canceled, the callback will be called after completion. If the RPC - has already been canceled when NotifyOnCancel() is called, the callback - will be called immediately. - - NotifyOnCancel() must be called no more than once per request. - """ - raise NotImplementedError - - -class RpcChannel(object): - - """Abstract interface for an RPC channel. - - An RpcChannel represents a communication line to a service which can be used - to call that service's methods. The service may be running on another - machine. Normally, you should not use an RpcChannel directly, but instead - construct a stub {@link Service} wrapping it. Example: - - Example: - RpcChannel channel = rpcImpl.Channel("remotehost.example.com:1234") - RpcController controller = rpcImpl.Controller() - MyService service = MyService_Stub(channel) - service.MyMethod(controller, request, callback) - """ - - def CallMethod(self, method_descriptor, rpc_controller, - request, response_class, done): - """Calls the method identified by the descriptor. - - Call the given method of the remote service. The signature of this - procedure looks the same as Service.CallMethod(), but the requirements - are less strict in one important way: the request object doesn't have to - be of any specific class as long as its descriptor is method.input_type. - """ - raise NotImplementedError diff --git a/opensafely/_vendor/google/protobuf/service_reflection.py b/opensafely/_vendor/google/protobuf/service_reflection.py deleted file mode 100644 index f82ab714..00000000 --- a/opensafely/_vendor/google/protobuf/service_reflection.py +++ /dev/null @@ -1,295 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Contains metaclasses used to create protocol service and service stub -classes from ServiceDescriptor objects at runtime. - -The GeneratedServiceType and GeneratedServiceStubType metaclasses are used to -inject all useful functionality into the classes output by the protocol -compiler at compile-time. -""" - -__author__ = 'petar@google.com (Petar Petrov)' - - -class GeneratedServiceType(type): - - """Metaclass for service classes created at runtime from ServiceDescriptors. - - Implementations for all methods described in the Service class are added here - by this class. We also create properties to allow getting/setting all fields - in the protocol message. - - The protocol compiler currently uses this metaclass to create protocol service - classes at runtime. Clients can also manually create their own classes at - runtime, as in this example:: - - mydescriptor = ServiceDescriptor(.....) - class MyProtoService(service.Service): - __metaclass__ = GeneratedServiceType - DESCRIPTOR = mydescriptor - myservice_instance = MyProtoService() - # ... - """ - - _DESCRIPTOR_KEY = 'DESCRIPTOR' - - def __init__(cls, name, bases, dictionary): - """Creates a message service class. - - Args: - name: Name of the class (ignored, but required by the metaclass - protocol). - bases: Base classes of the class being constructed. - dictionary: The class dictionary of the class being constructed. - dictionary[_DESCRIPTOR_KEY] must contain a ServiceDescriptor object - describing this protocol service type. - """ - # Don't do anything if this class doesn't have a descriptor. This happens - # when a service class is subclassed. - if GeneratedServiceType._DESCRIPTOR_KEY not in dictionary: - return - - descriptor = dictionary[GeneratedServiceType._DESCRIPTOR_KEY] - service_builder = _ServiceBuilder(descriptor) - service_builder.BuildService(cls) - cls.DESCRIPTOR = descriptor - - -class GeneratedServiceStubType(GeneratedServiceType): - - """Metaclass for service stubs created at runtime from ServiceDescriptors. - - This class has similar responsibilities as GeneratedServiceType, except that - it creates the service stub classes. - """ - - _DESCRIPTOR_KEY = 'DESCRIPTOR' - - def __init__(cls, name, bases, dictionary): - """Creates a message service stub class. - - Args: - name: Name of the class (ignored, here). - bases: Base classes of the class being constructed. - dictionary: The class dictionary of the class being constructed. - dictionary[_DESCRIPTOR_KEY] must contain a ServiceDescriptor object - describing this protocol service type. - """ - super(GeneratedServiceStubType, cls).__init__(name, bases, dictionary) - # Don't do anything if this class doesn't have a descriptor. This happens - # when a service stub is subclassed. - if GeneratedServiceStubType._DESCRIPTOR_KEY not in dictionary: - return - - descriptor = dictionary[GeneratedServiceStubType._DESCRIPTOR_KEY] - service_stub_builder = _ServiceStubBuilder(descriptor) - service_stub_builder.BuildServiceStub(cls) - - -class _ServiceBuilder(object): - - """This class constructs a protocol service class using a service descriptor. - - Given a service descriptor, this class constructs a class that represents - the specified service descriptor. One service builder instance constructs - exactly one service class. That means all instances of that class share the - same builder. - """ - - def __init__(self, service_descriptor): - """Initializes an instance of the service class builder. - - Args: - service_descriptor: ServiceDescriptor to use when constructing the - service class. - """ - self.descriptor = service_descriptor - - def BuildService(builder, cls): - """Constructs the service class. - - Args: - cls: The class that will be constructed. - """ - - # CallMethod needs to operate with an instance of the Service class. This - # internal wrapper function exists only to be able to pass the service - # instance to the method that does the real CallMethod work. - # Making sure to use exact argument names from the abstract interface in - # service.py to match the type signature - def _WrapCallMethod(self, method_descriptor, rpc_controller, request, done): - return builder._CallMethod(self, method_descriptor, rpc_controller, - request, done) - - def _WrapGetRequestClass(self, method_descriptor): - return builder._GetRequestClass(method_descriptor) - - def _WrapGetResponseClass(self, method_descriptor): - return builder._GetResponseClass(method_descriptor) - - builder.cls = cls - cls.CallMethod = _WrapCallMethod - cls.GetDescriptor = staticmethod(lambda: builder.descriptor) - cls.GetDescriptor.__doc__ = 'Returns the service descriptor.' - cls.GetRequestClass = _WrapGetRequestClass - cls.GetResponseClass = _WrapGetResponseClass - for method in builder.descriptor.methods: - setattr(cls, method.name, builder._GenerateNonImplementedMethod(method)) - - def _CallMethod(self, srvc, method_descriptor, - rpc_controller, request, callback): - """Calls the method described by a given method descriptor. - - Args: - srvc: Instance of the service for which this method is called. - method_descriptor: Descriptor that represent the method to call. - rpc_controller: RPC controller to use for this method's execution. - request: Request protocol message. - callback: A callback to invoke after the method has completed. - """ - if method_descriptor.containing_service != self.descriptor: - raise RuntimeError( - 'CallMethod() given method descriptor for wrong service type.') - method = getattr(srvc, method_descriptor.name) - return method(rpc_controller, request, callback) - - def _GetRequestClass(self, method_descriptor): - """Returns the class of the request protocol message. - - Args: - method_descriptor: Descriptor of the method for which to return the - request protocol message class. - - Returns: - A class that represents the input protocol message of the specified - method. - """ - if method_descriptor.containing_service != self.descriptor: - raise RuntimeError( - 'GetRequestClass() given method descriptor for wrong service type.') - return method_descriptor.input_type._concrete_class - - def _GetResponseClass(self, method_descriptor): - """Returns the class of the response protocol message. - - Args: - method_descriptor: Descriptor of the method for which to return the - response protocol message class. - - Returns: - A class that represents the output protocol message of the specified - method. - """ - if method_descriptor.containing_service != self.descriptor: - raise RuntimeError( - 'GetResponseClass() given method descriptor for wrong service type.') - return method_descriptor.output_type._concrete_class - - def _GenerateNonImplementedMethod(self, method): - """Generates and returns a method that can be set for a service methods. - - Args: - method: Descriptor of the service method for which a method is to be - generated. - - Returns: - A method that can be added to the service class. - """ - return lambda inst, rpc_controller, request, callback: ( - self._NonImplementedMethod(method.name, rpc_controller, callback)) - - def _NonImplementedMethod(self, method_name, rpc_controller, callback): - """The body of all methods in the generated service class. - - Args: - method_name: Name of the method being executed. - rpc_controller: RPC controller used to execute this method. - callback: A callback which will be invoked when the method finishes. - """ - rpc_controller.SetFailed('Method %s not implemented.' % method_name) - callback(None) - - -class _ServiceStubBuilder(object): - - """Constructs a protocol service stub class using a service descriptor. - - Given a service descriptor, this class constructs a suitable stub class. - A stub is just a type-safe wrapper around an RpcChannel which emulates a - local implementation of the service. - - One service stub builder instance constructs exactly one class. It means all - instances of that class share the same service stub builder. - """ - - def __init__(self, service_descriptor): - """Initializes an instance of the service stub class builder. - - Args: - service_descriptor: ServiceDescriptor to use when constructing the - stub class. - """ - self.descriptor = service_descriptor - - def BuildServiceStub(self, cls): - """Constructs the stub class. - - Args: - cls: The class that will be constructed. - """ - - def _ServiceStubInit(stub, rpc_channel): - stub.rpc_channel = rpc_channel - self.cls = cls - cls.__init__ = _ServiceStubInit - for method in self.descriptor.methods: - setattr(cls, method.name, self._GenerateStubMethod(method)) - - def _GenerateStubMethod(self, method): - return (lambda inst, rpc_controller, request, callback=None: - self._StubMethod(inst, method, rpc_controller, request, callback)) - - def _StubMethod(self, stub, method_descriptor, - rpc_controller, request, callback): - """The body of all service methods in the generated stub class. - - Args: - stub: Stub instance. - method_descriptor: Descriptor of the invoked method. - rpc_controller: Rpc controller to execute the method. - request: Request protocol message. - callback: A callback to execute when the method finishes. - Returns: - Response message (in case of blocking call). - """ - return stub.rpc_channel.CallMethod( - method_descriptor, rpc_controller, request, - method_descriptor.output_type._concrete_class, callback) diff --git a/opensafely/_vendor/google/protobuf/source_context_pb2.py b/opensafely/_vendor/google/protobuf/source_context_pb2.py deleted file mode 100644 index beb6ccda..00000000 --- a/opensafely/_vendor/google/protobuf/source_context_pb2.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/source_context.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$google/protobuf/source_context.proto\x12\x0fgoogle.protobuf\"\"\n\rSourceContext\x12\x11\n\tfile_name\x18\x01 \x01(\tB\x8a\x01\n\x13\x63om.google.protobufB\x12SourceContextProtoP\x01Z6google.golang.org/protobuf/types/known/sourcecontextpb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.source_context_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\022SourceContextProtoP\001Z6google.golang.org/protobuf/types/known/sourcecontextpb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _SOURCECONTEXT._serialized_start=57 - _SOURCECONTEXT._serialized_end=91 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/struct_pb2.py b/opensafely/_vendor/google/protobuf/struct_pb2.py deleted file mode 100644 index 3557e30f..00000000 --- a/opensafely/_vendor/google/protobuf/struct_pb2.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/struct.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cgoogle/protobuf/struct.proto\x12\x0fgoogle.protobuf\"\x84\x01\n\x06Struct\x12\x33\n\x06\x66ields\x18\x01 \x03(\x0b\x32#.google.protobuf.Struct.FieldsEntry\x1a\x45\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\"\xea\x01\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12\x30\n\nlist_value\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.ListValueH\x00\x42\x06\n\x04kind\"3\n\tListValue\x12&\n\x06values\x18\x01 \x03(\x0b\x32\x16.google.protobuf.Value*\x1b\n\tNullValue\x12\x0e\n\nNULL_VALUE\x10\x00\x42\x7f\n\x13\x63om.google.protobufB\x0bStructProtoP\x01Z/google.golang.org/protobuf/types/known/structpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.struct_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\013StructProtoP\001Z/google.golang.org/protobuf/types/known/structpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _STRUCT_FIELDSENTRY._options = None - _STRUCT_FIELDSENTRY._serialized_options = b'8\001' - _NULLVALUE._serialized_start=474 - _NULLVALUE._serialized_end=501 - _STRUCT._serialized_start=50 - _STRUCT._serialized_end=182 - _STRUCT_FIELDSENTRY._serialized_start=113 - _STRUCT_FIELDSENTRY._serialized_end=182 - _VALUE._serialized_start=185 - _VALUE._serialized_end=419 - _LISTVALUE._serialized_start=421 - _LISTVALUE._serialized_end=472 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/symbol_database.py b/opensafely/_vendor/google/protobuf/symbol_database.py deleted file mode 100644 index 3766be05..00000000 --- a/opensafely/_vendor/google/protobuf/symbol_database.py +++ /dev/null @@ -1,194 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""A database of Python protocol buffer generated symbols. - -SymbolDatabase is the MessageFactory for messages generated at compile time, -and makes it easy to create new instances of a registered type, given only the -type's protocol buffer symbol name. - -Example usage:: - - db = symbol_database.SymbolDatabase() - - # Register symbols of interest, from one or multiple files. - db.RegisterFileDescriptor(my_proto_pb2.DESCRIPTOR) - db.RegisterMessage(my_proto_pb2.MyMessage) - db.RegisterEnumDescriptor(my_proto_pb2.MyEnum.DESCRIPTOR) - - # The database can be used as a MessageFactory, to generate types based on - # their name: - types = db.GetMessages(['my_proto.proto']) - my_message_instance = types['MyMessage']() - - # The database's underlying descriptor pool can be queried, so it's not - # necessary to know a type's filename to be able to generate it: - filename = db.pool.FindFileContainingSymbol('MyMessage') - my_message_instance = db.GetMessages([filename])['MyMessage']() - - # This functionality is also provided directly via a convenience method: - my_message_instance = db.GetSymbol('MyMessage')() -""" - - -from opensafely._vendor.google.protobuf.internal import api_implementation -from opensafely._vendor.google.protobuf import descriptor_pool -from opensafely._vendor.google.protobuf import message_factory - - -class SymbolDatabase(message_factory.MessageFactory): - """A database of Python generated symbols.""" - - def RegisterMessage(self, message): - """Registers the given message type in the local database. - - Calls to GetSymbol() and GetMessages() will return messages registered here. - - Args: - message: A :class:`google.protobuf.message.Message` subclass (or - instance); its descriptor will be registered. - - Returns: - The provided message. - """ - - desc = message.DESCRIPTOR - self._classes[desc] = message - self.RegisterMessageDescriptor(desc) - return message - - def RegisterMessageDescriptor(self, message_descriptor): - """Registers the given message descriptor in the local database. - - Args: - message_descriptor (Descriptor): the message descriptor to add. - """ - if api_implementation.Type() == 'python': - # pylint: disable=protected-access - self.pool._AddDescriptor(message_descriptor) - - def RegisterEnumDescriptor(self, enum_descriptor): - """Registers the given enum descriptor in the local database. - - Args: - enum_descriptor (EnumDescriptor): The enum descriptor to register. - - Returns: - EnumDescriptor: The provided descriptor. - """ - if api_implementation.Type() == 'python': - # pylint: disable=protected-access - self.pool._AddEnumDescriptor(enum_descriptor) - return enum_descriptor - - def RegisterServiceDescriptor(self, service_descriptor): - """Registers the given service descriptor in the local database. - - Args: - service_descriptor (ServiceDescriptor): the service descriptor to - register. - """ - if api_implementation.Type() == 'python': - # pylint: disable=protected-access - self.pool._AddServiceDescriptor(service_descriptor) - - def RegisterFileDescriptor(self, file_descriptor): - """Registers the given file descriptor in the local database. - - Args: - file_descriptor (FileDescriptor): The file descriptor to register. - """ - if api_implementation.Type() == 'python': - # pylint: disable=protected-access - self.pool._InternalAddFileDescriptor(file_descriptor) - - def GetSymbol(self, symbol): - """Tries to find a symbol in the local database. - - Currently, this method only returns message.Message instances, however, if - may be extended in future to support other symbol types. - - Args: - symbol (str): a protocol buffer symbol. - - Returns: - A Python class corresponding to the symbol. - - Raises: - KeyError: if the symbol could not be found. - """ - - return self._classes[self.pool.FindMessageTypeByName(symbol)] - - def GetMessages(self, files): - # TODO(amauryfa): Fix the differences with MessageFactory. - """Gets all registered messages from a specified file. - - Only messages already created and registered will be returned; (this is the - case for imported _pb2 modules) - But unlike MessageFactory, this version also returns already defined nested - messages, but does not register any message extensions. - - Args: - files (list[str]): The file names to extract messages from. - - Returns: - A dictionary mapping proto names to the message classes. - - Raises: - KeyError: if a file could not be found. - """ - - def _GetAllMessages(desc): - """Walk a message Descriptor and recursively yields all message names.""" - yield desc - for msg_desc in desc.nested_types: - for nested_desc in _GetAllMessages(msg_desc): - yield nested_desc - - result = {} - for file_name in files: - file_desc = self.pool.FindFileByName(file_name) - for msg_desc in file_desc.message_types_by_name.values(): - for desc in _GetAllMessages(msg_desc): - try: - result[desc.full_name] = self._classes[desc] - except KeyError: - # This descriptor has no registered class, skip it. - pass - return result - - -_DEFAULT = SymbolDatabase(pool=descriptor_pool.Default()) - - -def Default(): - """Returns the default SymbolDatabase.""" - return _DEFAULT diff --git a/opensafely/_vendor/google/protobuf/text_encoding.py b/opensafely/_vendor/google/protobuf/text_encoding.py deleted file mode 100644 index 759cf11f..00000000 --- a/opensafely/_vendor/google/protobuf/text_encoding.py +++ /dev/null @@ -1,110 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Encoding related utilities.""" -import re - -_cescape_chr_to_symbol_map = {} -_cescape_chr_to_symbol_map[9] = r'\t' # optional escape -_cescape_chr_to_symbol_map[10] = r'\n' # optional escape -_cescape_chr_to_symbol_map[13] = r'\r' # optional escape -_cescape_chr_to_symbol_map[34] = r'\"' # necessary escape -_cescape_chr_to_symbol_map[39] = r"\'" # optional escape -_cescape_chr_to_symbol_map[92] = r'\\' # necessary escape - -# Lookup table for unicode -_cescape_unicode_to_str = [chr(i) for i in range(0, 256)] -for byte, string in _cescape_chr_to_symbol_map.items(): - _cescape_unicode_to_str[byte] = string - -# Lookup table for non-utf8, with necessary escapes at (o >= 127 or o < 32) -_cescape_byte_to_str = ([r'\%03o' % i for i in range(0, 32)] + - [chr(i) for i in range(32, 127)] + - [r'\%03o' % i for i in range(127, 256)]) -for byte, string in _cescape_chr_to_symbol_map.items(): - _cescape_byte_to_str[byte] = string -del byte, string - - -def CEscape(text, as_utf8): - # type: (...) -> str - """Escape a bytes string for use in an text protocol buffer. - - Args: - text: A byte string to be escaped. - as_utf8: Specifies if result may contain non-ASCII characters. - In Python 3 this allows unescaped non-ASCII Unicode characters. - In Python 2 the return value will be valid UTF-8 rather than only ASCII. - Returns: - Escaped string (str). - """ - # Python's text.encode() 'string_escape' or 'unicode_escape' codecs do not - # satisfy our needs; they encodes unprintable characters using two-digit hex - # escapes whereas our C++ unescaping function allows hex escapes to be any - # length. So, "\0011".encode('string_escape') ends up being "\\x011", which - # will be decoded in C++ as a single-character string with char code 0x11. - text_is_unicode = isinstance(text, str) - if as_utf8 and text_is_unicode: - # We're already unicode, no processing beyond control char escapes. - return text.translate(_cescape_chr_to_symbol_map) - ord_ = ord if text_is_unicode else lambda x: x # bytes iterate as ints. - if as_utf8: - return ''.join(_cescape_unicode_to_str[ord_(c)] for c in text) - return ''.join(_cescape_byte_to_str[ord_(c)] for c in text) - - -_CUNESCAPE_HEX = re.compile(r'(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])') - - -def CUnescape(text): - # type: (str) -> bytes - """Unescape a text string with C-style escape sequences to UTF-8 bytes. - - Args: - text: The data to parse in a str. - Returns: - A byte string. - """ - - def ReplaceHex(m): - # Only replace the match if the number of leading back slashes is odd. i.e. - # the slash itself is not escaped. - if len(m.group(1)) & 1: - return m.group(1) + 'x0' + m.group(2) - return m.group(0) - - # This is required because the 'string_escape' encoding doesn't - # allow single-digit hex escapes (like '\xf'). - result = _CUNESCAPE_HEX.sub(ReplaceHex, text) - - return (result.encode('utf-8') # Make it bytes to allow decode. - .decode('unicode_escape') - # Make it bytes again to return the proper type. - .encode('raw_unicode_escape')) diff --git a/opensafely/_vendor/google/protobuf/text_format.py b/opensafely/_vendor/google/protobuf/text_format.py deleted file mode 100644 index fca8e224..00000000 --- a/opensafely/_vendor/google/protobuf/text_format.py +++ /dev/null @@ -1,1795 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Contains routines for printing protocol messages in text format. - -Simple usage example:: - - # Create a proto object and serialize it to a text proto string. - message = my_proto_pb2.MyMessage(foo='bar') - text_proto = text_format.MessageToString(message) - - # Parse a text proto string. - message = text_format.Parse(text_proto, my_proto_pb2.MyMessage()) -""" - -__author__ = 'kenton@google.com (Kenton Varda)' - -# TODO(b/129989314) Import thread contention leads to test failures. -import encodings.raw_unicode_escape # pylint: disable=unused-import -import encodings.unicode_escape # pylint: disable=unused-import -import io -import math -import re - -from opensafely._vendor.google.protobuf.internal import decoder -from opensafely._vendor.google.protobuf.internal import type_checkers -from opensafely._vendor.google.protobuf import descriptor -from opensafely._vendor.google.protobuf import text_encoding - -# pylint: disable=g-import-not-at-top -__all__ = ['MessageToString', 'Parse', 'PrintMessage', 'PrintField', - 'PrintFieldValue', 'Merge', 'MessageToBytes'] - -_INTEGER_CHECKERS = (type_checkers.Uint32ValueChecker(), - type_checkers.Int32ValueChecker(), - type_checkers.Uint64ValueChecker(), - type_checkers.Int64ValueChecker()) -_FLOAT_INFINITY = re.compile('-?inf(?:inity)?f?$', re.IGNORECASE) -_FLOAT_NAN = re.compile('nanf?$', re.IGNORECASE) -_QUOTES = frozenset(("'", '"')) -_ANY_FULL_TYPE_NAME = 'google.protobuf.Any' - - -class Error(Exception): - """Top-level module error for text_format.""" - - -class ParseError(Error): - """Thrown in case of text parsing or tokenizing error.""" - - def __init__(self, message=None, line=None, column=None): - if message is not None and line is not None: - loc = str(line) - if column is not None: - loc += ':{0}'.format(column) - message = '{0} : {1}'.format(loc, message) - if message is not None: - super(ParseError, self).__init__(message) - else: - super(ParseError, self).__init__() - self._line = line - self._column = column - - def GetLine(self): - return self._line - - def GetColumn(self): - return self._column - - -class TextWriter(object): - - def __init__(self, as_utf8): - self._writer = io.StringIO() - - def write(self, val): - return self._writer.write(val) - - def close(self): - return self._writer.close() - - def getvalue(self): - return self._writer.getvalue() - - -def MessageToString( - message, - as_utf8=False, - as_one_line=False, - use_short_repeated_primitives=False, - pointy_brackets=False, - use_index_order=False, - float_format=None, - double_format=None, - use_field_number=False, - descriptor_pool=None, - indent=0, - message_formatter=None, - print_unknown_fields=False, - force_colon=False): - # type: (...) -> str - """Convert protobuf message to text format. - - Double values can be formatted compactly with 15 digits of - precision (which is the most that IEEE 754 "double" can guarantee) - using double_format='.15g'. To ensure that converting to text and back to a - proto will result in an identical value, double_format='.17g' should be used. - - Args: - message: The protocol buffers message. - as_utf8: Return unescaped Unicode for non-ASCII characters. - In Python 3 actual Unicode characters may appear as is in strings. - In Python 2 the return value will be valid UTF-8 rather than only ASCII. - as_one_line: Don't introduce newlines between fields. - use_short_repeated_primitives: Use short repeated format for primitives. - pointy_brackets: If True, use angle brackets instead of curly braces for - nesting. - use_index_order: If True, fields of a proto message will be printed using - the order defined in source code instead of the field number, extensions - will be printed at the end of the message and their relative order is - determined by the extension number. By default, use the field number - order. - float_format (str): If set, use this to specify float field formatting - (per the "Format Specification Mini-Language"); otherwise, shortest float - that has same value in wire will be printed. Also affect double field - if double_format is not set but float_format is set. - double_format (str): If set, use this to specify double field formatting - (per the "Format Specification Mini-Language"); if it is not set but - float_format is set, use float_format. Otherwise, use ``str()`` - use_field_number: If True, print field numbers instead of names. - descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types. - indent (int): The initial indent level, in terms of spaces, for pretty - print. - message_formatter (function(message, indent, as_one_line) -> unicode|None): - Custom formatter for selected sub-messages (usually based on message - type). Use to pretty print parts of the protobuf for easier diffing. - print_unknown_fields: If True, unknown fields will be printed. - force_colon: If set, a colon will be added after the field name even if the - field is a proto message. - - Returns: - str: A string of the text formatted protocol buffer message. - """ - out = TextWriter(as_utf8) - printer = _Printer( - out, - indent, - as_utf8, - as_one_line, - use_short_repeated_primitives, - pointy_brackets, - use_index_order, - float_format, - double_format, - use_field_number, - descriptor_pool, - message_formatter, - print_unknown_fields=print_unknown_fields, - force_colon=force_colon) - printer.PrintMessage(message) - result = out.getvalue() - out.close() - if as_one_line: - return result.rstrip() - return result - - -def MessageToBytes(message, **kwargs): - # type: (...) -> bytes - """Convert protobuf message to encoded text format. See MessageToString.""" - text = MessageToString(message, **kwargs) - if isinstance(text, bytes): - return text - codec = 'utf-8' if kwargs.get('as_utf8') else 'ascii' - return text.encode(codec) - - -def _IsMapEntry(field): - return (field.type == descriptor.FieldDescriptor.TYPE_MESSAGE and - field.message_type.has_options and - field.message_type.GetOptions().map_entry) - - -def PrintMessage(message, - out, - indent=0, - as_utf8=False, - as_one_line=False, - use_short_repeated_primitives=False, - pointy_brackets=False, - use_index_order=False, - float_format=None, - double_format=None, - use_field_number=False, - descriptor_pool=None, - message_formatter=None, - print_unknown_fields=False, - force_colon=False): - printer = _Printer( - out=out, indent=indent, as_utf8=as_utf8, - as_one_line=as_one_line, - use_short_repeated_primitives=use_short_repeated_primitives, - pointy_brackets=pointy_brackets, - use_index_order=use_index_order, - float_format=float_format, - double_format=double_format, - use_field_number=use_field_number, - descriptor_pool=descriptor_pool, - message_formatter=message_formatter, - print_unknown_fields=print_unknown_fields, - force_colon=force_colon) - printer.PrintMessage(message) - - -def PrintField(field, - value, - out, - indent=0, - as_utf8=False, - as_one_line=False, - use_short_repeated_primitives=False, - pointy_brackets=False, - use_index_order=False, - float_format=None, - double_format=None, - message_formatter=None, - print_unknown_fields=False, - force_colon=False): - """Print a single field name/value pair.""" - printer = _Printer(out, indent, as_utf8, as_one_line, - use_short_repeated_primitives, pointy_brackets, - use_index_order, float_format, double_format, - message_formatter=message_formatter, - print_unknown_fields=print_unknown_fields, - force_colon=force_colon) - printer.PrintField(field, value) - - -def PrintFieldValue(field, - value, - out, - indent=0, - as_utf8=False, - as_one_line=False, - use_short_repeated_primitives=False, - pointy_brackets=False, - use_index_order=False, - float_format=None, - double_format=None, - message_formatter=None, - print_unknown_fields=False, - force_colon=False): - """Print a single field value (not including name).""" - printer = _Printer(out, indent, as_utf8, as_one_line, - use_short_repeated_primitives, pointy_brackets, - use_index_order, float_format, double_format, - message_formatter=message_formatter, - print_unknown_fields=print_unknown_fields, - force_colon=force_colon) - printer.PrintFieldValue(field, value) - - -def _BuildMessageFromTypeName(type_name, descriptor_pool): - """Returns a protobuf message instance. - - Args: - type_name: Fully-qualified protobuf message type name string. - descriptor_pool: DescriptorPool instance. - - Returns: - A Message instance of type matching type_name, or None if the a Descriptor - wasn't found matching type_name. - """ - # pylint: disable=g-import-not-at-top - if descriptor_pool is None: - from opensafely._vendor.google.protobuf import descriptor_pool as pool_mod - descriptor_pool = pool_mod.Default() - from opensafely._vendor.google.protobuf import symbol_database - database = symbol_database.Default() - try: - message_descriptor = descriptor_pool.FindMessageTypeByName(type_name) - except KeyError: - return None - message_type = database.GetPrototype(message_descriptor) - return message_type() - - -# These values must match WireType enum in google/protobuf/wire_format.h. -WIRETYPE_LENGTH_DELIMITED = 2 -WIRETYPE_START_GROUP = 3 - - -class _Printer(object): - """Text format printer for protocol message.""" - - def __init__( - self, - out, - indent=0, - as_utf8=False, - as_one_line=False, - use_short_repeated_primitives=False, - pointy_brackets=False, - use_index_order=False, - float_format=None, - double_format=None, - use_field_number=False, - descriptor_pool=None, - message_formatter=None, - print_unknown_fields=False, - force_colon=False): - """Initialize the Printer. - - Double values can be formatted compactly with 15 digits of precision - (which is the most that IEEE 754 "double" can guarantee) using - double_format='.15g'. To ensure that converting to text and back to a proto - will result in an identical value, double_format='.17g' should be used. - - Args: - out: To record the text format result. - indent: The initial indent level for pretty print. - as_utf8: Return unescaped Unicode for non-ASCII characters. - In Python 3 actual Unicode characters may appear as is in strings. - In Python 2 the return value will be valid UTF-8 rather than ASCII. - as_one_line: Don't introduce newlines between fields. - use_short_repeated_primitives: Use short repeated format for primitives. - pointy_brackets: If True, use angle brackets instead of curly braces for - nesting. - use_index_order: If True, print fields of a proto message using the order - defined in source code instead of the field number. By default, use the - field number order. - float_format: If set, use this to specify float field formatting - (per the "Format Specification Mini-Language"); otherwise, shortest - float that has same value in wire will be printed. Also affect double - field if double_format is not set but float_format is set. - double_format: If set, use this to specify double field formatting - (per the "Format Specification Mini-Language"); if it is not set but - float_format is set, use float_format. Otherwise, str() is used. - use_field_number: If True, print field numbers instead of names. - descriptor_pool: A DescriptorPool used to resolve Any types. - message_formatter: A function(message, indent, as_one_line): unicode|None - to custom format selected sub-messages (usually based on message type). - Use to pretty print parts of the protobuf for easier diffing. - print_unknown_fields: If True, unknown fields will be printed. - force_colon: If set, a colon will be added after the field name even if - the field is a proto message. - """ - self.out = out - self.indent = indent - self.as_utf8 = as_utf8 - self.as_one_line = as_one_line - self.use_short_repeated_primitives = use_short_repeated_primitives - self.pointy_brackets = pointy_brackets - self.use_index_order = use_index_order - self.float_format = float_format - if double_format is not None: - self.double_format = double_format - else: - self.double_format = float_format - self.use_field_number = use_field_number - self.descriptor_pool = descriptor_pool - self.message_formatter = message_formatter - self.print_unknown_fields = print_unknown_fields - self.force_colon = force_colon - - def _TryPrintAsAnyMessage(self, message): - """Serializes if message is a google.protobuf.Any field.""" - if '/' not in message.type_url: - return False - packed_message = _BuildMessageFromTypeName(message.TypeName(), - self.descriptor_pool) - if packed_message: - packed_message.MergeFromString(message.value) - colon = ':' if self.force_colon else '' - self.out.write('%s[%s]%s ' % (self.indent * ' ', message.type_url, colon)) - self._PrintMessageFieldValue(packed_message) - self.out.write(' ' if self.as_one_line else '\n') - return True - else: - return False - - def _TryCustomFormatMessage(self, message): - formatted = self.message_formatter(message, self.indent, self.as_one_line) - if formatted is None: - return False - - out = self.out - out.write(' ' * self.indent) - out.write(formatted) - out.write(' ' if self.as_one_line else '\n') - return True - - def PrintMessage(self, message): - """Convert protobuf message to text format. - - Args: - message: The protocol buffers message. - """ - if self.message_formatter and self._TryCustomFormatMessage(message): - return - if (message.DESCRIPTOR.full_name == _ANY_FULL_TYPE_NAME and - self._TryPrintAsAnyMessage(message)): - return - fields = message.ListFields() - if self.use_index_order: - fields.sort( - key=lambda x: x[0].number if x[0].is_extension else x[0].index) - for field, value in fields: - if _IsMapEntry(field): - for key in sorted(value): - # This is slow for maps with submessage entries because it copies the - # entire tree. Unfortunately this would take significant refactoring - # of this file to work around. - # - # TODO(haberman): refactor and optimize if this becomes an issue. - entry_submsg = value.GetEntryClass()(key=key, value=value[key]) - self.PrintField(field, entry_submsg) - elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED: - if (self.use_short_repeated_primitives - and field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_MESSAGE - and field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_STRING): - self._PrintShortRepeatedPrimitivesValue(field, value) - else: - for element in value: - self.PrintField(field, element) - else: - self.PrintField(field, value) - - if self.print_unknown_fields: - self._PrintUnknownFields(message.UnknownFields()) - - def _PrintUnknownFields(self, unknown_fields): - """Print unknown fields.""" - out = self.out - for field in unknown_fields: - out.write(' ' * self.indent) - out.write(str(field.field_number)) - if field.wire_type == WIRETYPE_START_GROUP: - if self.as_one_line: - out.write(' { ') - else: - out.write(' {\n') - self.indent += 2 - - self._PrintUnknownFields(field.data) - - if self.as_one_line: - out.write('} ') - else: - self.indent -= 2 - out.write(' ' * self.indent + '}\n') - elif field.wire_type == WIRETYPE_LENGTH_DELIMITED: - try: - # If this field is parseable as a Message, it is probably - # an embedded message. - # pylint: disable=protected-access - (embedded_unknown_message, pos) = decoder._DecodeUnknownFieldSet( - memoryview(field.data), 0, len(field.data)) - except Exception: # pylint: disable=broad-except - pos = 0 - - if pos == len(field.data): - if self.as_one_line: - out.write(' { ') - else: - out.write(' {\n') - self.indent += 2 - - self._PrintUnknownFields(embedded_unknown_message) - - if self.as_one_line: - out.write('} ') - else: - self.indent -= 2 - out.write(' ' * self.indent + '}\n') - else: - # A string or bytes field. self.as_utf8 may not work. - out.write(': \"') - out.write(text_encoding.CEscape(field.data, False)) - out.write('\" ' if self.as_one_line else '\"\n') - else: - # varint, fixed32, fixed64 - out.write(': ') - out.write(str(field.data)) - out.write(' ' if self.as_one_line else '\n') - - def _PrintFieldName(self, field): - """Print field name.""" - out = self.out - out.write(' ' * self.indent) - if self.use_field_number: - out.write(str(field.number)) - else: - if field.is_extension: - out.write('[') - if (field.containing_type.GetOptions().message_set_wire_format and - field.type == descriptor.FieldDescriptor.TYPE_MESSAGE and - field.label == descriptor.FieldDescriptor.LABEL_OPTIONAL): - out.write(field.message_type.full_name) - else: - out.write(field.full_name) - out.write(']') - elif field.type == descriptor.FieldDescriptor.TYPE_GROUP: - # For groups, use the capitalized name. - out.write(field.message_type.name) - else: - out.write(field.name) - - if (self.force_colon or - field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_MESSAGE): - # The colon is optional in this case, but our cross-language golden files - # don't include it. Here, the colon is only included if force_colon is - # set to True - out.write(':') - - def PrintField(self, field, value): - """Print a single field name/value pair.""" - self._PrintFieldName(field) - self.out.write(' ') - self.PrintFieldValue(field, value) - self.out.write(' ' if self.as_one_line else '\n') - - def _PrintShortRepeatedPrimitivesValue(self, field, value): - """"Prints short repeated primitives value.""" - # Note: this is called only when value has at least one element. - self._PrintFieldName(field) - self.out.write(' [') - for i in range(len(value) - 1): - self.PrintFieldValue(field, value[i]) - self.out.write(', ') - self.PrintFieldValue(field, value[-1]) - self.out.write(']') - self.out.write(' ' if self.as_one_line else '\n') - - def _PrintMessageFieldValue(self, value): - if self.pointy_brackets: - openb = '<' - closeb = '>' - else: - openb = '{' - closeb = '}' - - if self.as_one_line: - self.out.write('%s ' % openb) - self.PrintMessage(value) - self.out.write(closeb) - else: - self.out.write('%s\n' % openb) - self.indent += 2 - self.PrintMessage(value) - self.indent -= 2 - self.out.write(' ' * self.indent + closeb) - - def PrintFieldValue(self, field, value): - """Print a single field value (not including name). - - For repeated fields, the value should be a single element. - - Args: - field: The descriptor of the field to be printed. - value: The value of the field. - """ - out = self.out - if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: - self._PrintMessageFieldValue(value) - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM: - enum_value = field.enum_type.values_by_number.get(value, None) - if enum_value is not None: - out.write(enum_value.name) - else: - out.write(str(value)) - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING: - out.write('\"') - if isinstance(value, str) and not self.as_utf8: - out_value = value.encode('utf-8') - else: - out_value = value - if field.type == descriptor.FieldDescriptor.TYPE_BYTES: - # We always need to escape all binary data in TYPE_BYTES fields. - out_as_utf8 = False - else: - out_as_utf8 = self.as_utf8 - out.write(text_encoding.CEscape(out_value, out_as_utf8)) - out.write('\"') - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_BOOL: - if value: - out.write('true') - else: - out.write('false') - elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_FLOAT: - if self.float_format is not None: - out.write('{1:{0}}'.format(self.float_format, value)) - else: - if math.isnan(value): - out.write(str(value)) - else: - out.write(str(type_checkers.ToShortestFloat(value))) - elif (field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_DOUBLE and - self.double_format is not None): - out.write('{1:{0}}'.format(self.double_format, value)) - else: - out.write(str(value)) - - -def Parse(text, - message, - allow_unknown_extension=False, - allow_field_number=False, - descriptor_pool=None, - allow_unknown_field=False): - """Parses a text representation of a protocol message into a message. - - NOTE: for historical reasons this function does not clear the input - message. This is different from what the binary msg.ParseFrom(...) does. - If text contains a field already set in message, the value is appended if the - field is repeated. Otherwise, an error is raised. - - Example:: - - a = MyProto() - a.repeated_field.append('test') - b = MyProto() - - # Repeated fields are combined - text_format.Parse(repr(a), b) - text_format.Parse(repr(a), b) # repeated_field contains ["test", "test"] - - # Non-repeated fields cannot be overwritten - a.singular_field = 1 - b.singular_field = 2 - text_format.Parse(repr(a), b) # ParseError - - # Binary version: - b.ParseFromString(a.SerializeToString()) # repeated_field is now "test" - - Caller is responsible for clearing the message as needed. - - Args: - text (str): Message text representation. - message (Message): A protocol buffer message to merge into. - allow_unknown_extension: if True, skip over missing extensions and keep - parsing - allow_field_number: if True, both field number and field name are allowed. - descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types. - allow_unknown_field: if True, skip over unknown field and keep - parsing. Avoid to use this option if possible. It may hide some - errors (e.g. spelling error on field name) - - Returns: - Message: The same message passed as argument. - - Raises: - ParseError: On text parsing problems. - """ - return ParseLines(text.split(b'\n' if isinstance(text, bytes) else u'\n'), - message, - allow_unknown_extension, - allow_field_number, - descriptor_pool=descriptor_pool, - allow_unknown_field=allow_unknown_field) - - -def Merge(text, - message, - allow_unknown_extension=False, - allow_field_number=False, - descriptor_pool=None, - allow_unknown_field=False): - """Parses a text representation of a protocol message into a message. - - Like Parse(), but allows repeated values for a non-repeated field, and uses - the last one. This means any non-repeated, top-level fields specified in text - replace those in the message. - - Args: - text (str): Message text representation. - message (Message): A protocol buffer message to merge into. - allow_unknown_extension: if True, skip over missing extensions and keep - parsing - allow_field_number: if True, both field number and field name are allowed. - descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types. - allow_unknown_field: if True, skip over unknown field and keep - parsing. Avoid to use this option if possible. It may hide some - errors (e.g. spelling error on field name) - - Returns: - Message: The same message passed as argument. - - Raises: - ParseError: On text parsing problems. - """ - return MergeLines( - text.split(b'\n' if isinstance(text, bytes) else u'\n'), - message, - allow_unknown_extension, - allow_field_number, - descriptor_pool=descriptor_pool, - allow_unknown_field=allow_unknown_field) - - -def ParseLines(lines, - message, - allow_unknown_extension=False, - allow_field_number=False, - descriptor_pool=None, - allow_unknown_field=False): - """Parses a text representation of a protocol message into a message. - - See Parse() for caveats. - - Args: - lines: An iterable of lines of a message's text representation. - message: A protocol buffer message to merge into. - allow_unknown_extension: if True, skip over missing extensions and keep - parsing - allow_field_number: if True, both field number and field name are allowed. - descriptor_pool: A DescriptorPool used to resolve Any types. - allow_unknown_field: if True, skip over unknown field and keep - parsing. Avoid to use this option if possible. It may hide some - errors (e.g. spelling error on field name) - - Returns: - The same message passed as argument. - - Raises: - ParseError: On text parsing problems. - """ - parser = _Parser(allow_unknown_extension, - allow_field_number, - descriptor_pool=descriptor_pool, - allow_unknown_field=allow_unknown_field) - return parser.ParseLines(lines, message) - - -def MergeLines(lines, - message, - allow_unknown_extension=False, - allow_field_number=False, - descriptor_pool=None, - allow_unknown_field=False): - """Parses a text representation of a protocol message into a message. - - See Merge() for more details. - - Args: - lines: An iterable of lines of a message's text representation. - message: A protocol buffer message to merge into. - allow_unknown_extension: if True, skip over missing extensions and keep - parsing - allow_field_number: if True, both field number and field name are allowed. - descriptor_pool: A DescriptorPool used to resolve Any types. - allow_unknown_field: if True, skip over unknown field and keep - parsing. Avoid to use this option if possible. It may hide some - errors (e.g. spelling error on field name) - - Returns: - The same message passed as argument. - - Raises: - ParseError: On text parsing problems. - """ - parser = _Parser(allow_unknown_extension, - allow_field_number, - descriptor_pool=descriptor_pool, - allow_unknown_field=allow_unknown_field) - return parser.MergeLines(lines, message) - - -class _Parser(object): - """Text format parser for protocol message.""" - - def __init__(self, - allow_unknown_extension=False, - allow_field_number=False, - descriptor_pool=None, - allow_unknown_field=False): - self.allow_unknown_extension = allow_unknown_extension - self.allow_field_number = allow_field_number - self.descriptor_pool = descriptor_pool - self.allow_unknown_field = allow_unknown_field - - def ParseLines(self, lines, message): - """Parses a text representation of a protocol message into a message.""" - self._allow_multiple_scalars = False - self._ParseOrMerge(lines, message) - return message - - def MergeLines(self, lines, message): - """Merges a text representation of a protocol message into a message.""" - self._allow_multiple_scalars = True - self._ParseOrMerge(lines, message) - return message - - def _ParseOrMerge(self, lines, message): - """Converts a text representation of a protocol message into a message. - - Args: - lines: Lines of a message's text representation. - message: A protocol buffer message to merge into. - - Raises: - ParseError: On text parsing problems. - """ - # Tokenize expects native str lines. - str_lines = ( - line if isinstance(line, str) else line.decode('utf-8') - for line in lines) - tokenizer = Tokenizer(str_lines) - while not tokenizer.AtEnd(): - self._MergeField(tokenizer, message) - - def _MergeField(self, tokenizer, message): - """Merges a single protocol message field into a message. - - Args: - tokenizer: A tokenizer to parse the field name and values. - message: A protocol message to record the data. - - Raises: - ParseError: In case of text parsing problems. - """ - message_descriptor = message.DESCRIPTOR - if (message_descriptor.full_name == _ANY_FULL_TYPE_NAME and - tokenizer.TryConsume('[')): - type_url_prefix, packed_type_name = self._ConsumeAnyTypeUrl(tokenizer) - tokenizer.Consume(']') - tokenizer.TryConsume(':') - if tokenizer.TryConsume('<'): - expanded_any_end_token = '>' - else: - tokenizer.Consume('{') - expanded_any_end_token = '}' - expanded_any_sub_message = _BuildMessageFromTypeName(packed_type_name, - self.descriptor_pool) - if not expanded_any_sub_message: - raise ParseError('Type %s not found in descriptor pool' % - packed_type_name) - while not tokenizer.TryConsume(expanded_any_end_token): - if tokenizer.AtEnd(): - raise tokenizer.ParseErrorPreviousToken('Expected "%s".' % - (expanded_any_end_token,)) - self._MergeField(tokenizer, expanded_any_sub_message) - deterministic = False - - message.Pack(expanded_any_sub_message, - type_url_prefix=type_url_prefix, - deterministic=deterministic) - return - - if tokenizer.TryConsume('['): - name = [tokenizer.ConsumeIdentifier()] - while tokenizer.TryConsume('.'): - name.append(tokenizer.ConsumeIdentifier()) - name = '.'.join(name) - - if not message_descriptor.is_extendable: - raise tokenizer.ParseErrorPreviousToken( - 'Message type "%s" does not have extensions.' % - message_descriptor.full_name) - # pylint: disable=protected-access - field = message.Extensions._FindExtensionByName(name) - # pylint: enable=protected-access - - - if not field: - if self.allow_unknown_extension: - field = None - else: - raise tokenizer.ParseErrorPreviousToken( - 'Extension "%s" not registered. ' - 'Did you import the _pb2 module which defines it? ' - 'If you are trying to place the extension in the MessageSet ' - 'field of another message that is in an Any or MessageSet field, ' - 'that message\'s _pb2 module must be imported as well' % name) - elif message_descriptor != field.containing_type: - raise tokenizer.ParseErrorPreviousToken( - 'Extension "%s" does not extend message type "%s".' % - (name, message_descriptor.full_name)) - - tokenizer.Consume(']') - - else: - name = tokenizer.ConsumeIdentifierOrNumber() - if self.allow_field_number and name.isdigit(): - number = ParseInteger(name, True, True) - field = message_descriptor.fields_by_number.get(number, None) - if not field and message_descriptor.is_extendable: - field = message.Extensions._FindExtensionByNumber(number) - else: - field = message_descriptor.fields_by_name.get(name, None) - - # Group names are expected to be capitalized as they appear in the - # .proto file, which actually matches their type names, not their field - # names. - if not field: - field = message_descriptor.fields_by_name.get(name.lower(), None) - if field and field.type != descriptor.FieldDescriptor.TYPE_GROUP: - field = None - - if (field and field.type == descriptor.FieldDescriptor.TYPE_GROUP and - field.message_type.name != name): - field = None - - if not field and not self.allow_unknown_field: - raise tokenizer.ParseErrorPreviousToken( - 'Message type "%s" has no field named "%s".' % - (message_descriptor.full_name, name)) - - if field: - if not self._allow_multiple_scalars and field.containing_oneof: - # Check if there's a different field set in this oneof. - # Note that we ignore the case if the same field was set before, and we - # apply _allow_multiple_scalars to non-scalar fields as well. - which_oneof = message.WhichOneof(field.containing_oneof.name) - if which_oneof is not None and which_oneof != field.name: - raise tokenizer.ParseErrorPreviousToken( - 'Field "%s" is specified along with field "%s", another member ' - 'of oneof "%s" for message type "%s".' % - (field.name, which_oneof, field.containing_oneof.name, - message_descriptor.full_name)) - - if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: - tokenizer.TryConsume(':') - merger = self._MergeMessageField - else: - tokenizer.Consume(':') - merger = self._MergeScalarField - - if (field.label == descriptor.FieldDescriptor.LABEL_REPEATED and - tokenizer.TryConsume('[')): - # Short repeated format, e.g. "foo: [1, 2, 3]" - if not tokenizer.TryConsume(']'): - while True: - merger(tokenizer, message, field) - if tokenizer.TryConsume(']'): - break - tokenizer.Consume(',') - - else: - merger(tokenizer, message, field) - - else: # Proto field is unknown. - assert (self.allow_unknown_extension or self.allow_unknown_field) - _SkipFieldContents(tokenizer) - - # For historical reasons, fields may optionally be separated by commas or - # semicolons. - if not tokenizer.TryConsume(','): - tokenizer.TryConsume(';') - - - def _ConsumeAnyTypeUrl(self, tokenizer): - """Consumes a google.protobuf.Any type URL and returns the type name.""" - # Consume "type.googleapis.com/". - prefix = [tokenizer.ConsumeIdentifier()] - tokenizer.Consume('.') - prefix.append(tokenizer.ConsumeIdentifier()) - tokenizer.Consume('.') - prefix.append(tokenizer.ConsumeIdentifier()) - tokenizer.Consume('/') - # Consume the fully-qualified type name. - name = [tokenizer.ConsumeIdentifier()] - while tokenizer.TryConsume('.'): - name.append(tokenizer.ConsumeIdentifier()) - return '.'.join(prefix), '.'.join(name) - - def _MergeMessageField(self, tokenizer, message, field): - """Merges a single scalar field into a message. - - Args: - tokenizer: A tokenizer to parse the field value. - message: The message of which field is a member. - field: The descriptor of the field to be merged. - - Raises: - ParseError: In case of text parsing problems. - """ - is_map_entry = _IsMapEntry(field) - - if tokenizer.TryConsume('<'): - end_token = '>' - else: - tokenizer.Consume('{') - end_token = '}' - - if field.label == descriptor.FieldDescriptor.LABEL_REPEATED: - if field.is_extension: - sub_message = message.Extensions[field].add() - elif is_map_entry: - sub_message = getattr(message, field.name).GetEntryClass()() - else: - sub_message = getattr(message, field.name).add() - else: - if field.is_extension: - if (not self._allow_multiple_scalars and - message.HasExtension(field)): - raise tokenizer.ParseErrorPreviousToken( - 'Message type "%s" should not have multiple "%s" extensions.' % - (message.DESCRIPTOR.full_name, field.full_name)) - sub_message = message.Extensions[field] - else: - # Also apply _allow_multiple_scalars to message field. - # TODO(jieluo): Change to _allow_singular_overwrites. - if (not self._allow_multiple_scalars and - message.HasField(field.name)): - raise tokenizer.ParseErrorPreviousToken( - 'Message type "%s" should not have multiple "%s" fields.' % - (message.DESCRIPTOR.full_name, field.name)) - sub_message = getattr(message, field.name) - sub_message.SetInParent() - - while not tokenizer.TryConsume(end_token): - if tokenizer.AtEnd(): - raise tokenizer.ParseErrorPreviousToken('Expected "%s".' % (end_token,)) - self._MergeField(tokenizer, sub_message) - - if is_map_entry: - value_cpptype = field.message_type.fields_by_name['value'].cpp_type - if value_cpptype == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: - value = getattr(message, field.name)[sub_message.key] - value.CopyFrom(sub_message.value) - else: - getattr(message, field.name)[sub_message.key] = sub_message.value - - @staticmethod - def _IsProto3Syntax(message): - message_descriptor = message.DESCRIPTOR - return (hasattr(message_descriptor, 'syntax') and - message_descriptor.syntax == 'proto3') - - def _MergeScalarField(self, tokenizer, message, field): - """Merges a single scalar field into a message. - - Args: - tokenizer: A tokenizer to parse the field value. - message: A protocol message to record the data. - field: The descriptor of the field to be merged. - - Raises: - ParseError: In case of text parsing problems. - RuntimeError: On runtime errors. - """ - _ = self.allow_unknown_extension - value = None - - if field.type in (descriptor.FieldDescriptor.TYPE_INT32, - descriptor.FieldDescriptor.TYPE_SINT32, - descriptor.FieldDescriptor.TYPE_SFIXED32): - value = _ConsumeInt32(tokenizer) - elif field.type in (descriptor.FieldDescriptor.TYPE_INT64, - descriptor.FieldDescriptor.TYPE_SINT64, - descriptor.FieldDescriptor.TYPE_SFIXED64): - value = _ConsumeInt64(tokenizer) - elif field.type in (descriptor.FieldDescriptor.TYPE_UINT32, - descriptor.FieldDescriptor.TYPE_FIXED32): - value = _ConsumeUint32(tokenizer) - elif field.type in (descriptor.FieldDescriptor.TYPE_UINT64, - descriptor.FieldDescriptor.TYPE_FIXED64): - value = _ConsumeUint64(tokenizer) - elif field.type in (descriptor.FieldDescriptor.TYPE_FLOAT, - descriptor.FieldDescriptor.TYPE_DOUBLE): - value = tokenizer.ConsumeFloat() - elif field.type == descriptor.FieldDescriptor.TYPE_BOOL: - value = tokenizer.ConsumeBool() - elif field.type == descriptor.FieldDescriptor.TYPE_STRING: - value = tokenizer.ConsumeString() - elif field.type == descriptor.FieldDescriptor.TYPE_BYTES: - value = tokenizer.ConsumeByteString() - elif field.type == descriptor.FieldDescriptor.TYPE_ENUM: - value = tokenizer.ConsumeEnum(field) - else: - raise RuntimeError('Unknown field type %d' % field.type) - - if field.label == descriptor.FieldDescriptor.LABEL_REPEATED: - if field.is_extension: - message.Extensions[field].append(value) - else: - getattr(message, field.name).append(value) - else: - if field.is_extension: - if (not self._allow_multiple_scalars and - not self._IsProto3Syntax(message) and - message.HasExtension(field)): - raise tokenizer.ParseErrorPreviousToken( - 'Message type "%s" should not have multiple "%s" extensions.' % - (message.DESCRIPTOR.full_name, field.full_name)) - else: - message.Extensions[field] = value - else: - duplicate_error = False - if not self._allow_multiple_scalars: - if self._IsProto3Syntax(message): - # Proto3 doesn't represent presence so we try best effort to check - # multiple scalars by compare to default values. - duplicate_error = bool(getattr(message, field.name)) - else: - duplicate_error = message.HasField(field.name) - - if duplicate_error: - raise tokenizer.ParseErrorPreviousToken( - 'Message type "%s" should not have multiple "%s" fields.' % - (message.DESCRIPTOR.full_name, field.name)) - else: - setattr(message, field.name, value) - - -def _SkipFieldContents(tokenizer): - """Skips over contents (value or message) of a field. - - Args: - tokenizer: A tokenizer to parse the field name and values. - """ - # Try to guess the type of this field. - # If this field is not a message, there should be a ":" between the - # field name and the field value and also the field value should not - # start with "{" or "<" which indicates the beginning of a message body. - # If there is no ":" or there is a "{" or "<" after ":", this field has - # to be a message or the input is ill-formed. - if tokenizer.TryConsume(':') and not tokenizer.LookingAt( - '{') and not tokenizer.LookingAt('<'): - _SkipFieldValue(tokenizer) - else: - _SkipFieldMessage(tokenizer) - - -def _SkipField(tokenizer): - """Skips over a complete field (name and value/message). - - Args: - tokenizer: A tokenizer to parse the field name and values. - """ - if tokenizer.TryConsume('['): - # Consume extension name. - tokenizer.ConsumeIdentifier() - while tokenizer.TryConsume('.'): - tokenizer.ConsumeIdentifier() - tokenizer.Consume(']') - else: - tokenizer.ConsumeIdentifierOrNumber() - - _SkipFieldContents(tokenizer) - - # For historical reasons, fields may optionally be separated by commas or - # semicolons. - if not tokenizer.TryConsume(','): - tokenizer.TryConsume(';') - - -def _SkipFieldMessage(tokenizer): - """Skips over a field message. - - Args: - tokenizer: A tokenizer to parse the field name and values. - """ - - if tokenizer.TryConsume('<'): - delimiter = '>' - else: - tokenizer.Consume('{') - delimiter = '}' - - while not tokenizer.LookingAt('>') and not tokenizer.LookingAt('}'): - _SkipField(tokenizer) - - tokenizer.Consume(delimiter) - - -def _SkipFieldValue(tokenizer): - """Skips over a field value. - - Args: - tokenizer: A tokenizer to parse the field name and values. - - Raises: - ParseError: In case an invalid field value is found. - """ - # String/bytes tokens can come in multiple adjacent string literals. - # If we can consume one, consume as many as we can. - if tokenizer.TryConsumeByteString(): - while tokenizer.TryConsumeByteString(): - pass - return - - if (not tokenizer.TryConsumeIdentifier() and - not _TryConsumeInt64(tokenizer) and not _TryConsumeUint64(tokenizer) and - not tokenizer.TryConsumeFloat()): - raise ParseError('Invalid field value: ' + tokenizer.token) - - -class Tokenizer(object): - """Protocol buffer text representation tokenizer. - - This class handles the lower level string parsing by splitting it into - meaningful tokens. - - It was directly ported from the Java protocol buffer API. - """ - - _WHITESPACE = re.compile(r'\s+') - _COMMENT = re.compile(r'(\s*#.*$)', re.MULTILINE) - _WHITESPACE_OR_COMMENT = re.compile(r'(\s|(#.*$))+', re.MULTILINE) - _TOKEN = re.compile('|'.join([ - r'[a-zA-Z_][0-9a-zA-Z_+-]*', # an identifier - r'([0-9+-]|(\.[0-9]))[0-9a-zA-Z_.+-]*', # a number - ] + [ # quoted str for each quote mark - # Avoid backtracking! https://stackoverflow.com/a/844267 - r'{qt}[^{qt}\n\\]*((\\.)+[^{qt}\n\\]*)*({qt}|\\?$)'.format(qt=mark) - for mark in _QUOTES - ])) - - _IDENTIFIER = re.compile(r'[^\d\W]\w*') - _IDENTIFIER_OR_NUMBER = re.compile(r'\w+') - - def __init__(self, lines, skip_comments=True): - self._position = 0 - self._line = -1 - self._column = 0 - self._token_start = None - self.token = '' - self._lines = iter(lines) - self._current_line = '' - self._previous_line = 0 - self._previous_column = 0 - self._more_lines = True - self._skip_comments = skip_comments - self._whitespace_pattern = (skip_comments and self._WHITESPACE_OR_COMMENT - or self._WHITESPACE) - self._SkipWhitespace() - self.NextToken() - - def LookingAt(self, token): - return self.token == token - - def AtEnd(self): - """Checks the end of the text was reached. - - Returns: - True iff the end was reached. - """ - return not self.token - - def _PopLine(self): - while len(self._current_line) <= self._column: - try: - self._current_line = next(self._lines) - except StopIteration: - self._current_line = '' - self._more_lines = False - return - else: - self._line += 1 - self._column = 0 - - def _SkipWhitespace(self): - while True: - self._PopLine() - match = self._whitespace_pattern.match(self._current_line, self._column) - if not match: - break - length = len(match.group(0)) - self._column += length - - def TryConsume(self, token): - """Tries to consume a given piece of text. - - Args: - token: Text to consume. - - Returns: - True iff the text was consumed. - """ - if self.token == token: - self.NextToken() - return True - return False - - def Consume(self, token): - """Consumes a piece of text. - - Args: - token: Text to consume. - - Raises: - ParseError: If the text couldn't be consumed. - """ - if not self.TryConsume(token): - raise self.ParseError('Expected "%s".' % token) - - def ConsumeComment(self): - result = self.token - if not self._COMMENT.match(result): - raise self.ParseError('Expected comment.') - self.NextToken() - return result - - def ConsumeCommentOrTrailingComment(self): - """Consumes a comment, returns a 2-tuple (trailing bool, comment str).""" - - # Tokenizer initializes _previous_line and _previous_column to 0. As the - # tokenizer starts, it looks like there is a previous token on the line. - just_started = self._line == 0 and self._column == 0 - - before_parsing = self._previous_line - comment = self.ConsumeComment() - - # A trailing comment is a comment on the same line than the previous token. - trailing = (self._previous_line == before_parsing - and not just_started) - - return trailing, comment - - def TryConsumeIdentifier(self): - try: - self.ConsumeIdentifier() - return True - except ParseError: - return False - - def ConsumeIdentifier(self): - """Consumes protocol message field identifier. - - Returns: - Identifier string. - - Raises: - ParseError: If an identifier couldn't be consumed. - """ - result = self.token - if not self._IDENTIFIER.match(result): - raise self.ParseError('Expected identifier.') - self.NextToken() - return result - - def TryConsumeIdentifierOrNumber(self): - try: - self.ConsumeIdentifierOrNumber() - return True - except ParseError: - return False - - def ConsumeIdentifierOrNumber(self): - """Consumes protocol message field identifier. - - Returns: - Identifier string. - - Raises: - ParseError: If an identifier couldn't be consumed. - """ - result = self.token - if not self._IDENTIFIER_OR_NUMBER.match(result): - raise self.ParseError('Expected identifier or number, got %s.' % result) - self.NextToken() - return result - - def TryConsumeInteger(self): - try: - self.ConsumeInteger() - return True - except ParseError: - return False - - def ConsumeInteger(self): - """Consumes an integer number. - - Returns: - The integer parsed. - - Raises: - ParseError: If an integer couldn't be consumed. - """ - try: - result = _ParseAbstractInteger(self.token) - except ValueError as e: - raise self.ParseError(str(e)) - self.NextToken() - return result - - def TryConsumeFloat(self): - try: - self.ConsumeFloat() - return True - except ParseError: - return False - - def ConsumeFloat(self): - """Consumes an floating point number. - - Returns: - The number parsed. - - Raises: - ParseError: If a floating point number couldn't be consumed. - """ - try: - result = ParseFloat(self.token) - except ValueError as e: - raise self.ParseError(str(e)) - self.NextToken() - return result - - def ConsumeBool(self): - """Consumes a boolean value. - - Returns: - The bool parsed. - - Raises: - ParseError: If a boolean value couldn't be consumed. - """ - try: - result = ParseBool(self.token) - except ValueError as e: - raise self.ParseError(str(e)) - self.NextToken() - return result - - def TryConsumeByteString(self): - try: - self.ConsumeByteString() - return True - except ParseError: - return False - - def ConsumeString(self): - """Consumes a string value. - - Returns: - The string parsed. - - Raises: - ParseError: If a string value couldn't be consumed. - """ - the_bytes = self.ConsumeByteString() - try: - return str(the_bytes, 'utf-8') - except UnicodeDecodeError as e: - raise self._StringParseError(e) - - def ConsumeByteString(self): - """Consumes a byte array value. - - Returns: - The array parsed (as a string). - - Raises: - ParseError: If a byte array value couldn't be consumed. - """ - the_list = [self._ConsumeSingleByteString()] - while self.token and self.token[0] in _QUOTES: - the_list.append(self._ConsumeSingleByteString()) - return b''.join(the_list) - - def _ConsumeSingleByteString(self): - """Consume one token of a string literal. - - String literals (whether bytes or text) can come in multiple adjacent - tokens which are automatically concatenated, like in C or Python. This - method only consumes one token. - - Returns: - The token parsed. - Raises: - ParseError: When the wrong format data is found. - """ - text = self.token - if len(text) < 1 or text[0] not in _QUOTES: - raise self.ParseError('Expected string but found: %r' % (text,)) - - if len(text) < 2 or text[-1] != text[0]: - raise self.ParseError('String missing ending quote: %r' % (text,)) - - try: - result = text_encoding.CUnescape(text[1:-1]) - except ValueError as e: - raise self.ParseError(str(e)) - self.NextToken() - return result - - def ConsumeEnum(self, field): - try: - result = ParseEnum(field, self.token) - except ValueError as e: - raise self.ParseError(str(e)) - self.NextToken() - return result - - def ParseErrorPreviousToken(self, message): - """Creates and *returns* a ParseError for the previously read token. - - Args: - message: A message to set for the exception. - - Returns: - A ParseError instance. - """ - return ParseError(message, self._previous_line + 1, - self._previous_column + 1) - - def ParseError(self, message): - """Creates and *returns* a ParseError for the current token.""" - return ParseError('\'' + self._current_line + '\': ' + message, - self._line + 1, self._column + 1) - - def _StringParseError(self, e): - return self.ParseError('Couldn\'t parse string: ' + str(e)) - - def NextToken(self): - """Reads the next meaningful token.""" - self._previous_line = self._line - self._previous_column = self._column - - self._column += len(self.token) - self._SkipWhitespace() - - if not self._more_lines: - self.token = '' - return - - match = self._TOKEN.match(self._current_line, self._column) - if not match and not self._skip_comments: - match = self._COMMENT.match(self._current_line, self._column) - if match: - token = match.group(0) - self.token = token - else: - self.token = self._current_line[self._column] - -# Aliased so it can still be accessed by current visibility violators. -# TODO(dbarnett): Migrate violators to textformat_tokenizer. -_Tokenizer = Tokenizer # pylint: disable=invalid-name - - -def _ConsumeInt32(tokenizer): - """Consumes a signed 32bit integer number from tokenizer. - - Args: - tokenizer: A tokenizer used to parse the number. - - Returns: - The integer parsed. - - Raises: - ParseError: If a signed 32bit integer couldn't be consumed. - """ - return _ConsumeInteger(tokenizer, is_signed=True, is_long=False) - - -def _ConsumeUint32(tokenizer): - """Consumes an unsigned 32bit integer number from tokenizer. - - Args: - tokenizer: A tokenizer used to parse the number. - - Returns: - The integer parsed. - - Raises: - ParseError: If an unsigned 32bit integer couldn't be consumed. - """ - return _ConsumeInteger(tokenizer, is_signed=False, is_long=False) - - -def _TryConsumeInt64(tokenizer): - try: - _ConsumeInt64(tokenizer) - return True - except ParseError: - return False - - -def _ConsumeInt64(tokenizer): - """Consumes a signed 32bit integer number from tokenizer. - - Args: - tokenizer: A tokenizer used to parse the number. - - Returns: - The integer parsed. - - Raises: - ParseError: If a signed 32bit integer couldn't be consumed. - """ - return _ConsumeInteger(tokenizer, is_signed=True, is_long=True) - - -def _TryConsumeUint64(tokenizer): - try: - _ConsumeUint64(tokenizer) - return True - except ParseError: - return False - - -def _ConsumeUint64(tokenizer): - """Consumes an unsigned 64bit integer number from tokenizer. - - Args: - tokenizer: A tokenizer used to parse the number. - - Returns: - The integer parsed. - - Raises: - ParseError: If an unsigned 64bit integer couldn't be consumed. - """ - return _ConsumeInteger(tokenizer, is_signed=False, is_long=True) - - -def _ConsumeInteger(tokenizer, is_signed=False, is_long=False): - """Consumes an integer number from tokenizer. - - Args: - tokenizer: A tokenizer used to parse the number. - is_signed: True if a signed integer must be parsed. - is_long: True if a long integer must be parsed. - - Returns: - The integer parsed. - - Raises: - ParseError: If an integer with given characteristics couldn't be consumed. - """ - try: - result = ParseInteger(tokenizer.token, is_signed=is_signed, is_long=is_long) - except ValueError as e: - raise tokenizer.ParseError(str(e)) - tokenizer.NextToken() - return result - - -def ParseInteger(text, is_signed=False, is_long=False): - """Parses an integer. - - Args: - text: The text to parse. - is_signed: True if a signed integer must be parsed. - is_long: True if a long integer must be parsed. - - Returns: - The integer value. - - Raises: - ValueError: Thrown Iff the text is not a valid integer. - """ - # Do the actual parsing. Exception handling is propagated to caller. - result = _ParseAbstractInteger(text) - - # Check if the integer is sane. Exceptions handled by callers. - checker = _INTEGER_CHECKERS[2 * int(is_long) + int(is_signed)] - checker.CheckValue(result) - return result - - -def _ParseAbstractInteger(text): - """Parses an integer without checking size/signedness. - - Args: - text: The text to parse. - - Returns: - The integer value. - - Raises: - ValueError: Thrown Iff the text is not a valid integer. - """ - # Do the actual parsing. Exception handling is propagated to caller. - orig_text = text - c_octal_match = re.match(r'(-?)0(\d+)$', text) - if c_octal_match: - # Python 3 no longer supports 0755 octal syntax without the 'o', so - # we always use the '0o' prefix for multi-digit numbers starting with 0. - text = c_octal_match.group(1) + '0o' + c_octal_match.group(2) - try: - return int(text, 0) - except ValueError: - raise ValueError('Couldn\'t parse integer: %s' % orig_text) - - -def ParseFloat(text): - """Parse a floating point number. - - Args: - text: Text to parse. - - Returns: - The number parsed. - - Raises: - ValueError: If a floating point number couldn't be parsed. - """ - try: - # Assume Python compatible syntax. - return float(text) - except ValueError: - # Check alternative spellings. - if _FLOAT_INFINITY.match(text): - if text[0] == '-': - return float('-inf') - else: - return float('inf') - elif _FLOAT_NAN.match(text): - return float('nan') - else: - # assume '1.0f' format - try: - return float(text.rstrip('f')) - except ValueError: - raise ValueError('Couldn\'t parse float: %s' % text) - - -def ParseBool(text): - """Parse a boolean value. - - Args: - text: Text to parse. - - Returns: - Boolean values parsed - - Raises: - ValueError: If text is not a valid boolean. - """ - if text in ('true', 't', '1', 'True'): - return True - elif text in ('false', 'f', '0', 'False'): - return False - else: - raise ValueError('Expected "true" or "false".') - - -def ParseEnum(field, value): - """Parse an enum value. - - The value can be specified by a number (the enum value), or by - a string literal (the enum name). - - Args: - field: Enum field descriptor. - value: String value. - - Returns: - Enum value number. - - Raises: - ValueError: If the enum value could not be parsed. - """ - enum_descriptor = field.enum_type - try: - number = int(value, 0) - except ValueError: - # Identifier. - enum_value = enum_descriptor.values_by_name.get(value, None) - if enum_value is None: - raise ValueError('Enum type "%s" has no value named %s.' % - (enum_descriptor.full_name, value)) - else: - # Numeric value. - if hasattr(field.file, 'syntax'): - # Attribute is checked for compatibility. - if field.file.syntax == 'proto3': - # Proto3 accept numeric unknown enums. - return number - enum_value = enum_descriptor.values_by_number.get(number, None) - if enum_value is None: - raise ValueError('Enum type "%s" has no value with number %d.' % - (enum_descriptor.full_name, number)) - return enum_value.number diff --git a/opensafely/_vendor/google/protobuf/timestamp_pb2.py b/opensafely/_vendor/google/protobuf/timestamp_pb2.py deleted file mode 100644 index d8c3178e..00000000 --- a/opensafely/_vendor/google/protobuf/timestamp_pb2.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/timestamp.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fgoogle/protobuf/timestamp.proto\x12\x0fgoogle.protobuf\"+\n\tTimestamp\x12\x0f\n\x07seconds\x18\x01 \x01(\x03\x12\r\n\x05nanos\x18\x02 \x01(\x05\x42\x85\x01\n\x13\x63om.google.protobufB\x0eTimestampProtoP\x01Z2google.golang.org/protobuf/types/known/timestamppb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.timestamp_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\016TimestampProtoP\001Z2google.golang.org/protobuf/types/known/timestamppb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _TIMESTAMP._serialized_start=52 - _TIMESTAMP._serialized_end=95 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/type_pb2.py b/opensafely/_vendor/google/protobuf/type_pb2.py deleted file mode 100644 index 46cb228e..00000000 --- a/opensafely/_vendor/google/protobuf/type_pb2.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/type.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from opensafely._vendor.google.protobuf import source_context_pb2 as google_dot_protobuf_dot_source__context__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1agoogle/protobuf/type.proto\x12\x0fgoogle.protobuf\x1a\x19google/protobuf/any.proto\x1a$google/protobuf/source_context.proto\"\xd7\x01\n\x04Type\x12\x0c\n\x04name\x18\x01 \x01(\t\x12&\n\x06\x66ields\x18\x02 \x03(\x0b\x32\x16.google.protobuf.Field\x12\x0e\n\x06oneofs\x18\x03 \x03(\t\x12(\n\x07options\x18\x04 \x03(\x0b\x32\x17.google.protobuf.Option\x12\x36\n\x0esource_context\x18\x05 \x01(\x0b\x32\x1e.google.protobuf.SourceContext\x12\'\n\x06syntax\x18\x06 \x01(\x0e\x32\x17.google.protobuf.Syntax\"\xd5\x05\n\x05\x46ield\x12)\n\x04kind\x18\x01 \x01(\x0e\x32\x1b.google.protobuf.Field.Kind\x12\x37\n\x0b\x63\x61rdinality\x18\x02 \x01(\x0e\x32\".google.protobuf.Field.Cardinality\x12\x0e\n\x06number\x18\x03 \x01(\x05\x12\x0c\n\x04name\x18\x04 \x01(\t\x12\x10\n\x08type_url\x18\x06 \x01(\t\x12\x13\n\x0boneof_index\x18\x07 \x01(\x05\x12\x0e\n\x06packed\x18\x08 \x01(\x08\x12(\n\x07options\x18\t \x03(\x0b\x32\x17.google.protobuf.Option\x12\x11\n\tjson_name\x18\n \x01(\t\x12\x15\n\rdefault_value\x18\x0b \x01(\t\"\xc8\x02\n\x04Kind\x12\x10\n\x0cTYPE_UNKNOWN\x10\x00\x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"t\n\x0b\x43\x61rdinality\x12\x17\n\x13\x43\x41RDINALITY_UNKNOWN\x10\x00\x12\x18\n\x14\x43\x41RDINALITY_OPTIONAL\x10\x01\x12\x18\n\x14\x43\x41RDINALITY_REQUIRED\x10\x02\x12\x18\n\x14\x43\x41RDINALITY_REPEATED\x10\x03\"\xce\x01\n\x04\x45num\x12\x0c\n\x04name\x18\x01 \x01(\t\x12-\n\tenumvalue\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.EnumValue\x12(\n\x07options\x18\x03 \x03(\x0b\x32\x17.google.protobuf.Option\x12\x36\n\x0esource_context\x18\x04 \x01(\x0b\x32\x1e.google.protobuf.SourceContext\x12\'\n\x06syntax\x18\x05 \x01(\x0e\x32\x17.google.protobuf.Syntax\"S\n\tEnumValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\x05\x12(\n\x07options\x18\x03 \x03(\x0b\x32\x17.google.protobuf.Option\";\n\x06Option\x12\x0c\n\x04name\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.google.protobuf.Any*.\n\x06Syntax\x12\x11\n\rSYNTAX_PROTO2\x10\x00\x12\x11\n\rSYNTAX_PROTO3\x10\x01\x42{\n\x13\x63om.google.protobufB\tTypeProtoP\x01Z-google.golang.org/protobuf/types/known/typepb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.type_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\tTypeProtoP\001Z-google.golang.org/protobuf/types/known/typepb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _SYNTAX._serialized_start=1413 - _SYNTAX._serialized_end=1459 - _TYPE._serialized_start=113 - _TYPE._serialized_end=328 - _FIELD._serialized_start=331 - _FIELD._serialized_end=1056 - _FIELD_KIND._serialized_start=610 - _FIELD_KIND._serialized_end=938 - _FIELD_CARDINALITY._serialized_start=940 - _FIELD_CARDINALITY._serialized_end=1056 - _ENUM._serialized_start=1059 - _ENUM._serialized_end=1265 - _ENUMVALUE._serialized_start=1267 - _ENUMVALUE._serialized_end=1350 - _OPTION._serialized_start=1352 - _OPTION._serialized_end=1411 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/util/__init__.py b/opensafely/_vendor/google/protobuf/util/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/protobuf/util/json_format_pb2.py b/opensafely/_vendor/google/protobuf/util/json_format_pb2.py deleted file mode 100644 index 06f39774..00000000 --- a/opensafely/_vendor/google/protobuf/util/json_format_pb2.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/util/json_format.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n&google/protobuf/util/json_format.proto\x12\x11protobuf_unittest\"\x89\x01\n\x13TestFlagsAndStrings\x12\t\n\x01\x41\x18\x01 \x02(\x05\x12K\n\rrepeatedgroup\x18\x02 \x03(\n24.protobuf_unittest.TestFlagsAndStrings.RepeatedGroup\x1a\x1a\n\rRepeatedGroup\x12\t\n\x01\x66\x18\x03 \x02(\t\"!\n\x14TestBase64ByteArrays\x12\t\n\x01\x61\x18\x01 \x02(\x0c\"G\n\x12TestJavaScriptJSON\x12\t\n\x01\x61\x18\x01 \x01(\x05\x12\r\n\x05\x66inal\x18\x02 \x01(\x02\x12\n\n\x02in\x18\x03 \x01(\t\x12\x0b\n\x03Var\x18\x04 \x01(\t\"Q\n\x18TestJavaScriptOrderJSON1\x12\t\n\x01\x64\x18\x01 \x01(\x05\x12\t\n\x01\x63\x18\x02 \x01(\x05\x12\t\n\x01x\x18\x03 \x01(\x08\x12\t\n\x01\x62\x18\x04 \x01(\x05\x12\t\n\x01\x61\x18\x05 \x01(\x05\"\x89\x01\n\x18TestJavaScriptOrderJSON2\x12\t\n\x01\x64\x18\x01 \x01(\x05\x12\t\n\x01\x63\x18\x02 \x01(\x05\x12\t\n\x01x\x18\x03 \x01(\x08\x12\t\n\x01\x62\x18\x04 \x01(\x05\x12\t\n\x01\x61\x18\x05 \x01(\x05\x12\x36\n\x01z\x18\x06 \x03(\x0b\x32+.protobuf_unittest.TestJavaScriptOrderJSON1\"$\n\x0cTestLargeInt\x12\t\n\x01\x61\x18\x01 \x02(\x03\x12\t\n\x01\x62\x18\x02 \x02(\x04\"\xa0\x01\n\x0bTestNumbers\x12\x30\n\x01\x61\x18\x01 \x01(\x0e\x32%.protobuf_unittest.TestNumbers.MyType\x12\t\n\x01\x62\x18\x02 \x01(\x05\x12\t\n\x01\x63\x18\x03 \x01(\x02\x12\t\n\x01\x64\x18\x04 \x01(\x08\x12\t\n\x01\x65\x18\x05 \x01(\x01\x12\t\n\x01\x66\x18\x06 \x01(\r\"(\n\x06MyType\x12\x06\n\x02OK\x10\x00\x12\x0b\n\x07WARNING\x10\x01\x12\t\n\x05\x45RROR\x10\x02\"T\n\rTestCamelCase\x12\x14\n\x0cnormal_field\x18\x01 \x01(\t\x12\x15\n\rCAPITAL_FIELD\x18\x02 \x01(\x05\x12\x16\n\x0e\x43\x61melCaseField\x18\x03 \x01(\x05\"|\n\x0bTestBoolMap\x12=\n\x08\x62ool_map\x18\x01 \x03(\x0b\x32+.protobuf_unittest.TestBoolMap.BoolMapEntry\x1a.\n\x0c\x42oolMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\"O\n\rTestRecursion\x12\r\n\x05value\x18\x01 \x01(\x05\x12/\n\x05\x63hild\x18\x02 \x01(\x0b\x32 .protobuf_unittest.TestRecursion\"\x86\x01\n\rTestStringMap\x12\x43\n\nstring_map\x18\x01 \x03(\x0b\x32/.protobuf_unittest.TestStringMap.StringMapEntry\x1a\x30\n\x0eStringMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xc4\x01\n\x14TestStringSerializer\x12\x15\n\rscalar_string\x18\x01 \x01(\t\x12\x17\n\x0frepeated_string\x18\x02 \x03(\t\x12J\n\nstring_map\x18\x03 \x03(\x0b\x32\x36.protobuf_unittest.TestStringSerializer.StringMapEntry\x1a\x30\n\x0eStringMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"$\n\x18TestMessageWithExtension*\x08\x08\x64\x10\x80\x80\x80\x80\x02\"z\n\rTestExtension\x12\r\n\x05value\x18\x01 \x01(\t2Z\n\x03\x65xt\x12+.protobuf_unittest.TestMessageWithExtension\x18\x64 \x01(\x0b\x32 .protobuf_unittest.TestExtension\"Q\n\x14TestDefaultEnumValue\x12\x39\n\nenum_value\x18\x01 \x01(\x0e\x32\x1c.protobuf_unittest.EnumValue:\x07\x44\x45\x46\x41ULT*2\n\tEnumValue\x12\x0c\n\x08PROTOCOL\x10\x00\x12\n\n\x06\x42UFFER\x10\x01\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x02') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.util.json_format_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - TestMessageWithExtension.RegisterExtension(_TESTEXTENSION.extensions_by_name['ext']) - - DESCRIPTOR._options = None - _TESTBOOLMAP_BOOLMAPENTRY._options = None - _TESTBOOLMAP_BOOLMAPENTRY._serialized_options = b'8\001' - _TESTSTRINGMAP_STRINGMAPENTRY._options = None - _TESTSTRINGMAP_STRINGMAPENTRY._serialized_options = b'8\001' - _TESTSTRINGSERIALIZER_STRINGMAPENTRY._options = None - _TESTSTRINGSERIALIZER_STRINGMAPENTRY._serialized_options = b'8\001' - _ENUMVALUE._serialized_start=1607 - _ENUMVALUE._serialized_end=1657 - _TESTFLAGSANDSTRINGS._serialized_start=62 - _TESTFLAGSANDSTRINGS._serialized_end=199 - _TESTFLAGSANDSTRINGS_REPEATEDGROUP._serialized_start=173 - _TESTFLAGSANDSTRINGS_REPEATEDGROUP._serialized_end=199 - _TESTBASE64BYTEARRAYS._serialized_start=201 - _TESTBASE64BYTEARRAYS._serialized_end=234 - _TESTJAVASCRIPTJSON._serialized_start=236 - _TESTJAVASCRIPTJSON._serialized_end=307 - _TESTJAVASCRIPTORDERJSON1._serialized_start=309 - _TESTJAVASCRIPTORDERJSON1._serialized_end=390 - _TESTJAVASCRIPTORDERJSON2._serialized_start=393 - _TESTJAVASCRIPTORDERJSON2._serialized_end=530 - _TESTLARGEINT._serialized_start=532 - _TESTLARGEINT._serialized_end=568 - _TESTNUMBERS._serialized_start=571 - _TESTNUMBERS._serialized_end=731 - _TESTNUMBERS_MYTYPE._serialized_start=691 - _TESTNUMBERS_MYTYPE._serialized_end=731 - _TESTCAMELCASE._serialized_start=733 - _TESTCAMELCASE._serialized_end=817 - _TESTBOOLMAP._serialized_start=819 - _TESTBOOLMAP._serialized_end=943 - _TESTBOOLMAP_BOOLMAPENTRY._serialized_start=897 - _TESTBOOLMAP_BOOLMAPENTRY._serialized_end=943 - _TESTRECURSION._serialized_start=945 - _TESTRECURSION._serialized_end=1024 - _TESTSTRINGMAP._serialized_start=1027 - _TESTSTRINGMAP._serialized_end=1161 - _TESTSTRINGMAP_STRINGMAPENTRY._serialized_start=1113 - _TESTSTRINGMAP_STRINGMAPENTRY._serialized_end=1161 - _TESTSTRINGSERIALIZER._serialized_start=1164 - _TESTSTRINGSERIALIZER._serialized_end=1360 - _TESTSTRINGSERIALIZER_STRINGMAPENTRY._serialized_start=1113 - _TESTSTRINGSERIALIZER_STRINGMAPENTRY._serialized_end=1161 - _TESTMESSAGEWITHEXTENSION._serialized_start=1362 - _TESTMESSAGEWITHEXTENSION._serialized_end=1398 - _TESTEXTENSION._serialized_start=1400 - _TESTEXTENSION._serialized_end=1522 - _TESTDEFAULTENUMVALUE._serialized_start=1524 - _TESTDEFAULTENUMVALUE._serialized_end=1605 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/util/json_format_proto3_pb2.py b/opensafely/_vendor/google/protobuf/util/json_format_proto3_pb2.py deleted file mode 100644 index e7bfc3c2..00000000 --- a/opensafely/_vendor/google/protobuf/util/json_format_proto3_pb2.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/util/json_format_proto3.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from opensafely._vendor.google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from opensafely._vendor.google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from opensafely._vendor.google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -from opensafely._vendor.google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from opensafely._vendor.google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 -from opensafely._vendor.google.protobuf import unittest_pb2 as google_dot_protobuf_dot_unittest__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n-google/protobuf/util/json_format_proto3.proto\x12\x06proto3\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1egoogle/protobuf/unittest.proto\"\x1c\n\x0bMessageType\x12\r\n\x05value\x18\x01 \x01(\x05\"\x94\x05\n\x0bTestMessage\x12\x12\n\nbool_value\x18\x01 \x01(\x08\x12\x13\n\x0bint32_value\x18\x02 \x01(\x05\x12\x13\n\x0bint64_value\x18\x03 \x01(\x03\x12\x14\n\x0cuint32_value\x18\x04 \x01(\r\x12\x14\n\x0cuint64_value\x18\x05 \x01(\x04\x12\x13\n\x0b\x66loat_value\x18\x06 \x01(\x02\x12\x14\n\x0c\x64ouble_value\x18\x07 \x01(\x01\x12\x14\n\x0cstring_value\x18\x08 \x01(\t\x12\x13\n\x0b\x62ytes_value\x18\t \x01(\x0c\x12$\n\nenum_value\x18\n \x01(\x0e\x32\x10.proto3.EnumType\x12*\n\rmessage_value\x18\x0b \x01(\x0b\x32\x13.proto3.MessageType\x12\x1b\n\x13repeated_bool_value\x18\x15 \x03(\x08\x12\x1c\n\x14repeated_int32_value\x18\x16 \x03(\x05\x12\x1c\n\x14repeated_int64_value\x18\x17 \x03(\x03\x12\x1d\n\x15repeated_uint32_value\x18\x18 \x03(\r\x12\x1d\n\x15repeated_uint64_value\x18\x19 \x03(\x04\x12\x1c\n\x14repeated_float_value\x18\x1a \x03(\x02\x12\x1d\n\x15repeated_double_value\x18\x1b \x03(\x01\x12\x1d\n\x15repeated_string_value\x18\x1c \x03(\t\x12\x1c\n\x14repeated_bytes_value\x18\x1d \x03(\x0c\x12-\n\x13repeated_enum_value\x18\x1e \x03(\x0e\x32\x10.proto3.EnumType\x12\x33\n\x16repeated_message_value\x18\x1f \x03(\x0b\x32\x13.proto3.MessageType\"\x8c\x02\n\tTestOneof\x12\x1b\n\x11oneof_int32_value\x18\x01 \x01(\x05H\x00\x12\x1c\n\x12oneof_string_value\x18\x02 \x01(\tH\x00\x12\x1b\n\x11oneof_bytes_value\x18\x03 \x01(\x0cH\x00\x12,\n\x10oneof_enum_value\x18\x04 \x01(\x0e\x32\x10.proto3.EnumTypeH\x00\x12\x32\n\x13oneof_message_value\x18\x05 \x01(\x0b\x32\x13.proto3.MessageTypeH\x00\x12\x36\n\x10oneof_null_value\x18\x06 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x42\r\n\x0boneof_value\"\xe1\x04\n\x07TestMap\x12.\n\x08\x62ool_map\x18\x01 \x03(\x0b\x32\x1c.proto3.TestMap.BoolMapEntry\x12\x30\n\tint32_map\x18\x02 \x03(\x0b\x32\x1d.proto3.TestMap.Int32MapEntry\x12\x30\n\tint64_map\x18\x03 \x03(\x0b\x32\x1d.proto3.TestMap.Int64MapEntry\x12\x32\n\nuint32_map\x18\x04 \x03(\x0b\x32\x1e.proto3.TestMap.Uint32MapEntry\x12\x32\n\nuint64_map\x18\x05 \x03(\x0b\x32\x1e.proto3.TestMap.Uint64MapEntry\x12\x32\n\nstring_map\x18\x06 \x03(\x0b\x32\x1e.proto3.TestMap.StringMapEntry\x1a.\n\x0c\x42oolMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a/\n\rInt32MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a/\n\rInt64MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a\x30\n\x0eUint32MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a\x30\n\x0eUint64MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a\x30\n\x0eStringMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\"\x85\x06\n\rTestNestedMap\x12\x34\n\x08\x62ool_map\x18\x01 \x03(\x0b\x32\".proto3.TestNestedMap.BoolMapEntry\x12\x36\n\tint32_map\x18\x02 \x03(\x0b\x32#.proto3.TestNestedMap.Int32MapEntry\x12\x36\n\tint64_map\x18\x03 \x03(\x0b\x32#.proto3.TestNestedMap.Int64MapEntry\x12\x38\n\nuint32_map\x18\x04 \x03(\x0b\x32$.proto3.TestNestedMap.Uint32MapEntry\x12\x38\n\nuint64_map\x18\x05 \x03(\x0b\x32$.proto3.TestNestedMap.Uint64MapEntry\x12\x38\n\nstring_map\x18\x06 \x03(\x0b\x32$.proto3.TestNestedMap.StringMapEntry\x12\x32\n\x07map_map\x18\x07 \x03(\x0b\x32!.proto3.TestNestedMap.MapMapEntry\x1a.\n\x0c\x42oolMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a/\n\rInt32MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a/\n\rInt64MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a\x30\n\x0eUint32MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a\x30\n\x0eUint64MapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a\x30\n\x0eStringMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a\x44\n\x0bMapMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.proto3.TestNestedMap:\x02\x38\x01\"{\n\rTestStringMap\x12\x38\n\nstring_map\x18\x01 \x03(\x0b\x32$.proto3.TestStringMap.StringMapEntry\x1a\x30\n\x0eStringMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xee\x07\n\x0bTestWrapper\x12.\n\nbool_value\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x30\n\x0bint32_value\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x30\n\x0bint64_value\x18\x03 \x01(\x0b\x32\x1b.google.protobuf.Int64Value\x12\x32\n\x0cuint32_value\x18\x04 \x01(\x0b\x32\x1c.google.protobuf.UInt32Value\x12\x32\n\x0cuint64_value\x18\x05 \x01(\x0b\x32\x1c.google.protobuf.UInt64Value\x12\x30\n\x0b\x66loat_value\x18\x06 \x01(\x0b\x32\x1b.google.protobuf.FloatValue\x12\x32\n\x0c\x64ouble_value\x18\x07 \x01(\x0b\x32\x1c.google.protobuf.DoubleValue\x12\x32\n\x0cstring_value\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.StringValue\x12\x30\n\x0b\x62ytes_value\x18\t \x01(\x0b\x32\x1b.google.protobuf.BytesValue\x12\x37\n\x13repeated_bool_value\x18\x0b \x03(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x39\n\x14repeated_int32_value\x18\x0c \x03(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x39\n\x14repeated_int64_value\x18\r \x03(\x0b\x32\x1b.google.protobuf.Int64Value\x12;\n\x15repeated_uint32_value\x18\x0e \x03(\x0b\x32\x1c.google.protobuf.UInt32Value\x12;\n\x15repeated_uint64_value\x18\x0f \x03(\x0b\x32\x1c.google.protobuf.UInt64Value\x12\x39\n\x14repeated_float_value\x18\x10 \x03(\x0b\x32\x1b.google.protobuf.FloatValue\x12;\n\x15repeated_double_value\x18\x11 \x03(\x0b\x32\x1c.google.protobuf.DoubleValue\x12;\n\x15repeated_string_value\x18\x12 \x03(\x0b\x32\x1c.google.protobuf.StringValue\x12\x39\n\x14repeated_bytes_value\x18\x13 \x03(\x0b\x32\x1b.google.protobuf.BytesValue\"n\n\rTestTimestamp\x12)\n\x05value\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x32\n\x0erepeated_value\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\"k\n\x0cTestDuration\x12(\n\x05value\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x31\n\x0erepeated_value\x18\x02 \x03(\x0b\x32\x19.google.protobuf.Duration\":\n\rTestFieldMask\x12)\n\x05value\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"e\n\nTestStruct\x12&\n\x05value\x18\x01 \x01(\x0b\x32\x17.google.protobuf.Struct\x12/\n\x0erepeated_value\x18\x02 \x03(\x0b\x32\x17.google.protobuf.Struct\"\\\n\x07TestAny\x12#\n\x05value\x18\x01 \x01(\x0b\x32\x14.google.protobuf.Any\x12,\n\x0erepeated_value\x18\x02 \x03(\x0b\x32\x14.google.protobuf.Any\"b\n\tTestValue\x12%\n\x05value\x18\x01 \x01(\x0b\x32\x16.google.protobuf.Value\x12.\n\x0erepeated_value\x18\x02 \x03(\x0b\x32\x16.google.protobuf.Value\"n\n\rTestListValue\x12)\n\x05value\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.ListValue\x12\x32\n\x0erepeated_value\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.ListValue\"\x89\x01\n\rTestBoolValue\x12\x12\n\nbool_value\x18\x01 \x01(\x08\x12\x34\n\x08\x62ool_map\x18\x02 \x03(\x0b\x32\".proto3.TestBoolValue.BoolMapEntry\x1a.\n\x0c\x42oolMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\"+\n\x12TestCustomJsonName\x12\x15\n\x05value\x18\x01 \x01(\x05R\x06@value\"J\n\x0eTestExtensions\x12\x38\n\nextensions\x18\x01 \x01(\x0b\x32$.protobuf_unittest.TestAllExtensions\"\x84\x01\n\rTestEnumValue\x12%\n\x0b\x65num_value1\x18\x01 \x01(\x0e\x32\x10.proto3.EnumType\x12%\n\x0b\x65num_value2\x18\x02 \x01(\x0e\x32\x10.proto3.EnumType\x12%\n\x0b\x65num_value3\x18\x03 \x01(\x0e\x32\x10.proto3.EnumType*\x1c\n\x08\x45numType\x12\x07\n\x03\x46OO\x10\x00\x12\x07\n\x03\x42\x41R\x10\x01\x42,\n\x18\x63om.google.protobuf.utilB\x10JsonFormatProto3b\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.util.json_format_proto3_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\030com.google.protobuf.utilB\020JsonFormatProto3' - _TESTMAP_BOOLMAPENTRY._options = None - _TESTMAP_BOOLMAPENTRY._serialized_options = b'8\001' - _TESTMAP_INT32MAPENTRY._options = None - _TESTMAP_INT32MAPENTRY._serialized_options = b'8\001' - _TESTMAP_INT64MAPENTRY._options = None - _TESTMAP_INT64MAPENTRY._serialized_options = b'8\001' - _TESTMAP_UINT32MAPENTRY._options = None - _TESTMAP_UINT32MAPENTRY._serialized_options = b'8\001' - _TESTMAP_UINT64MAPENTRY._options = None - _TESTMAP_UINT64MAPENTRY._serialized_options = b'8\001' - _TESTMAP_STRINGMAPENTRY._options = None - _TESTMAP_STRINGMAPENTRY._serialized_options = b'8\001' - _TESTNESTEDMAP_BOOLMAPENTRY._options = None - _TESTNESTEDMAP_BOOLMAPENTRY._serialized_options = b'8\001' - _TESTNESTEDMAP_INT32MAPENTRY._options = None - _TESTNESTEDMAP_INT32MAPENTRY._serialized_options = b'8\001' - _TESTNESTEDMAP_INT64MAPENTRY._options = None - _TESTNESTEDMAP_INT64MAPENTRY._serialized_options = b'8\001' - _TESTNESTEDMAP_UINT32MAPENTRY._options = None - _TESTNESTEDMAP_UINT32MAPENTRY._serialized_options = b'8\001' - _TESTNESTEDMAP_UINT64MAPENTRY._options = None - _TESTNESTEDMAP_UINT64MAPENTRY._serialized_options = b'8\001' - _TESTNESTEDMAP_STRINGMAPENTRY._options = None - _TESTNESTEDMAP_STRINGMAPENTRY._serialized_options = b'8\001' - _TESTNESTEDMAP_MAPMAPENTRY._options = None - _TESTNESTEDMAP_MAPMAPENTRY._serialized_options = b'8\001' - _TESTSTRINGMAP_STRINGMAPENTRY._options = None - _TESTSTRINGMAP_STRINGMAPENTRY._serialized_options = b'8\001' - _TESTBOOLVALUE_BOOLMAPENTRY._options = None - _TESTBOOLVALUE_BOOLMAPENTRY._serialized_options = b'8\001' - _ENUMTYPE._serialized_start=4849 - _ENUMTYPE._serialized_end=4877 - _MESSAGETYPE._serialized_start=277 - _MESSAGETYPE._serialized_end=305 - _TESTMESSAGE._serialized_start=308 - _TESTMESSAGE._serialized_end=968 - _TESTONEOF._serialized_start=971 - _TESTONEOF._serialized_end=1239 - _TESTMAP._serialized_start=1242 - _TESTMAP._serialized_end=1851 - _TESTMAP_BOOLMAPENTRY._serialized_start=1557 - _TESTMAP_BOOLMAPENTRY._serialized_end=1603 - _TESTMAP_INT32MAPENTRY._serialized_start=1605 - _TESTMAP_INT32MAPENTRY._serialized_end=1652 - _TESTMAP_INT64MAPENTRY._serialized_start=1654 - _TESTMAP_INT64MAPENTRY._serialized_end=1701 - _TESTMAP_UINT32MAPENTRY._serialized_start=1703 - _TESTMAP_UINT32MAPENTRY._serialized_end=1751 - _TESTMAP_UINT64MAPENTRY._serialized_start=1753 - _TESTMAP_UINT64MAPENTRY._serialized_end=1801 - _TESTMAP_STRINGMAPENTRY._serialized_start=1803 - _TESTMAP_STRINGMAPENTRY._serialized_end=1851 - _TESTNESTEDMAP._serialized_start=1854 - _TESTNESTEDMAP._serialized_end=2627 - _TESTNESTEDMAP_BOOLMAPENTRY._serialized_start=1557 - _TESTNESTEDMAP_BOOLMAPENTRY._serialized_end=1603 - _TESTNESTEDMAP_INT32MAPENTRY._serialized_start=1605 - _TESTNESTEDMAP_INT32MAPENTRY._serialized_end=1652 - _TESTNESTEDMAP_INT64MAPENTRY._serialized_start=1654 - _TESTNESTEDMAP_INT64MAPENTRY._serialized_end=1701 - _TESTNESTEDMAP_UINT32MAPENTRY._serialized_start=1703 - _TESTNESTEDMAP_UINT32MAPENTRY._serialized_end=1751 - _TESTNESTEDMAP_UINT64MAPENTRY._serialized_start=1753 - _TESTNESTEDMAP_UINT64MAPENTRY._serialized_end=1801 - _TESTNESTEDMAP_STRINGMAPENTRY._serialized_start=1803 - _TESTNESTEDMAP_STRINGMAPENTRY._serialized_end=1851 - _TESTNESTEDMAP_MAPMAPENTRY._serialized_start=2559 - _TESTNESTEDMAP_MAPMAPENTRY._serialized_end=2627 - _TESTSTRINGMAP._serialized_start=2629 - _TESTSTRINGMAP._serialized_end=2752 - _TESTSTRINGMAP_STRINGMAPENTRY._serialized_start=2704 - _TESTSTRINGMAP_STRINGMAPENTRY._serialized_end=2752 - _TESTWRAPPER._serialized_start=2755 - _TESTWRAPPER._serialized_end=3761 - _TESTTIMESTAMP._serialized_start=3763 - _TESTTIMESTAMP._serialized_end=3873 - _TESTDURATION._serialized_start=3875 - _TESTDURATION._serialized_end=3982 - _TESTFIELDMASK._serialized_start=3984 - _TESTFIELDMASK._serialized_end=4042 - _TESTSTRUCT._serialized_start=4044 - _TESTSTRUCT._serialized_end=4145 - _TESTANY._serialized_start=4147 - _TESTANY._serialized_end=4239 - _TESTVALUE._serialized_start=4241 - _TESTVALUE._serialized_end=4339 - _TESTLISTVALUE._serialized_start=4341 - _TESTLISTVALUE._serialized_end=4451 - _TESTBOOLVALUE._serialized_start=4454 - _TESTBOOLVALUE._serialized_end=4591 - _TESTBOOLVALUE_BOOLMAPENTRY._serialized_start=1557 - _TESTBOOLVALUE_BOOLMAPENTRY._serialized_end=1603 - _TESTCUSTOMJSONNAME._serialized_start=4593 - _TESTCUSTOMJSONNAME._serialized_end=4636 - _TESTEXTENSIONS._serialized_start=4638 - _TESTEXTENSIONS._serialized_end=4712 - _TESTENUMVALUE._serialized_start=4715 - _TESTENUMVALUE._serialized_end=4847 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/protobuf/wrappers_pb2.py b/opensafely/_vendor/google/protobuf/wrappers_pb2.py deleted file mode 100644 index 9f212c5e..00000000 --- a/opensafely/_vendor/google/protobuf/wrappers_pb2.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/wrappers.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import builder as _builder -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1egoogle/protobuf/wrappers.proto\x12\x0fgoogle.protobuf\"\x1c\n\x0b\x44oubleValue\x12\r\n\x05value\x18\x01 \x01(\x01\"\x1b\n\nFloatValue\x12\r\n\x05value\x18\x01 \x01(\x02\"\x1b\n\nInt64Value\x12\r\n\x05value\x18\x01 \x01(\x03\"\x1c\n\x0bUInt64Value\x12\r\n\x05value\x18\x01 \x01(\x04\"\x1b\n\nInt32Value\x12\r\n\x05value\x18\x01 \x01(\x05\"\x1c\n\x0bUInt32Value\x12\r\n\x05value\x18\x01 \x01(\r\"\x1a\n\tBoolValue\x12\r\n\x05value\x18\x01 \x01(\x08\"\x1c\n\x0bStringValue\x12\r\n\x05value\x18\x01 \x01(\t\"\x1b\n\nBytesValue\x12\r\n\x05value\x18\x01 \x01(\x0c\x42\x83\x01\n\x13\x63om.google.protobufB\rWrappersProtoP\x01Z1google.golang.org/protobuf/types/known/wrapperspb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3') - -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.wrappers_pb2', globals()) -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b'\n\023com.google.protobufB\rWrappersProtoP\001Z1google.golang.org/protobuf/types/known/wrapperspb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' - _DOUBLEVALUE._serialized_start=51 - _DOUBLEVALUE._serialized_end=79 - _FLOATVALUE._serialized_start=81 - _FLOATVALUE._serialized_end=108 - _INT64VALUE._serialized_start=110 - _INT64VALUE._serialized_end=137 - _UINT64VALUE._serialized_start=139 - _UINT64VALUE._serialized_end=167 - _INT32VALUE._serialized_start=169 - _INT32VALUE._serialized_end=196 - _UINT32VALUE._serialized_start=198 - _UINT32VALUE._serialized_end=226 - _BOOLVALUE._serialized_start=228 - _BOOLVALUE._serialized_end=254 - _STRINGVALUE._serialized_start=256 - _STRINGVALUE._serialized_end=284 - _BYTESVALUE._serialized_start=286 - _BYTESVALUE._serialized_end=313 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/rpc/__init__.py b/opensafely/_vendor/google/rpc/__init__.py deleted file mode 100644 index 9a1b64a6..00000000 --- a/opensafely/_vendor/google/rpc/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 Google LLC -# -# 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 -# -# https://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. - -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - - __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/opensafely/_vendor/google/rpc/code.proto b/opensafely/_vendor/google/rpc/code.proto deleted file mode 100644 index 98ae0ac1..00000000 --- a/opensafely/_vendor/google/rpc/code.proto +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2020 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.rpc; - -option go_package = "google.golang.org/genproto/googleapis/rpc/code;code"; -option java_multiple_files = true; -option java_outer_classname = "CodeProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - -// The canonical error codes for gRPC APIs. -// -// -// Sometimes multiple error codes may apply. Services should return -// the most specific error code that applies. For example, prefer -// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. -// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. -enum Code { - // Not an error; returned on success - // - // HTTP Mapping: 200 OK - OK = 0; - - // The operation was cancelled, typically by the caller. - // - // HTTP Mapping: 499 Client Closed Request - CANCELLED = 1; - - // Unknown error. For example, this error may be returned when - // a `Status` value received from another address space belongs to - // an error space that is not known in this address space. Also - // errors raised by APIs that do not return enough error information - // may be converted to this error. - // - // HTTP Mapping: 500 Internal Server Error - UNKNOWN = 2; - - // The client specified an invalid argument. Note that this differs - // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments - // that are problematic regardless of the state of the system - // (e.g., a malformed file name). - // - // HTTP Mapping: 400 Bad Request - INVALID_ARGUMENT = 3; - - // The deadline expired before the operation could complete. For operations - // that change the state of the system, this error may be returned - // even if the operation has completed successfully. For example, a - // successful response from a server could have been delayed long - // enough for the deadline to expire. - // - // HTTP Mapping: 504 Gateway Timeout - DEADLINE_EXCEEDED = 4; - - // Some requested entity (e.g., file or directory) was not found. - // - // Note to server developers: if a request is denied for an entire class - // of users, such as gradual feature rollout or undocumented whitelist, - // `NOT_FOUND` may be used. If a request is denied for some users within - // a class of users, such as user-based access control, `PERMISSION_DENIED` - // must be used. - // - // HTTP Mapping: 404 Not Found - NOT_FOUND = 5; - - // The entity that a client attempted to create (e.g., file or directory) - // already exists. - // - // HTTP Mapping: 409 Conflict - ALREADY_EXISTS = 6; - - // The caller does not have permission to execute the specified - // operation. `PERMISSION_DENIED` must not be used for rejections - // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` - // instead for those errors). `PERMISSION_DENIED` must not be - // used if the caller can not be identified (use `UNAUTHENTICATED` - // instead for those errors). This error code does not imply the - // request is valid or the requested entity exists or satisfies - // other pre-conditions. - // - // HTTP Mapping: 403 Forbidden - PERMISSION_DENIED = 7; - - // The request does not have valid authentication credentials for the - // operation. - // - // HTTP Mapping: 401 Unauthorized - UNAUTHENTICATED = 16; - - // Some resource has been exhausted, perhaps a per-user quota, or - // perhaps the entire file system is out of space. - // - // HTTP Mapping: 429 Too Many Requests - RESOURCE_EXHAUSTED = 8; - - // The operation was rejected because the system is not in a state - // required for the operation's execution. For example, the directory - // to be deleted is non-empty, an rmdir operation is applied to - // a non-directory, etc. - // - // Service implementors can use the following guidelines to decide - // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: - // (a) Use `UNAVAILABLE` if the client can retry just the failing call. - // (b) Use `ABORTED` if the client should retry at a higher level - // (e.g., when a client-specified test-and-set fails, indicating the - // client should restart a read-modify-write sequence). - // (c) Use `FAILED_PRECONDITION` if the client should not retry until - // the system state has been explicitly fixed. E.g., if an "rmdir" - // fails because the directory is non-empty, `FAILED_PRECONDITION` - // should be returned since the client should not retry unless - // the files are deleted from the directory. - // - // HTTP Mapping: 400 Bad Request - FAILED_PRECONDITION = 9; - - // The operation was aborted, typically due to a concurrency issue such as - // a sequencer check failure or transaction abort. - // - // See the guidelines above for deciding between `FAILED_PRECONDITION`, - // `ABORTED`, and `UNAVAILABLE`. - // - // HTTP Mapping: 409 Conflict - ABORTED = 10; - - // The operation was attempted past the valid range. E.g., seeking or - // reading past end-of-file. - // - // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may - // be fixed if the system state changes. For example, a 32-bit file - // system will generate `INVALID_ARGUMENT` if asked to read at an - // offset that is not in the range [0,2^32-1], but it will generate - // `OUT_OF_RANGE` if asked to read from an offset past the current - // file size. - // - // There is a fair bit of overlap between `FAILED_PRECONDITION` and - // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific - // error) when it applies so that callers who are iterating through - // a space can easily look for an `OUT_OF_RANGE` error to detect when - // they are done. - // - // HTTP Mapping: 400 Bad Request - OUT_OF_RANGE = 11; - - // The operation is not implemented or is not supported/enabled in this - // service. - // - // HTTP Mapping: 501 Not Implemented - UNIMPLEMENTED = 12; - - // Internal errors. This means that some invariants expected by the - // underlying system have been broken. This error code is reserved - // for serious errors. - // - // HTTP Mapping: 500 Internal Server Error - INTERNAL = 13; - - // The service is currently unavailable. This is most likely a - // transient condition, which can be corrected by retrying with - // a backoff. Note that it is not always safe to retry - // non-idempotent operations. - // - // See the guidelines above for deciding between `FAILED_PRECONDITION`, - // `ABORTED`, and `UNAVAILABLE`. - // - // HTTP Mapping: 503 Service Unavailable - UNAVAILABLE = 14; - - // Unrecoverable data loss or corruption. - // - // HTTP Mapping: 500 Internal Server Error - DATA_LOSS = 15; -} diff --git a/opensafely/_vendor/google/rpc/code_pb2.py b/opensafely/_vendor/google/rpc/code_pb2.py deleted file mode 100644 index 88db7d1c..00000000 --- a/opensafely/_vendor/google/rpc/code_pb2.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/rpc/code.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n\x15google/rpc/code.proto\x12\ngoogle.rpc*\xb7\x02\n\x04\x43ode\x12\x06\n\x02OK\x10\x00\x12\r\n\tCANCELLED\x10\x01\x12\x0b\n\x07UNKNOWN\x10\x02\x12\x14\n\x10INVALID_ARGUMENT\x10\x03\x12\x15\n\x11\x44\x45\x41\x44LINE_EXCEEDED\x10\x04\x12\r\n\tNOT_FOUND\x10\x05\x12\x12\n\x0e\x41LREADY_EXISTS\x10\x06\x12\x15\n\x11PERMISSION_DENIED\x10\x07\x12\x13\n\x0fUNAUTHENTICATED\x10\x10\x12\x16\n\x12RESOURCE_EXHAUSTED\x10\x08\x12\x17\n\x13\x46\x41ILED_PRECONDITION\x10\t\x12\x0b\n\x07\x41\x42ORTED\x10\n\x12\x10\n\x0cOUT_OF_RANGE\x10\x0b\x12\x11\n\rUNIMPLEMENTED\x10\x0c\x12\x0c\n\x08INTERNAL\x10\r\x12\x0f\n\x0bUNAVAILABLE\x10\x0e\x12\r\n\tDATA_LOSS\x10\x0f\x42X\n\x0e\x63om.google.rpcB\tCodeProtoP\x01Z3google.golang.org/genproto/googleapis/rpc/code;code\xa2\x02\x03RPCb\x06proto3" -) - -_CODE = DESCRIPTOR.enum_types_by_name["Code"] -Code = enum_type_wrapper.EnumTypeWrapper(_CODE) -OK = 0 -CANCELLED = 1 -UNKNOWN = 2 -INVALID_ARGUMENT = 3 -DEADLINE_EXCEEDED = 4 -NOT_FOUND = 5 -ALREADY_EXISTS = 6 -PERMISSION_DENIED = 7 -UNAUTHENTICATED = 16 -RESOURCE_EXHAUSTED = 8 -FAILED_PRECONDITION = 9 -ABORTED = 10 -OUT_OF_RANGE = 11 -UNIMPLEMENTED = 12 -INTERNAL = 13 -UNAVAILABLE = 14 -DATA_LOSS = 15 - - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.rpcB\tCodeProtoP\001Z3google.golang.org/genproto/googleapis/rpc/code;code\242\002\003RPC" - _CODE._serialized_start = 38 - _CODE._serialized_end = 349 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/rpc/context/__init__.py b/opensafely/_vendor/google/rpc/context/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/rpc/context/attribute_context.proto b/opensafely/_vendor/google/rpc/context/attribute_context.proto deleted file mode 100644 index 30fe6f25..00000000 --- a/opensafely/_vendor/google/rpc/context/attribute_context.proto +++ /dev/null @@ -1,343 +0,0 @@ -// Copyright 2020 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.rpc.context; - -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/rpc/context/attribute_context;attribute_context"; -option java_multiple_files = true; -option java_outer_classname = "AttributeContextProto"; -option java_package = "com.google.rpc.context"; - -// This message defines the standard attribute vocabulary for Google APIs. -// -// An attribute is a piece of metadata that describes an activity on a network -// service. For example, the size of an HTTP request, or the status code of -// an HTTP response. -// -// Each attribute has a type and a name, which is logically defined as -// a proto message field in `AttributeContext`. The field type becomes the -// attribute type, and the field path becomes the attribute name. For example, -// the attribute `source.ip` maps to field `AttributeContext.source.ip`. -// -// This message definition is guaranteed not to have any wire breaking change. -// So you can use it directly for passing attributes across different systems. -// -// NOTE: Different system may generate different subset of attributes. Please -// verify the system specification before relying on an attribute generated -// a system. -message AttributeContext { - // This message defines attributes for a node that handles a network request. - // The node can be either a service or an application that sends, forwards, - // or receives the request. Service peers should fill in - // `principal` and `labels` as appropriate. - message Peer { - // The IP address of the peer. - string ip = 1; - - // The network port of the peer. - int64 port = 2; - - // The labels associated with the peer. - map labels = 6; - - // The identity of this peer. Similar to `Request.auth.principal`, but - // relative to the peer instead of the request. For example, the - // idenity associated with a load balancer that forwared the request. - string principal = 7; - - // The CLDR country/region code associated with the above IP address. - // If the IP address is private, the `region_code` should reflect the - // physical location where this peer is running. - string region_code = 8; - } - - // This message defines attributes associated with API operations, such as - // a network API request. The terminology is based on the conventions used - // by Google APIs, Istio, and OpenAPI. - message Api { - // The API service name. It is a logical identifier for a networked API, - // such as "pubsub.googleapis.com". The naming syntax depends on the - // API management system being used for handling the request. - string service = 1; - - // The API operation name. For gRPC requests, it is the fully qualified API - // method name, such as "google.pubsub.v1.Publisher.Publish". For OpenAPI - // requests, it is the `operationId`, such as "getPet". - string operation = 2; - - // The API protocol used for sending the request, such as "http", "https", - // "grpc", or "internal". - string protocol = 3; - - // The API version associated with the API operation above, such as "v1" or - // "v1alpha1". - string version = 4; - } - - // This message defines request authentication attributes. Terminology is - // based on the JSON Web Token (JWT) standard, but the terms also - // correlate to concepts in other standards. - message Auth { - // The authenticated principal. Reflects the issuer (`iss`) and subject - // (`sub`) claims within a JWT. The issuer and subject should be `/` - // delimited, with `/` percent-encoded within the subject fragment. For - // Google accounts, the principal format is: - // "https://accounts.google.com/{id}" - string principal = 1; - - // The intended audience(s) for this authentication information. Reflects - // the audience (`aud`) claim within a JWT. The audience - // value(s) depends on the `issuer`, but typically include one or more of - // the following pieces of information: - // - // * The services intended to receive the credential. For example, - // ["https://pubsub.googleapis.com/", "https://storage.googleapis.com/"]. - // * A set of service-based scopes. For example, - // ["https://www.googleapis.com/auth/cloud-platform"]. - // * The client id of an app, such as the Firebase project id for JWTs - // from Firebase Auth. - // - // Consult the documentation for the credential issuer to determine the - // information provided. - repeated string audiences = 2; - - // The authorized presenter of the credential. Reflects the optional - // Authorized Presenter (`azp`) claim within a JWT or the - // OAuth client id. For example, a Google Cloud Platform client id looks - // as follows: "123456789012.apps.googleusercontent.com". - string presenter = 3; - - // Structured claims presented with the credential. JWTs include - // `{key: value}` pairs for standard and private claims. The following - // is a subset of the standard required and optional claims that would - // typically be presented for a Google-based JWT: - // - // {'iss': 'accounts.google.com', - // 'sub': '113289723416554971153', - // 'aud': ['123456789012', 'pubsub.googleapis.com'], - // 'azp': '123456789012.apps.googleusercontent.com', - // 'email': 'jsmith@example.com', - // 'iat': 1353601026, - // 'exp': 1353604926} - // - // SAML assertions are similarly specified, but with an identity provider - // dependent structure. - google.protobuf.Struct claims = 4; - - // A list of access level resource names that allow resources to be - // accessed by authenticated requester. It is part of Secure GCP processing - // for the incoming request. An access level string has the format: - // "//{api_service_name}/accessPolicies/{policy_id}/accessLevels/{short_name}" - // - // Example: - // "//accesscontextmanager.googleapis.com/accessPolicies/MY_POLICY_ID/accessLevels/MY_LEVEL" - repeated string access_levels = 5; - } - - // This message defines attributes for an HTTP request. If the actual - // request is not an HTTP request, the runtime system should try to map - // the actual request to an equivalent HTTP request. - message Request { - // The unique ID for a request, which can be propagated to downstream - // systems. The ID should have low probability of collision - // within a single day for a specific service. - string id = 1; - - // The HTTP request method, such as `GET`, `POST`. - string method = 2; - - // The HTTP request headers. If multiple headers share the same key, they - // must be merged according to the HTTP spec. All header keys must be - // lowercased, because HTTP header keys are case-insensitive. - map headers = 3; - - // The HTTP URL path. - string path = 4; - - // The HTTP request `Host` header value. - string host = 5; - - // The HTTP URL scheme, such as `http` and `https`. - string scheme = 6; - - // The HTTP URL query in the format of `name1=value1&name2=value2`, as it - // appears in the first line of the HTTP request. No decoding is performed. - string query = 7; - - // The timestamp when the `destination` service receives the last byte of - // the request. - google.protobuf.Timestamp time = 9; - - // The HTTP request size in bytes. If unknown, it must be -1. - int64 size = 10; - - // The network protocol used with the request, such as "http/1.1", - // "spdy/3", "h2", "h2c", "webrtc", "tcp", "udp", "quic". See - // https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids - // for details. - string protocol = 11; - - // A special parameter for request reason. It is used by security systems - // to associate auditing information with a request. - string reason = 12; - - // The request authentication. May be absent for unauthenticated requests. - // Derived from the HTTP request `Authorization` header or equivalent. - Auth auth = 13; - } - - // This message defines attributes for a typical network response. It - // generally models semantics of an HTTP response. - message Response { - // The HTTP response status code, such as `200` and `404`. - int64 code = 1; - - // The HTTP response size in bytes. If unknown, it must be -1. - int64 size = 2; - - // The HTTP response headers. If multiple headers share the same key, they - // must be merged according to HTTP spec. All header keys must be - // lowercased, because HTTP header keys are case-insensitive. - map headers = 3; - - // The timestamp when the `destination` service sends the last byte of - // the response. - google.protobuf.Timestamp time = 4; - - // The length of time it takes the backend service to fully respond to a - // request. Measured from when the destination service starts to send the - // request to the backend until when the destination service receives the - // complete response from the backend. - google.protobuf.Duration backend_latency = 5; - } - - // This message defines core attributes for a resource. A resource is an - // addressable (named) entity provided by the destination service. For - // example, a file stored on a network storage service. - message Resource { - // The name of the service that this resource belongs to, such as - // `pubsub.googleapis.com`. The service may be different from the DNS - // hostname that actually serves the request. - string service = 1; - - // The stable identifier (name) of a resource on the `service`. A resource - // can be logically identified as "//{resource.service}/{resource.name}". - // The differences between a resource name and a URI are: - // - // * Resource name is a logical identifier, independent of network - // protocol and API version. For example, - // `//pubsub.googleapis.com/projects/123/topics/news-feed`. - // * URI often includes protocol and version information, so it can - // be used directly by applications. For example, - // `https://pubsub.googleapis.com/v1/projects/123/topics/news-feed`. - // - // See https://cloud.google.com/apis/design/resource_names for details. - string name = 2; - - // The type of the resource. The syntax is platform-specific because - // different platforms define their resources differently. - // - // For Google APIs, the type format must be "{service}/{kind}". - string type = 3; - - // The labels or tags on the resource, such as AWS resource tags and - // Kubernetes resource labels. - map labels = 4; - - // The unique identifier of the resource. UID is unique in the time - // and space for this resource within the scope of the service. It is - // typically generated by the server on successful creation of a resource - // and must not be changed. UID is used to uniquely identify resources - // with resource name reuses. This should be a UUID4. - string uid = 5; - - // Annotations is an unstructured key-value map stored with a resource that - // may be set by external tools to store and retrieve arbitrary metadata. - // They are not queryable and should be preserved when modifying objects. - // - // More info: https://kubernetes.io/docs/user-guide/annotations - map annotations = 6; - - // Mutable. The display name set by clients. Must be <= 63 characters. - string display_name = 7; - - // Output only. The timestamp when the resource was created. This may - // be either the time creation was initiated or when it was completed. - google.protobuf.Timestamp create_time = 8; - - // Output only. The timestamp when the resource was last updated. Any - // change to the resource made by users must refresh this value. - // Changes to a resource made by the service should refresh this value. - google.protobuf.Timestamp update_time = 9; - - // Output only. The timestamp when the resource was deleted. - // If the resource is not deleted, this must be empty. - google.protobuf.Timestamp delete_time = 10; - - // Output only. An opaque value that uniquely identifies a version or - // generation of a resource. It can be used to confirm that the client - // and server agree on the ordering of a resource being written. - string etag = 11; - - // Immutable. The location of the resource. The location encoding is - // specific to the service provider, and new encoding may be introduced - // as the service evolves. - // - // For Google Cloud products, the encoding is what is used by Google Cloud - // APIs, such as `us-east1`, `aws-us-east-1`, and `azure-eastus2`. The - // semantics of `location` is identical to the - // `cloud.googleapis.com/location` label used by some Google Cloud APIs. - string location = 12; - } - - // The origin of a network activity. In a multi hop network activity, - // the origin represents the sender of the first hop. For the first hop, - // the `source` and the `origin` must have the same content. - Peer origin = 7; - - // The source of a network activity, such as starting a TCP connection. - // In a multi hop network activity, the source represents the sender of the - // last hop. - Peer source = 1; - - // The destination of a network activity, such as accepting a TCP connection. - // In a multi hop network activity, the destination represents the receiver of - // the last hop. - Peer destination = 2; - - // Represents a network request, such as an HTTP request. - Request request = 3; - - // Represents a network response, such as an HTTP response. - Response response = 4; - - // Represents a target resource that is involved with a network activity. - // If multiple resources are involved with an activity, this must be the - // primary one. - Resource resource = 5; - - // Represents an API operation that is involved to a network activity. - Api api = 6; - - // Supports extensions for advanced use cases, such as logs and metrics. - repeated google.protobuf.Any extensions = 8; -} diff --git a/opensafely/_vendor/google/rpc/context/attribute_context_pb2.py b/opensafely/_vendor/google/rpc/context/attribute_context_pb2.py deleted file mode 100644 index 103afcd0..00000000 --- a/opensafely/_vendor/google/rpc/context/attribute_context_pb2.py +++ /dev/null @@ -1,223 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/rpc/context/attribute_context.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from opensafely._vendor.google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from opensafely._vendor.google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -from opensafely._vendor.google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n*google/rpc/context/attribute_context.proto\x12\x12google.rpc.context\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x83\x10\n\x10\x41ttributeContext\x12\x39\n\x06origin\x18\x07 \x01(\x0b\x32).google.rpc.context.AttributeContext.Peer\x12\x39\n\x06source\x18\x01 \x01(\x0b\x32).google.rpc.context.AttributeContext.Peer\x12>\n\x0b\x64\x65stination\x18\x02 \x01(\x0b\x32).google.rpc.context.AttributeContext.Peer\x12=\n\x07request\x18\x03 \x01(\x0b\x32,.google.rpc.context.AttributeContext.Request\x12?\n\x08response\x18\x04 \x01(\x0b\x32-.google.rpc.context.AttributeContext.Response\x12?\n\x08resource\x18\x05 \x01(\x0b\x32-.google.rpc.context.AttributeContext.Resource\x12\x35\n\x03\x61pi\x18\x06 \x01(\x0b\x32(.google.rpc.context.AttributeContext.Api\x12(\n\nextensions\x18\x08 \x03(\x0b\x32\x14.google.protobuf.Any\x1a\xbe\x01\n\x04Peer\x12\n\n\x02ip\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\x03\x12\x45\n\x06labels\x18\x06 \x03(\x0b\x32\x35.google.rpc.context.AttributeContext.Peer.LabelsEntry\x12\x11\n\tprincipal\x18\x07 \x01(\t\x12\x13\n\x0bregion_code\x18\x08 \x01(\t\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1aL\n\x03\x41pi\x12\x0f\n\x07service\x18\x01 \x01(\t\x12\x11\n\toperation\x18\x02 \x01(\t\x12\x10\n\x08protocol\x18\x03 \x01(\t\x12\x0f\n\x07version\x18\x04 \x01(\t\x1a\x7f\n\x04\x41uth\x12\x11\n\tprincipal\x18\x01 \x01(\t\x12\x11\n\taudiences\x18\x02 \x03(\t\x12\x11\n\tpresenter\x18\x03 \x01(\t\x12'\n\x06\x63laims\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x15\n\raccess_levels\x18\x05 \x03(\t\x1a\xef\x02\n\x07Request\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06method\x18\x02 \x01(\t\x12J\n\x07headers\x18\x03 \x03(\x0b\x32\x39.google.rpc.context.AttributeContext.Request.HeadersEntry\x12\x0c\n\x04path\x18\x04 \x01(\t\x12\x0c\n\x04host\x18\x05 \x01(\t\x12\x0e\n\x06scheme\x18\x06 \x01(\t\x12\r\n\x05query\x18\x07 \x01(\t\x12(\n\x04time\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04size\x18\n \x01(\x03\x12\x10\n\x08protocol\x18\x0b \x01(\t\x12\x0e\n\x06reason\x18\x0c \x01(\t\x12\x37\n\x04\x61uth\x18\r \x01(\x0b\x32).google.rpc.context.AttributeContext.Auth\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\x81\x02\n\x08Response\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x03\x12\x0c\n\x04size\x18\x02 \x01(\x03\x12K\n\x07headers\x18\x03 \x03(\x0b\x32:.google.rpc.context.AttributeContext.Response.HeadersEntry\x12(\n\x04time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x32\n\x0f\x62\x61\x63kend_latency\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\x90\x04\n\x08Resource\x12\x0f\n\x07service\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12I\n\x06labels\x18\x04 \x03(\x0b\x32\x39.google.rpc.context.AttributeContext.Resource.LabelsEntry\x12\x0b\n\x03uid\x18\x05 \x01(\t\x12S\n\x0b\x61nnotations\x18\x06 \x03(\x0b\x32>.google.rpc.context.AttributeContext.Resource.AnnotationsEntry\x12\x14\n\x0c\x64isplay_name\x18\x07 \x01(\t\x12/\n\x0b\x63reate_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x64\x65lete_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04\x65tag\x18\x0b \x01(\t\x12\x10\n\x08location\x18\x0c \x01(\t\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\x32\n\x10\x41nnotationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x8b\x01\n\x16\x63om.google.rpc.contextB\x15\x41ttributeContextProtoP\x01ZUgoogle.golang.org/genproto/googleapis/rpc/context/attribute_context;attribute_context\xf8\x01\x01\x62\x06proto3" -) - - -_ATTRIBUTECONTEXT = DESCRIPTOR.message_types_by_name["AttributeContext"] -_ATTRIBUTECONTEXT_PEER = _ATTRIBUTECONTEXT.nested_types_by_name["Peer"] -_ATTRIBUTECONTEXT_PEER_LABELSENTRY = _ATTRIBUTECONTEXT_PEER.nested_types_by_name[ - "LabelsEntry" -] -_ATTRIBUTECONTEXT_API = _ATTRIBUTECONTEXT.nested_types_by_name["Api"] -_ATTRIBUTECONTEXT_AUTH = _ATTRIBUTECONTEXT.nested_types_by_name["Auth"] -_ATTRIBUTECONTEXT_REQUEST = _ATTRIBUTECONTEXT.nested_types_by_name["Request"] -_ATTRIBUTECONTEXT_REQUEST_HEADERSENTRY = _ATTRIBUTECONTEXT_REQUEST.nested_types_by_name[ - "HeadersEntry" -] -_ATTRIBUTECONTEXT_RESPONSE = _ATTRIBUTECONTEXT.nested_types_by_name["Response"] -_ATTRIBUTECONTEXT_RESPONSE_HEADERSENTRY = ( - _ATTRIBUTECONTEXT_RESPONSE.nested_types_by_name["HeadersEntry"] -) -_ATTRIBUTECONTEXT_RESOURCE = _ATTRIBUTECONTEXT.nested_types_by_name["Resource"] -_ATTRIBUTECONTEXT_RESOURCE_LABELSENTRY = ( - _ATTRIBUTECONTEXT_RESOURCE.nested_types_by_name["LabelsEntry"] -) -_ATTRIBUTECONTEXT_RESOURCE_ANNOTATIONSENTRY = ( - _ATTRIBUTECONTEXT_RESOURCE.nested_types_by_name["AnnotationsEntry"] -) -AttributeContext = _reflection.GeneratedProtocolMessageType( - "AttributeContext", - (_message.Message,), - { - "Peer": _reflection.GeneratedProtocolMessageType( - "Peer", - (_message.Message,), - { - "LabelsEntry": _reflection.GeneratedProtocolMessageType( - "LabelsEntry", - (_message.Message,), - { - "DESCRIPTOR": _ATTRIBUTECONTEXT_PEER_LABELSENTRY, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Peer.LabelsEntry) - }, - ), - "DESCRIPTOR": _ATTRIBUTECONTEXT_PEER, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Peer) - }, - ), - "Api": _reflection.GeneratedProtocolMessageType( - "Api", - (_message.Message,), - { - "DESCRIPTOR": _ATTRIBUTECONTEXT_API, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Api) - }, - ), - "Auth": _reflection.GeneratedProtocolMessageType( - "Auth", - (_message.Message,), - { - "DESCRIPTOR": _ATTRIBUTECONTEXT_AUTH, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Auth) - }, - ), - "Request": _reflection.GeneratedProtocolMessageType( - "Request", - (_message.Message,), - { - "HeadersEntry": _reflection.GeneratedProtocolMessageType( - "HeadersEntry", - (_message.Message,), - { - "DESCRIPTOR": _ATTRIBUTECONTEXT_REQUEST_HEADERSENTRY, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Request.HeadersEntry) - }, - ), - "DESCRIPTOR": _ATTRIBUTECONTEXT_REQUEST, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Request) - }, - ), - "Response": _reflection.GeneratedProtocolMessageType( - "Response", - (_message.Message,), - { - "HeadersEntry": _reflection.GeneratedProtocolMessageType( - "HeadersEntry", - (_message.Message,), - { - "DESCRIPTOR": _ATTRIBUTECONTEXT_RESPONSE_HEADERSENTRY, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Response.HeadersEntry) - }, - ), - "DESCRIPTOR": _ATTRIBUTECONTEXT_RESPONSE, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Response) - }, - ), - "Resource": _reflection.GeneratedProtocolMessageType( - "Resource", - (_message.Message,), - { - "LabelsEntry": _reflection.GeneratedProtocolMessageType( - "LabelsEntry", - (_message.Message,), - { - "DESCRIPTOR": _ATTRIBUTECONTEXT_RESOURCE_LABELSENTRY, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Resource.LabelsEntry) - }, - ), - "AnnotationsEntry": _reflection.GeneratedProtocolMessageType( - "AnnotationsEntry", - (_message.Message,), - { - "DESCRIPTOR": _ATTRIBUTECONTEXT_RESOURCE_ANNOTATIONSENTRY, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Resource.AnnotationsEntry) - }, - ), - "DESCRIPTOR": _ATTRIBUTECONTEXT_RESOURCE, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext.Resource) - }, - ), - "DESCRIPTOR": _ATTRIBUTECONTEXT, - "__module__": "google.rpc.context.attribute_context_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.context.AttributeContext) - }, -) -_sym_db.RegisterMessage(AttributeContext) -_sym_db.RegisterMessage(AttributeContext.Peer) -_sym_db.RegisterMessage(AttributeContext.Peer.LabelsEntry) -_sym_db.RegisterMessage(AttributeContext.Api) -_sym_db.RegisterMessage(AttributeContext.Auth) -_sym_db.RegisterMessage(AttributeContext.Request) -_sym_db.RegisterMessage(AttributeContext.Request.HeadersEntry) -_sym_db.RegisterMessage(AttributeContext.Response) -_sym_db.RegisterMessage(AttributeContext.Response.HeadersEntry) -_sym_db.RegisterMessage(AttributeContext.Resource) -_sym_db.RegisterMessage(AttributeContext.Resource.LabelsEntry) -_sym_db.RegisterMessage(AttributeContext.Resource.AnnotationsEntry) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\026com.google.rpc.contextB\025AttributeContextProtoP\001ZUgoogle.golang.org/genproto/googleapis/rpc/context/attribute_context;attribute_context\370\001\001" - _ATTRIBUTECONTEXT_PEER_LABELSENTRY._options = None - _ATTRIBUTECONTEXT_PEER_LABELSENTRY._serialized_options = b"8\001" - _ATTRIBUTECONTEXT_REQUEST_HEADERSENTRY._options = None - _ATTRIBUTECONTEXT_REQUEST_HEADERSENTRY._serialized_options = b"8\001" - _ATTRIBUTECONTEXT_RESPONSE_HEADERSENTRY._options = None - _ATTRIBUTECONTEXT_RESPONSE_HEADERSENTRY._serialized_options = b"8\001" - _ATTRIBUTECONTEXT_RESOURCE_LABELSENTRY._options = None - _ATTRIBUTECONTEXT_RESOURCE_LABELSENTRY._serialized_options = b"8\001" - _ATTRIBUTECONTEXT_RESOURCE_ANNOTATIONSENTRY._options = None - _ATTRIBUTECONTEXT_RESOURCE_ANNOTATIONSENTRY._serialized_options = b"8\001" - _ATTRIBUTECONTEXT._serialized_start = 189 - _ATTRIBUTECONTEXT._serialized_end = 2240 - _ATTRIBUTECONTEXT_PEER._serialized_start = 682 - _ATTRIBUTECONTEXT_PEER._serialized_end = 872 - _ATTRIBUTECONTEXT_PEER_LABELSENTRY._serialized_start = 827 - _ATTRIBUTECONTEXT_PEER_LABELSENTRY._serialized_end = 872 - _ATTRIBUTECONTEXT_API._serialized_start = 874 - _ATTRIBUTECONTEXT_API._serialized_end = 950 - _ATTRIBUTECONTEXT_AUTH._serialized_start = 952 - _ATTRIBUTECONTEXT_AUTH._serialized_end = 1079 - _ATTRIBUTECONTEXT_REQUEST._serialized_start = 1082 - _ATTRIBUTECONTEXT_REQUEST._serialized_end = 1449 - _ATTRIBUTECONTEXT_REQUEST_HEADERSENTRY._serialized_start = 1403 - _ATTRIBUTECONTEXT_REQUEST_HEADERSENTRY._serialized_end = 1449 - _ATTRIBUTECONTEXT_RESPONSE._serialized_start = 1452 - _ATTRIBUTECONTEXT_RESPONSE._serialized_end = 1709 - _ATTRIBUTECONTEXT_RESPONSE_HEADERSENTRY._serialized_start = 1403 - _ATTRIBUTECONTEXT_RESPONSE_HEADERSENTRY._serialized_end = 1449 - _ATTRIBUTECONTEXT_RESOURCE._serialized_start = 1712 - _ATTRIBUTECONTEXT_RESOURCE._serialized_end = 2240 - _ATTRIBUTECONTEXT_RESOURCE_LABELSENTRY._serialized_start = 827 - _ATTRIBUTECONTEXT_RESOURCE_LABELSENTRY._serialized_end = 872 - _ATTRIBUTECONTEXT_RESOURCE_ANNOTATIONSENTRY._serialized_start = 2190 - _ATTRIBUTECONTEXT_RESOURCE_ANNOTATIONSENTRY._serialized_end = 2240 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/rpc/error_details.proto b/opensafely/_vendor/google/rpc/error_details.proto deleted file mode 100644 index c4d6c4b7..00000000 --- a/opensafely/_vendor/google/rpc/error_details.proto +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright 2020 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.rpc; - -import "google/protobuf/duration.proto"; - -option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails"; -option java_multiple_files = true; -option java_outer_classname = "ErrorDetailsProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - -// Describes when the clients can retry a failed request. Clients could ignore -// the recommendation here or retry when this information is missing from error -// responses. -// -// It's always recommended that clients should use exponential backoff when -// retrying. -// -// Clients should wait until `retry_delay` amount of time has passed since -// receiving the error response before retrying. If retrying requests also -// fail, clients should use an exponential backoff scheme to gradually increase -// the delay between retries based on `retry_delay`, until either a maximum -// number of retries have been reached or a maximum retry delay cap has been -// reached. -message RetryInfo { - // Clients should wait at least this long between retrying the same request. - google.protobuf.Duration retry_delay = 1; -} - -// Describes additional debugging info. -message DebugInfo { - // The stack trace entries indicating where the error occurred. - repeated string stack_entries = 1; - - // Additional debugging information provided by the server. - string detail = 2; -} - -// Describes how a quota check failed. -// -// For example if a daily limit was exceeded for the calling project, -// a service could respond with a QuotaFailure detail containing the project -// id and the description of the quota limit that was exceeded. If the -// calling project hasn't enabled the service in the developer console, then -// a service could respond with the project id and set `service_disabled` -// to true. -// -// Also see RetryInfo and Help types for other details about handling a -// quota failure. -message QuotaFailure { - // A message type used to describe a single quota violation. For example, a - // daily quota or a custom quota that was exceeded. - message Violation { - // The subject on which the quota check failed. - // For example, "clientip:" or "project:". - string subject = 1; - - // A description of how the quota check failed. Clients can use this - // description to find more about the quota configuration in the service's - // public documentation, or find the relevant quota limit to adjust through - // developer console. - // - // For example: "Service disabled" or "Daily Limit for read operations - // exceeded". - string description = 2; - } - - // Describes all quota violations. - repeated Violation violations = 1; -} - -// Describes the cause of the error with structured details. -// -// Example of an error when contacting the "pubsub.googleapis.com" API when it -// is not enabled: -// -// { "reason": "API_DISABLED" -// "domain": "googleapis.com" -// "metadata": { -// "resource": "projects/123", -// "service": "pubsub.googleapis.com" -// } -// } -// -// This response indicates that the pubsub.googleapis.com API is not enabled. -// -// Example of an error that is returned when attempting to create a Spanner -// instance in a region that is out of stock: -// -// { "reason": "STOCKOUT" -// "domain": "spanner.googleapis.com", -// "metadata": { -// "availableRegions": "us-central1,us-east2" -// } -// } -message ErrorInfo { - // The reason of the error. This is a constant value that identifies the - // proximate cause of the error. Error reasons are unique within a particular - // domain of errors. This should be at most 63 characters and match - // /[A-Z0-9_]+/. - string reason = 1; - - // The logical grouping to which the "reason" belongs. The error domain - // is typically the registered service name of the tool or product that - // generates the error. Example: "pubsub.googleapis.com". If the error is - // generated by some common infrastructure, the error domain must be a - // globally unique value that identifies the infrastructure. For Google API - // infrastructure, the error domain is "googleapis.com". - string domain = 2; - - // Additional structured details about this error. - // - // Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in - // length. When identifying the current value of an exceeded limit, the units - // should be contained in the key, not the value. For example, rather than - // {"instanceLimit": "100/request"}, should be returned as, - // {"instanceLimitPerRequest": "100"}, if the client exceeds the number of - // instances that can be created in a single (batch) request. - map metadata = 3; -} - -// Describes what preconditions have failed. -// -// For example, if an RPC failed because it required the Terms of Service to be -// acknowledged, it could list the terms of service violation in the -// PreconditionFailure message. -message PreconditionFailure { - // A message type used to describe a single precondition failure. - message Violation { - // The type of PreconditionFailure. We recommend using a service-specific - // enum type to define the supported precondition violation subjects. For - // example, "TOS" for "Terms of Service violation". - string type = 1; - - // The subject, relative to the type, that failed. - // For example, "google.com/cloud" relative to the "TOS" type would indicate - // which terms of service is being referenced. - string subject = 2; - - // A description of how the precondition failed. Developers can use this - // description to understand how to fix the failure. - // - // For example: "Terms of service not accepted". - string description = 3; - } - - // Describes all precondition violations. - repeated Violation violations = 1; -} - -// Describes violations in a client request. This error type focuses on the -// syntactic aspects of the request. -message BadRequest { - // A message type used to describe a single bad request field. - message FieldViolation { - // A path leading to a field in the request body. The value will be a - // sequence of dot-separated identifiers that identify a protocol buffer - // field. E.g., "field_violations.field" would identify this field. - string field = 1; - - // A description of why the request element is bad. - string description = 2; - } - - // Describes all violations in a client request. - repeated FieldViolation field_violations = 1; -} - -// Contains metadata about the request that clients can attach when filing a bug -// or providing other forms of feedback. -message RequestInfo { - // An opaque string that should only be interpreted by the service generating - // it. For example, it can be used to identify requests in the service's logs. - string request_id = 1; - - // Any data that was used to serve this request. For example, an encrypted - // stack trace that can be sent back to the service provider for debugging. - string serving_data = 2; -} - -// Describes the resource that is being accessed. -message ResourceInfo { - // A name for the type of resource being accessed, e.g. "sql table", - // "cloud storage bucket", "file", "Google calendar"; or the type URL - // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". - string resource_type = 1; - - // The name of the resource being accessed. For example, a shared calendar - // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current - // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. - string resource_name = 2; - - // The owner of the resource (optional). - // For example, "user:" or "project:". - string owner = 3; - - // Describes what error is encountered when accessing this resource. - // For example, updating a cloud project may require the `writer` permission - // on the developer console project. - string description = 4; -} - -// Provides links to documentation or for performing an out of band action. -// -// For example, if a quota check failed with an error indicating the calling -// project hasn't enabled the accessed service, this can contain a URL pointing -// directly to the right place in the developer console to flip the bit. -message Help { - // Describes a URL link. - message Link { - // Describes what the link offers. - string description = 1; - - // The URL of the link. - string url = 2; - } - - // URL(s) pointing to additional information on handling the current error. - repeated Link links = 1; -} - -// Provides a localized error message that is safe to return to the user -// which can be attached to an RPC error. -message LocalizedMessage { - // The locale used following the specification defined at - // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. - // Examples are: "en-US", "fr-CH", "es-MX" - string locale = 1; - - // The localized error message in the above locale. - string message = 2; -} diff --git a/opensafely/_vendor/google/rpc/error_details_pb2.py b/opensafely/_vendor/google/rpc/error_details_pb2.py deleted file mode 100644 index 7393eece..00000000 --- a/opensafely/_vendor/google/rpc/error_details_pb2.py +++ /dev/null @@ -1,250 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/rpc/error_details.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1egoogle/rpc/error_details.proto\x12\ngoogle.rpc\x1a\x1egoogle/protobuf/duration.proto";\n\tRetryInfo\x12.\n\x0bretry_delay\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration"2\n\tDebugInfo\x12\x15\n\rstack_entries\x18\x01 \x03(\t\x12\x0e\n\x06\x64\x65tail\x18\x02 \x01(\t"y\n\x0cQuotaFailure\x12\x36\n\nviolations\x18\x01 \x03(\x0b\x32".google.rpc.QuotaFailure.Violation\x1a\x31\n\tViolation\x12\x0f\n\x07subject\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t"\x93\x01\n\tErrorInfo\x12\x0e\n\x06reason\x18\x01 \x01(\t\x12\x0e\n\x06\x64omain\x18\x02 \x01(\t\x12\x35\n\x08metadata\x18\x03 \x03(\x0b\x32#.google.rpc.ErrorInfo.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x95\x01\n\x13PreconditionFailure\x12=\n\nviolations\x18\x01 \x03(\x0b\x32).google.rpc.PreconditionFailure.Violation\x1a?\n\tViolation\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0f\n\x07subject\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t"\x83\x01\n\nBadRequest\x12?\n\x10\x66ield_violations\x18\x01 \x03(\x0b\x32%.google.rpc.BadRequest.FieldViolation\x1a\x34\n\x0e\x46ieldViolation\x12\r\n\x05\x66ield\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t"7\n\x0bRequestInfo\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x14\n\x0cserving_data\x18\x02 \x01(\t"`\n\x0cResourceInfo\x12\x15\n\rresource_type\x18\x01 \x01(\t\x12\x15\n\rresource_name\x18\x02 \x01(\t\x12\r\n\x05owner\x18\x03 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x04 \x01(\t"V\n\x04Help\x12$\n\x05links\x18\x01 \x03(\x0b\x32\x15.google.rpc.Help.Link\x1a(\n\x04Link\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t"3\n\x10LocalizedMessage\x12\x0e\n\x06locale\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\tBl\n\x0e\x63om.google.rpcB\x11\x45rrorDetailsProtoP\x01Z?google.golang.org/genproto/googleapis/rpc/errdetails;errdetails\xa2\x02\x03RPCb\x06proto3' -) - - -_RETRYINFO = DESCRIPTOR.message_types_by_name["RetryInfo"] -_DEBUGINFO = DESCRIPTOR.message_types_by_name["DebugInfo"] -_QUOTAFAILURE = DESCRIPTOR.message_types_by_name["QuotaFailure"] -_QUOTAFAILURE_VIOLATION = _QUOTAFAILURE.nested_types_by_name["Violation"] -_ERRORINFO = DESCRIPTOR.message_types_by_name["ErrorInfo"] -_ERRORINFO_METADATAENTRY = _ERRORINFO.nested_types_by_name["MetadataEntry"] -_PRECONDITIONFAILURE = DESCRIPTOR.message_types_by_name["PreconditionFailure"] -_PRECONDITIONFAILURE_VIOLATION = _PRECONDITIONFAILURE.nested_types_by_name["Violation"] -_BADREQUEST = DESCRIPTOR.message_types_by_name["BadRequest"] -_BADREQUEST_FIELDVIOLATION = _BADREQUEST.nested_types_by_name["FieldViolation"] -_REQUESTINFO = DESCRIPTOR.message_types_by_name["RequestInfo"] -_RESOURCEINFO = DESCRIPTOR.message_types_by_name["ResourceInfo"] -_HELP = DESCRIPTOR.message_types_by_name["Help"] -_HELP_LINK = _HELP.nested_types_by_name["Link"] -_LOCALIZEDMESSAGE = DESCRIPTOR.message_types_by_name["LocalizedMessage"] -RetryInfo = _reflection.GeneratedProtocolMessageType( - "RetryInfo", - (_message.Message,), - { - "DESCRIPTOR": _RETRYINFO, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.RetryInfo) - }, -) -_sym_db.RegisterMessage(RetryInfo) - -DebugInfo = _reflection.GeneratedProtocolMessageType( - "DebugInfo", - (_message.Message,), - { - "DESCRIPTOR": _DEBUGINFO, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.DebugInfo) - }, -) -_sym_db.RegisterMessage(DebugInfo) - -QuotaFailure = _reflection.GeneratedProtocolMessageType( - "QuotaFailure", - (_message.Message,), - { - "Violation": _reflection.GeneratedProtocolMessageType( - "Violation", - (_message.Message,), - { - "DESCRIPTOR": _QUOTAFAILURE_VIOLATION, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.QuotaFailure.Violation) - }, - ), - "DESCRIPTOR": _QUOTAFAILURE, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.QuotaFailure) - }, -) -_sym_db.RegisterMessage(QuotaFailure) -_sym_db.RegisterMessage(QuotaFailure.Violation) - -ErrorInfo = _reflection.GeneratedProtocolMessageType( - "ErrorInfo", - (_message.Message,), - { - "MetadataEntry": _reflection.GeneratedProtocolMessageType( - "MetadataEntry", - (_message.Message,), - { - "DESCRIPTOR": _ERRORINFO_METADATAENTRY, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.ErrorInfo.MetadataEntry) - }, - ), - "DESCRIPTOR": _ERRORINFO, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.ErrorInfo) - }, -) -_sym_db.RegisterMessage(ErrorInfo) -_sym_db.RegisterMessage(ErrorInfo.MetadataEntry) - -PreconditionFailure = _reflection.GeneratedProtocolMessageType( - "PreconditionFailure", - (_message.Message,), - { - "Violation": _reflection.GeneratedProtocolMessageType( - "Violation", - (_message.Message,), - { - "DESCRIPTOR": _PRECONDITIONFAILURE_VIOLATION, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.PreconditionFailure.Violation) - }, - ), - "DESCRIPTOR": _PRECONDITIONFAILURE, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.PreconditionFailure) - }, -) -_sym_db.RegisterMessage(PreconditionFailure) -_sym_db.RegisterMessage(PreconditionFailure.Violation) - -BadRequest = _reflection.GeneratedProtocolMessageType( - "BadRequest", - (_message.Message,), - { - "FieldViolation": _reflection.GeneratedProtocolMessageType( - "FieldViolation", - (_message.Message,), - { - "DESCRIPTOR": _BADREQUEST_FIELDVIOLATION, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.BadRequest.FieldViolation) - }, - ), - "DESCRIPTOR": _BADREQUEST, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.BadRequest) - }, -) -_sym_db.RegisterMessage(BadRequest) -_sym_db.RegisterMessage(BadRequest.FieldViolation) - -RequestInfo = _reflection.GeneratedProtocolMessageType( - "RequestInfo", - (_message.Message,), - { - "DESCRIPTOR": _REQUESTINFO, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.RequestInfo) - }, -) -_sym_db.RegisterMessage(RequestInfo) - -ResourceInfo = _reflection.GeneratedProtocolMessageType( - "ResourceInfo", - (_message.Message,), - { - "DESCRIPTOR": _RESOURCEINFO, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.ResourceInfo) - }, -) -_sym_db.RegisterMessage(ResourceInfo) - -Help = _reflection.GeneratedProtocolMessageType( - "Help", - (_message.Message,), - { - "Link": _reflection.GeneratedProtocolMessageType( - "Link", - (_message.Message,), - { - "DESCRIPTOR": _HELP_LINK, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.Help.Link) - }, - ), - "DESCRIPTOR": _HELP, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.Help) - }, -) -_sym_db.RegisterMessage(Help) -_sym_db.RegisterMessage(Help.Link) - -LocalizedMessage = _reflection.GeneratedProtocolMessageType( - "LocalizedMessage", - (_message.Message,), - { - "DESCRIPTOR": _LOCALIZEDMESSAGE, - "__module__": "google.rpc.error_details_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.LocalizedMessage) - }, -) -_sym_db.RegisterMessage(LocalizedMessage) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.rpcB\021ErrorDetailsProtoP\001Z?google.golang.org/genproto/googleapis/rpc/errdetails;errdetails\242\002\003RPC" - _ERRORINFO_METADATAENTRY._options = None - _ERRORINFO_METADATAENTRY._serialized_options = b"8\001" - _RETRYINFO._serialized_start = 78 - _RETRYINFO._serialized_end = 137 - _DEBUGINFO._serialized_start = 139 - _DEBUGINFO._serialized_end = 189 - _QUOTAFAILURE._serialized_start = 191 - _QUOTAFAILURE._serialized_end = 312 - _QUOTAFAILURE_VIOLATION._serialized_start = 263 - _QUOTAFAILURE_VIOLATION._serialized_end = 312 - _ERRORINFO._serialized_start = 315 - _ERRORINFO._serialized_end = 462 - _ERRORINFO_METADATAENTRY._serialized_start = 415 - _ERRORINFO_METADATAENTRY._serialized_end = 462 - _PRECONDITIONFAILURE._serialized_start = 465 - _PRECONDITIONFAILURE._serialized_end = 614 - _PRECONDITIONFAILURE_VIOLATION._serialized_start = 551 - _PRECONDITIONFAILURE_VIOLATION._serialized_end = 614 - _BADREQUEST._serialized_start = 617 - _BADREQUEST._serialized_end = 748 - _BADREQUEST_FIELDVIOLATION._serialized_start = 696 - _BADREQUEST_FIELDVIOLATION._serialized_end = 748 - _REQUESTINFO._serialized_start = 750 - _REQUESTINFO._serialized_end = 805 - _RESOURCEINFO._serialized_start = 807 - _RESOURCEINFO._serialized_end = 903 - _HELP._serialized_start = 905 - _HELP._serialized_end = 991 - _HELP_LINK._serialized_start = 951 - _HELP_LINK._serialized_end = 991 - _LOCALIZEDMESSAGE._serialized_start = 993 - _LOCALIZEDMESSAGE._serialized_end = 1044 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/rpc/status.proto b/opensafely/_vendor/google/rpc/status.proto deleted file mode 100644 index 3b1f7a93..00000000 --- a/opensafely/_vendor/google/rpc/status.proto +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.rpc; - -import "google/protobuf/any.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; -option java_multiple_files = true; -option java_outer_classname = "StatusProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - -// The `Status` type defines a logical error model that is suitable for -// different programming environments, including REST APIs and RPC APIs. It is -// used by [gRPC](https://github.com/grpc). Each `Status` message contains -// three pieces of data: error code, error message, and error details. -// -// You can find out more about this error model and how to work with it in the -// [API Design Guide](https://cloud.google.com/apis/design/errors). -message Status { - // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. - int32 code = 1; - - // A developer-facing error message, which should be in English. Any - // user-facing error message should be localized and sent in the - // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. - string message = 2; - - // A list of messages that carry the error details. There is a common set of - // message types for APIs to use. - repeated google.protobuf.Any details = 3; -} diff --git a/opensafely/_vendor/google/rpc/status_pb2.py b/opensafely/_vendor/google/rpc/status_pb2.py deleted file mode 100644 index 7b680c1e..00000000 --- a/opensafely/_vendor/google/rpc/status_pb2.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/rpc/status.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x17google/rpc/status.proto\x12\ngoogle.rpc\x1a\x19google/protobuf/any.proto"N\n\x06Status\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t\x12%\n\x07\x64\x65tails\x18\x03 \x03(\x0b\x32\x14.google.protobuf.AnyBa\n\x0e\x63om.google.rpcB\x0bStatusProtoP\x01Z7google.golang.org/genproto/googleapis/rpc/status;status\xf8\x01\x01\xa2\x02\x03RPCb\x06proto3' -) - - -_STATUS = DESCRIPTOR.message_types_by_name["Status"] -Status = _reflection.GeneratedProtocolMessageType( - "Status", - (_message.Message,), - { - "DESCRIPTOR": _STATUS, - "__module__": "google.rpc.status_pb2" - # @@protoc_insertion_point(class_scope:google.rpc.Status) - }, -) -_sym_db.RegisterMessage(Status) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\016com.google.rpcB\013StatusProtoP\001Z7google.golang.org/genproto/googleapis/rpc/status;status\370\001\001\242\002\003RPC" - _STATUS._serialized_start = 66 - _STATUS._serialized_end = 144 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/__init__.py b/opensafely/_vendor/google/type/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/google/type/calendar_period.proto b/opensafely/_vendor/google/type/calendar_period.proto deleted file mode 100644 index 82f5690b..00000000 --- a/opensafely/_vendor/google/type/calendar_period.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option go_package = "google.golang.org/genproto/googleapis/type/calendarperiod;calendarperiod"; -option java_multiple_files = true; -option java_outer_classname = "CalendarPeriodProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// A `CalendarPeriod` represents the abstract concept of a time period that has -// a canonical start. Grammatically, "the start of the current -// `CalendarPeriod`." All calendar times begin at midnight UTC. -enum CalendarPeriod { - // Undefined period, raises an error. - CALENDAR_PERIOD_UNSPECIFIED = 0; - - // A day. - DAY = 1; - - // A week. Weeks begin on Monday, following - // [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). - WEEK = 2; - - // A fortnight. The first calendar fortnight of the year begins at the start - // of week 1 according to - // [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). - FORTNIGHT = 3; - - // A month. - MONTH = 4; - - // A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each - // year. - QUARTER = 5; - - // A half-year. Half-years start on dates 1-Jan and 1-Jul. - HALF = 6; - - // A year. - YEAR = 7; -} diff --git a/opensafely/_vendor/google/type/calendar_period_pb2.py b/opensafely/_vendor/google/type/calendar_period_pb2.py deleted file mode 100644 index 6235d185..00000000 --- a/opensafely/_vendor/google/type/calendar_period_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/calendar_period.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n!google/type/calendar_period.proto\x12\x0bgoogle.type*\x7f\n\x0e\x43\x61lendarPeriod\x12\x1f\n\x1b\x43\x41LENDAR_PERIOD_UNSPECIFIED\x10\x00\x12\x07\n\x03\x44\x41Y\x10\x01\x12\x08\n\x04WEEK\x10\x02\x12\r\n\tFORTNIGHT\x10\x03\x12\t\n\x05MONTH\x10\x04\x12\x0b\n\x07QUARTER\x10\x05\x12\x08\n\x04HALF\x10\x06\x12\x08\n\x04YEAR\x10\x07\x42x\n\x0f\x63om.google.typeB\x13\x43\x61lendarPeriodProtoP\x01ZHgoogle.golang.org/genproto/googleapis/type/calendarperiod;calendarperiod\xa2\x02\x03GTPb\x06proto3" -) - -_CALENDARPERIOD = DESCRIPTOR.enum_types_by_name["CalendarPeriod"] -CalendarPeriod = enum_type_wrapper.EnumTypeWrapper(_CALENDARPERIOD) -CALENDAR_PERIOD_UNSPECIFIED = 0 -DAY = 1 -WEEK = 2 -FORTNIGHT = 3 -MONTH = 4 -QUARTER = 5 -HALF = 6 -YEAR = 7 - - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\023CalendarPeriodProtoP\001ZHgoogle.golang.org/genproto/googleapis/type/calendarperiod;calendarperiod\242\002\003GTP" - _CALENDARPERIOD._serialized_start = 50 - _CALENDARPERIOD._serialized_end = 177 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/color.proto b/opensafely/_vendor/google/type/color.proto deleted file mode 100644 index 5dc85a6a..00000000 --- a/opensafely/_vendor/google/type/color.proto +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -import "google/protobuf/wrappers.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/color;color"; -option java_multiple_files = true; -option java_outer_classname = "ColorProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a color in the RGBA color space. This representation is designed -// for simplicity of conversion to/from color representations in various -// languages over compactness. For example, the fields of this representation -// can be trivially provided to the constructor of `java.awt.Color` in Java; it -// can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` -// method in iOS; and, with just a little work, it can be easily formatted into -// a CSS `rgba()` string in JavaScript. -// -// This reference page doesn't carry information about the absolute color -// space -// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, -// DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color -// space. -// -// When color equality needs to be decided, implementations, unless -// documented otherwise, treat two colors as equal if all their red, -// green, blue, and alpha values each differ by at most 1e-5. -// -// Example (Java): -// -// import com.google.type.Color; -// -// // ... -// public static java.awt.Color fromProto(Color protocolor) { -// float alpha = protocolor.hasAlpha() -// ? protocolor.getAlpha().getValue() -// : 1.0; -// -// return new java.awt.Color( -// protocolor.getRed(), -// protocolor.getGreen(), -// protocolor.getBlue(), -// alpha); -// } -// -// public static Color toProto(java.awt.Color color) { -// float red = (float) color.getRed(); -// float green = (float) color.getGreen(); -// float blue = (float) color.getBlue(); -// float denominator = 255.0; -// Color.Builder resultBuilder = -// Color -// .newBuilder() -// .setRed(red / denominator) -// .setGreen(green / denominator) -// .setBlue(blue / denominator); -// int alpha = color.getAlpha(); -// if (alpha != 255) { -// result.setAlpha( -// FloatValue -// .newBuilder() -// .setValue(((float) alpha) / denominator) -// .build()); -// } -// return resultBuilder.build(); -// } -// // ... -// -// Example (iOS / Obj-C): -// -// // ... -// static UIColor* fromProto(Color* protocolor) { -// float red = [protocolor red]; -// float green = [protocolor green]; -// float blue = [protocolor blue]; -// FloatValue* alpha_wrapper = [protocolor alpha]; -// float alpha = 1.0; -// if (alpha_wrapper != nil) { -// alpha = [alpha_wrapper value]; -// } -// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; -// } -// -// static Color* toProto(UIColor* color) { -// CGFloat red, green, blue, alpha; -// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { -// return nil; -// } -// Color* result = [[Color alloc] init]; -// [result setRed:red]; -// [result setGreen:green]; -// [result setBlue:blue]; -// if (alpha <= 0.9999) { -// [result setAlpha:floatWrapperWithValue(alpha)]; -// } -// [result autorelease]; -// return result; -// } -// // ... -// -// Example (JavaScript): -// -// // ... -// -// var protoToCssColor = function(rgb_color) { -// var redFrac = rgb_color.red || 0.0; -// var greenFrac = rgb_color.green || 0.0; -// var blueFrac = rgb_color.blue || 0.0; -// var red = Math.floor(redFrac * 255); -// var green = Math.floor(greenFrac * 255); -// var blue = Math.floor(blueFrac * 255); -// -// if (!('alpha' in rgb_color)) { -// return rgbToCssColor(red, green, blue); -// } -// -// var alphaFrac = rgb_color.alpha.value || 0.0; -// var rgbParams = [red, green, blue].join(','); -// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); -// }; -// -// var rgbToCssColor = function(red, green, blue) { -// var rgbNumber = new Number((red << 16) | (green << 8) | blue); -// var hexString = rgbNumber.toString(16); -// var missingZeros = 6 - hexString.length; -// var resultBuilder = ['#']; -// for (var i = 0; i < missingZeros; i++) { -// resultBuilder.push('0'); -// } -// resultBuilder.push(hexString); -// return resultBuilder.join(''); -// }; -// -// // ... -message Color { - // The amount of red in the color as a value in the interval [0, 1]. - float red = 1; - - // The amount of green in the color as a value in the interval [0, 1]. - float green = 2; - - // The amount of blue in the color as a value in the interval [0, 1]. - float blue = 3; - - // The fraction of this color that should be applied to the pixel. That is, - // the final pixel color is defined by the equation: - // - // `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` - // - // This means that a value of 1.0 corresponds to a solid color, whereas - // a value of 0.0 corresponds to a completely transparent color. This - // uses a wrapper message rather than a simple float scalar so that it is - // possible to distinguish between a default value and the value being unset. - // If omitted, this color object is rendered as a solid color - // (as if the alpha value had been explicitly given a value of 1.0). - google.protobuf.FloatValue alpha = 4; -} diff --git a/opensafely/_vendor/google/type/color_pb2.py b/opensafely/_vendor/google/type/color_pb2.py deleted file mode 100644 index ef6e0fdb..00000000 --- a/opensafely/_vendor/google/type/color_pb2.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/color.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x17google/type/color.proto\x12\x0bgoogle.type\x1a\x1egoogle/protobuf/wrappers.proto"]\n\x05\x43olor\x12\x0b\n\x03red\x18\x01 \x01(\x02\x12\r\n\x05green\x18\x02 \x01(\x02\x12\x0c\n\x04\x62lue\x18\x03 \x01(\x02\x12*\n\x05\x61lpha\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.FloatValueB`\n\x0f\x63om.google.typeB\nColorProtoP\x01Z6google.golang.org/genproto/googleapis/type/color;color\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_COLOR = DESCRIPTOR.message_types_by_name["Color"] -Color = _reflection.GeneratedProtocolMessageType( - "Color", - (_message.Message,), - { - "DESCRIPTOR": _COLOR, - "__module__": "google.type.color_pb2" - # @@protoc_insertion_point(class_scope:google.type.Color) - }, -) -_sym_db.RegisterMessage(Color) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\nColorProtoP\001Z6google.golang.org/genproto/googleapis/type/color;color\370\001\001\242\002\003GTP" - _COLOR._serialized_start = 72 - _COLOR._serialized_end = 165 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/date.proto b/opensafely/_vendor/google/type/date.proto deleted file mode 100644 index e4e730e6..00000000 --- a/opensafely/_vendor/google/type/date.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/date;date"; -option java_multiple_files = true; -option java_outer_classname = "DateProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a whole or partial calendar date, such as a birthday. The time of -// day and time zone are either specified elsewhere or are insignificant. The -// date is relative to the Gregorian Calendar. This can represent one of the -// following: -// -// * A full date, with non-zero year, month, and day values -// * A month and day value, with a zero year, such as an anniversary -// * A year on its own, with zero month and day values -// * A year and month value, with a zero day, such as a credit card expiration -// date -// -// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and -// `google.protobuf.Timestamp`. -message Date { - // Year of the date. Must be from 1 to 9999, or 0 to specify a date without - // a year. - int32 year = 1; - - // Month of a year. Must be from 1 to 12, or 0 to specify a year without a - // month and day. - int32 month = 2; - - // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 - // to specify a year by itself or a year and month where the day isn't - // significant. - int32 day = 3; -} diff --git a/opensafely/_vendor/google/type/date_pb2.py b/opensafely/_vendor/google/type/date_pb2.py deleted file mode 100644 index 36960630..00000000 --- a/opensafely/_vendor/google/type/date_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/date.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x16google/type/date.proto\x12\x0bgoogle.type"0\n\x04\x44\x61te\x12\x0c\n\x04year\x18\x01 \x01(\x05\x12\r\n\x05month\x18\x02 \x01(\x05\x12\x0b\n\x03\x64\x61y\x18\x03 \x01(\x05\x42]\n\x0f\x63om.google.typeB\tDateProtoP\x01Z4google.golang.org/genproto/googleapis/type/date;date\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_DATE = DESCRIPTOR.message_types_by_name["Date"] -Date = _reflection.GeneratedProtocolMessageType( - "Date", - (_message.Message,), - { - "DESCRIPTOR": _DATE, - "__module__": "google.type.date_pb2" - # @@protoc_insertion_point(class_scope:google.type.Date) - }, -) -_sym_db.RegisterMessage(Date) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\tDateProtoP\001Z4google.golang.org/genproto/googleapis/type/date;date\370\001\001\242\002\003GTP" - _DATE._serialized_start = 39 - _DATE._serialized_end = 87 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/datetime.proto b/opensafely/_vendor/google/type/datetime.proto deleted file mode 100644 index cfed85d7..00000000 --- a/opensafely/_vendor/google/type/datetime.proto +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -import "google/protobuf/duration.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/datetime;datetime"; -option java_multiple_files = true; -option java_outer_classname = "DateTimeProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents civil time (or occasionally physical time). -// -// This type can represent a civil time in one of a few possible ways: -// -// * When utc_offset is set and time_zone is unset: a civil time on a calendar -// day with a particular offset from UTC. -// * When time_zone is set and utc_offset is unset: a civil time on a calendar -// day in a particular time zone. -// * When neither time_zone nor utc_offset is set: a civil time on a calendar -// day in local time. -// -// The date is relative to the Proleptic Gregorian Calendar. -// -// If year is 0, the DateTime is considered not to have a specific year. month -// and day must have valid, non-zero values. -// -// This type may also be used to represent a physical time if all the date and -// time fields are set and either case of the `time_offset` oneof is set. -// Consider using `Timestamp` message for physical time instead. If your use -// case also would like to store the user's timezone, that can be done in -// another field. -// -// This type is more flexible than some applications may want. Make sure to -// document and validate your application's limitations. -message DateTime { - // Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a - // datetime without a year. - int32 year = 1; - - // Required. Month of year. Must be from 1 to 12. - int32 month = 2; - - // Required. Day of month. Must be from 1 to 31 and valid for the year and - // month. - int32 day = 3; - - // Required. Hours of day in 24 hour format. Should be from 0 to 23. An API - // may choose to allow the value "24:00:00" for scenarios like business - // closing time. - int32 hours = 4; - - // Required. Minutes of hour of day. Must be from 0 to 59. - int32 minutes = 5; - - // Required. Seconds of minutes of the time. Must normally be from 0 to 59. An - // API may allow the value 60 if it allows leap-seconds. - int32 seconds = 6; - - // Required. Fractions of seconds in nanoseconds. Must be from 0 to - // 999,999,999. - int32 nanos = 7; - - // Optional. Specifies either the UTC offset or the time zone of the DateTime. - // Choose carefully between them, considering that time zone data may change - // in the future (for example, a country modifies their DST start/end dates, - // and future DateTimes in the affected range had already been stored). - // If omitted, the DateTime is considered to be in local time. - oneof time_offset { - // UTC offset. Must be whole seconds, between -18 hours and +18 hours. - // For example, a UTC offset of -4:00 would be represented as - // { seconds: -14400 }. - google.protobuf.Duration utc_offset = 8; - - // Time zone. - TimeZone time_zone = 9; - } -} - -// Represents a time zone from the -// [IANA Time Zone Database](https://www.iana.org/time-zones). -message TimeZone { - // IANA Time Zone Database time zone, e.g. "America/New_York". - string id = 1; - - // Optional. IANA Time Zone Database version number, e.g. "2019a". - string version = 2; -} diff --git a/opensafely/_vendor/google/type/datetime_pb2.py b/opensafely/_vendor/google/type/datetime_pb2.py deleted file mode 100644 index 2dac707a..00000000 --- a/opensafely/_vendor/google/type/datetime_pb2.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/datetime.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1agoogle/type/datetime.proto\x12\x0bgoogle.type\x1a\x1egoogle/protobuf/duration.proto"\xe0\x01\n\x08\x44\x61teTime\x12\x0c\n\x04year\x18\x01 \x01(\x05\x12\r\n\x05month\x18\x02 \x01(\x05\x12\x0b\n\x03\x64\x61y\x18\x03 \x01(\x05\x12\r\n\x05hours\x18\x04 \x01(\x05\x12\x0f\n\x07minutes\x18\x05 \x01(\x05\x12\x0f\n\x07seconds\x18\x06 \x01(\x05\x12\r\n\x05nanos\x18\x07 \x01(\x05\x12/\n\nutc_offset\x18\x08 \x01(\x0b\x32\x19.google.protobuf.DurationH\x00\x12*\n\ttime_zone\x18\t \x01(\x0b\x32\x15.google.type.TimeZoneH\x00\x42\r\n\x0btime_offset"\'\n\x08TimeZone\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\tBi\n\x0f\x63om.google.typeB\rDateTimeProtoP\x01Zgoogle.golang.org/genproto/googleapis/type/dayofweek;dayofweek\xa2\x02\x03GTPb\x06proto3" -) - -_DAYOFWEEK = DESCRIPTOR.enum_types_by_name["DayOfWeek"] -DayOfWeek = enum_type_wrapper.EnumTypeWrapper(_DAYOFWEEK) -DAY_OF_WEEK_UNSPECIFIED = 0 -MONDAY = 1 -TUESDAY = 2 -WEDNESDAY = 3 -THURSDAY = 4 -FRIDAY = 5 -SATURDAY = 6 -SUNDAY = 7 - - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\016DayOfWeekProtoP\001Z>google.golang.org/genproto/googleapis/type/dayofweek;dayofweek\242\002\003GTP" - _DAYOFWEEK._serialized_start = 45 - _DAYOFWEEK._serialized_end = 177 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/decimal.proto b/opensafely/_vendor/google/type/decimal.proto deleted file mode 100644 index beb18a5d..00000000 --- a/opensafely/_vendor/google/type/decimal.proto +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/decimal;decimal"; -option java_multiple_files = true; -option java_outer_classname = "DecimalProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// A representation of a decimal value, such as 2.5. Clients may convert values -// into language-native decimal formats, such as Java's [BigDecimal][] or -// Python's [decimal.Decimal][]. -// -// [BigDecimal]: -// https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html -// [decimal.Decimal]: https://docs.python.org/3/library/decimal.html -message Decimal { - // The decimal value, as a string. - // - // The string representation consists of an optional sign, `+` (`U+002B`) - // or `-` (`U+002D`), followed by a sequence of zero or more decimal digits - // ("the integer"), optionally followed by a fraction, optionally followed - // by an exponent. - // - // The fraction consists of a decimal point followed by zero or more decimal - // digits. The string must contain at least one digit in either the integer - // or the fraction. The number formed by the sign, the integer and the - // fraction is referred to as the significand. - // - // The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`) - // followed by one or more decimal digits. - // - // Services **should** normalize decimal values before storing them by: - // - // - Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`). - // - Replacing a zero-length integer value with `0` (`.5` -> `0.5`). - // - Coercing the exponent character to lower-case (`2.5E8` -> `2.5e8`). - // - Removing an explicitly-provided zero exponent (`2.5e0` -> `2.5`). - // - // Services **may** perform additional normalization based on its own needs - // and the internal decimal implementation selected, such as shifting the - // decimal point and exponent value together (example: `2.5e-1` <-> `0.25`). - // Additionally, services **may** preserve trailing zeroes in the fraction - // to indicate increased precision, but are not required to do so. - // - // Note that only the `.` character is supported to divide the integer - // and the fraction; `,` **should not** be supported regardless of locale. - // Additionally, thousand separators **should not** be supported. If a - // service does support them, values **must** be normalized. - // - // The ENBF grammar is: - // - // DecimalString = - // [Sign] Significand [Exponent]; - // - // Sign = '+' | '-'; - // - // Significand = - // Digits ['.'] [Digits] | [Digits] '.' Digits; - // - // Exponent = ('e' | 'E') [Sign] Digits; - // - // Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' }; - // - // Services **should** clearly document the range of supported values, the - // maximum supported precision (total number of digits), and, if applicable, - // the scale (number of digits after the decimal point), as well as how it - // behaves when receiving out-of-bounds values. - // - // Services **may** choose to accept values passed as input even when the - // value has a higher precision or scale than the service supports, and - // **should** round the value to fit the supported scale. Alternatively, the - // service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC) - // if precision would be lost. - // - // Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in - // gRPC) if the service receives a value outside of the supported range. - string value = 1; -} diff --git a/opensafely/_vendor/google/type/decimal_pb2.py b/opensafely/_vendor/google/type/decimal_pb2.py deleted file mode 100644 index e27f163e..00000000 --- a/opensafely/_vendor/google/type/decimal_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/decimal.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x19google/type/decimal.proto\x12\x0bgoogle.type"\x18\n\x07\x44\x65\x63imal\x12\r\n\x05value\x18\x01 \x01(\tBf\n\x0f\x63om.google.typeB\x0c\x44\x65\x63imalProtoP\x01Z:google.golang.org/genproto/googleapis/type/decimal;decimal\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_DECIMAL = DESCRIPTOR.message_types_by_name["Decimal"] -Decimal = _reflection.GeneratedProtocolMessageType( - "Decimal", - (_message.Message,), - { - "DESCRIPTOR": _DECIMAL, - "__module__": "google.type.decimal_pb2" - # @@protoc_insertion_point(class_scope:google.type.Decimal) - }, -) -_sym_db.RegisterMessage(Decimal) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\014DecimalProtoP\001Z:google.golang.org/genproto/googleapis/type/decimal;decimal\370\001\001\242\002\003GTP" - _DECIMAL._serialized_start = 42 - _DECIMAL._serialized_end = 66 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/expr.proto b/opensafely/_vendor/google/type/expr.proto deleted file mode 100644 index af0778cf..00000000 --- a/opensafely/_vendor/google/type/expr.proto +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option go_package = "google.golang.org/genproto/googleapis/type/expr;expr"; -option java_multiple_files = true; -option java_outer_classname = "ExprProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a textual expression in the Common Expression Language (CEL) -// syntax. CEL is a C-like expression language. The syntax and semantics of CEL -// are documented at https://github.com/google/cel-spec. -// -// Example (Comparison): -// -// title: "Summary size limit" -// description: "Determines if a summary is less than 100 chars" -// expression: "document.summary.size() < 100" -// -// Example (Equality): -// -// title: "Requestor is owner" -// description: "Determines if requestor is the document owner" -// expression: "document.owner == request.auth.claims.email" -// -// Example (Logic): -// -// title: "Public documents" -// description: "Determine whether the document should be publicly visible" -// expression: "document.type != 'private' && document.type != 'internal'" -// -// Example (Data Manipulation): -// -// title: "Notification string" -// description: "Create a notification string with a timestamp." -// expression: "'New message received at ' + string(document.create_time)" -// -// The exact variables and functions that may be referenced within an expression -// are determined by the service that evaluates it. See the service -// documentation for additional information. -message Expr { - // Textual representation of an expression in Common Expression Language - // syntax. - string expression = 1; - - // Optional. Title for the expression, i.e. a short string describing - // its purpose. This can be used e.g. in UIs which allow to enter the - // expression. - string title = 2; - - // Optional. Description of the expression. This is a longer text which - // describes the expression, e.g. when hovered over it in a UI. - string description = 3; - - // Optional. String indicating the location of the expression for error - // reporting, e.g. a file name and a position in the file. - string location = 4; -} diff --git a/opensafely/_vendor/google/type/expr_pb2.py b/opensafely/_vendor/google/type/expr_pb2.py deleted file mode 100644 index eaffb0b5..00000000 --- a/opensafely/_vendor/google/type/expr_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/expr.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x16google/type/expr.proto\x12\x0bgoogle.type"P\n\x04\x45xpr\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x10\n\x08location\x18\x04 \x01(\tBZ\n\x0f\x63om.google.typeB\tExprProtoP\x01Z4google.golang.org/genproto/googleapis/type/expr;expr\xa2\x02\x03GTPb\x06proto3' -) - - -_EXPR = DESCRIPTOR.message_types_by_name["Expr"] -Expr = _reflection.GeneratedProtocolMessageType( - "Expr", - (_message.Message,), - { - "DESCRIPTOR": _EXPR, - "__module__": "google.type.expr_pb2" - # @@protoc_insertion_point(class_scope:google.type.Expr) - }, -) -_sym_db.RegisterMessage(Expr) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\tExprProtoP\001Z4google.golang.org/genproto/googleapis/type/expr;expr\242\002\003GTP" - _EXPR._serialized_start = 39 - _EXPR._serialized_end = 119 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/fraction.proto b/opensafely/_vendor/google/type/fraction.proto deleted file mode 100644 index 6c5ae6e2..00000000 --- a/opensafely/_vendor/google/type/fraction.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option go_package = "google.golang.org/genproto/googleapis/type/fraction;fraction"; -option java_multiple_files = true; -option java_outer_classname = "FractionProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a fraction in terms of a numerator divided by a denominator. -message Fraction { - // The numerator in the fraction, e.g. 2 in 2/3. - int64 numerator = 1; - - // The value by which the numerator is divided, e.g. 3 in 2/3. Must be - // positive. - int64 denominator = 2; -} diff --git a/opensafely/_vendor/google/type/fraction_pb2.py b/opensafely/_vendor/google/type/fraction_pb2.py deleted file mode 100644 index ec16b730..00000000 --- a/opensafely/_vendor/google/type/fraction_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/fraction.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1agoogle/type/fraction.proto\x12\x0bgoogle.type"2\n\x08\x46raction\x12\x11\n\tnumerator\x18\x01 \x01(\x03\x12\x13\n\x0b\x64\x65nominator\x18\x02 \x01(\x03\x42\x66\n\x0f\x63om.google.typeB\rFractionProtoP\x01ZWGS84 -// standard. Values must be within normalized ranges. -message LatLng { - // The latitude in degrees. It must be in the range [-90.0, +90.0]. - double latitude = 1; - - // The longitude in degrees. It must be in the range [-180.0, +180.0]. - double longitude = 2; -} diff --git a/opensafely/_vendor/google/type/latlng_pb2.py b/opensafely/_vendor/google/type/latlng_pb2.py deleted file mode 100644 index 61310981..00000000 --- a/opensafely/_vendor/google/type/latlng_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/latlng.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x18google/type/latlng.proto\x12\x0bgoogle.type"-\n\x06LatLng\x12\x10\n\x08latitude\x18\x01 \x01(\x01\x12\x11\n\tlongitude\x18\x02 \x01(\x01\x42\x63\n\x0f\x63om.google.typeB\x0bLatLngProtoP\x01Z8google.golang.org/genproto/googleapis/type/latlng;latlng\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_LATLNG = DESCRIPTOR.message_types_by_name["LatLng"] -LatLng = _reflection.GeneratedProtocolMessageType( - "LatLng", - (_message.Message,), - { - "DESCRIPTOR": _LATLNG, - "__module__": "google.type.latlng_pb2" - # @@protoc_insertion_point(class_scope:google.type.LatLng) - }, -) -_sym_db.RegisterMessage(LatLng) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\013LatLngProtoP\001Z8google.golang.org/genproto/googleapis/type/latlng;latlng\370\001\001\242\002\003GTP" - _LATLNG._serialized_start = 41 - _LATLNG._serialized_end = 86 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/localized_text.proto b/opensafely/_vendor/google/type/localized_text.proto deleted file mode 100644 index 5c6922b8..00000000 --- a/opensafely/_vendor/google/type/localized_text.proto +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/localized_text;localized_text"; -option java_multiple_files = true; -option java_outer_classname = "LocalizedTextProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Localized variant of a text in a particular language. -message LocalizedText { - // Localized string in the language corresponding to `language_code' below. - string text = 1; - - // The text's BCP-47 language code, such as "en-US" or "sr-Latn". - // - // For more information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - string language_code = 2; -} diff --git a/opensafely/_vendor/google/type/localized_text_pb2.py b/opensafely/_vendor/google/type/localized_text_pb2.py deleted file mode 100644 index 61b6db2c..00000000 --- a/opensafely/_vendor/google/type/localized_text_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/localized_text.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n google/type/localized_text.proto\x12\x0bgoogle.type"4\n\rLocalizedText\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x15\n\rlanguage_code\x18\x02 \x01(\tBz\n\x0f\x63om.google.typeB\x12LocalizedTextProtoP\x01ZHgoogle.golang.org/genproto/googleapis/type/localized_text;localized_text\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_LOCALIZEDTEXT = DESCRIPTOR.message_types_by_name["LocalizedText"] -LocalizedText = _reflection.GeneratedProtocolMessageType( - "LocalizedText", - (_message.Message,), - { - "DESCRIPTOR": _LOCALIZEDTEXT, - "__module__": "google.type.localized_text_pb2" - # @@protoc_insertion_point(class_scope:google.type.LocalizedText) - }, -) -_sym_db.RegisterMessage(LocalizedText) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\022LocalizedTextProtoP\001ZHgoogle.golang.org/genproto/googleapis/type/localized_text;localized_text\370\001\001\242\002\003GTP" - _LOCALIZEDTEXT._serialized_start = 49 - _LOCALIZEDTEXT._serialized_end = 101 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/money.proto b/opensafely/_vendor/google/type/money.proto deleted file mode 100644 index 98d6494e..00000000 --- a/opensafely/_vendor/google/type/money.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/money;money"; -option java_multiple_files = true; -option java_outer_classname = "MoneyProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents an amount of money with its currency type. -message Money { - // The three-letter currency code defined in ISO 4217. - string currency_code = 1; - - // The whole units of the amount. - // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. - int64 units = 2; - - // Number of nano (10^-9) units of the amount. - // The value must be between -999,999,999 and +999,999,999 inclusive. - // If `units` is positive, `nanos` must be positive or zero. - // If `units` is zero, `nanos` can be positive, zero, or negative. - // If `units` is negative, `nanos` must be negative or zero. - // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. - int32 nanos = 3; -} diff --git a/opensafely/_vendor/google/type/money_pb2.py b/opensafely/_vendor/google/type/money_pb2.py deleted file mode 100644 index 1229a8e0..00000000 --- a/opensafely/_vendor/google/type/money_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/money.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x17google/type/money.proto\x12\x0bgoogle.type"<\n\x05Money\x12\x15\n\rcurrency_code\x18\x01 \x01(\t\x12\r\n\x05units\x18\x02 \x01(\x03\x12\r\n\x05nanos\x18\x03 \x01(\x05\x42`\n\x0f\x63om.google.typeB\nMoneyProtoP\x01Z6google.golang.org/genproto/googleapis/type/money;money\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_MONEY = DESCRIPTOR.message_types_by_name["Money"] -Money = _reflection.GeneratedProtocolMessageType( - "Money", - (_message.Message,), - { - "DESCRIPTOR": _MONEY, - "__module__": "google.type.money_pb2" - # @@protoc_insertion_point(class_scope:google.type.Money) - }, -) -_sym_db.RegisterMessage(Money) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\nMoneyProtoP\001Z6google.golang.org/genproto/googleapis/type/money;money\370\001\001\242\002\003GTP" - _MONEY._serialized_start = 40 - _MONEY._serialized_end = 100 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/month.proto b/opensafely/_vendor/google/type/month.proto deleted file mode 100644 index 99e7551b..00000000 --- a/opensafely/_vendor/google/type/month.proto +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option go_package = "google.golang.org/genproto/googleapis/type/month;month"; -option java_multiple_files = true; -option java_outer_classname = "MonthProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a month in the Gregorian calendar. -enum Month { - // The unspecified month. - MONTH_UNSPECIFIED = 0; - - // The month of January. - JANUARY = 1; - - // The month of February. - FEBRUARY = 2; - - // The month of March. - MARCH = 3; - - // The month of April. - APRIL = 4; - - // The month of May. - MAY = 5; - - // The month of June. - JUNE = 6; - - // The month of July. - JULY = 7; - - // The month of August. - AUGUST = 8; - - // The month of September. - SEPTEMBER = 9; - - // The month of October. - OCTOBER = 10; - - // The month of November. - NOVEMBER = 11; - - // The month of December. - DECEMBER = 12; -} diff --git a/opensafely/_vendor/google/type/month_pb2.py b/opensafely/_vendor/google/type/month_pb2.py deleted file mode 100644 index 9ee55d82..00000000 --- a/opensafely/_vendor/google/type/month_pb2.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/month.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b"\n\x17google/type/month.proto\x12\x0bgoogle.type*\xb0\x01\n\x05Month\x12\x15\n\x11MONTH_UNSPECIFIED\x10\x00\x12\x0b\n\x07JANUARY\x10\x01\x12\x0c\n\x08\x46\x45\x42RUARY\x10\x02\x12\t\n\x05MARCH\x10\x03\x12\t\n\x05\x41PRIL\x10\x04\x12\x07\n\x03MAY\x10\x05\x12\x08\n\x04JUNE\x10\x06\x12\x08\n\x04JULY\x10\x07\x12\n\n\x06\x41UGUST\x10\x08\x12\r\n\tSEPTEMBER\x10\t\x12\x0b\n\x07OCTOBER\x10\n\x12\x0c\n\x08NOVEMBER\x10\x0b\x12\x0c\n\x08\x44\x45\x43\x45MBER\x10\x0c\x42]\n\x0f\x63om.google.typeB\nMonthProtoP\x01Z6google.golang.org/genproto/googleapis/type/month;month\xa2\x02\x03GTPb\x06proto3" -) - -_MONTH = DESCRIPTOR.enum_types_by_name["Month"] -Month = enum_type_wrapper.EnumTypeWrapper(_MONTH) -MONTH_UNSPECIFIED = 0 -JANUARY = 1 -FEBRUARY = 2 -MARCH = 3 -APRIL = 4 -MAY = 5 -JUNE = 6 -JULY = 7 -AUGUST = 8 -SEPTEMBER = 9 -OCTOBER = 10 -NOVEMBER = 11 -DECEMBER = 12 - - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\nMonthProtoP\001Z6google.golang.org/genproto/googleapis/type/month;month\242\002\003GTP" - _MONTH._serialized_start = 41 - _MONTH._serialized_end = 217 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/phone_number.proto b/opensafely/_vendor/google/type/phone_number.proto deleted file mode 100644 index 7bbb7d87..00000000 --- a/opensafely/_vendor/google/type/phone_number.proto +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/phone_number;phone_number"; -option java_multiple_files = true; -option java_outer_classname = "PhoneNumberProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// An object representing a phone number, suitable as an API wire format. -// -// This representation: -// -// - should not be used for locale-specific formatting of a phone number, such -// as "+1 (650) 253-0000 ext. 123" -// -// - is not designed for efficient storage -// - may not be suitable for dialing - specialized libraries (see references) -// should be used to parse the number for that purpose -// -// To do something meaningful with this number, such as format it for various -// use-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first. -// -// For instance, in Java this would be: -// -// com.google.type.PhoneNumber wireProto = -// com.google.type.PhoneNumber.newBuilder().build(); -// com.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber = -// PhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), "ZZ"); -// if (!wireProto.getExtension().isEmpty()) { -// phoneNumber.setExtension(wireProto.getExtension()); -// } -// -// Reference(s): -// - https://github.com/google/libphonenumber -message PhoneNumber { - // An object representing a short code, which is a phone number that is - // typically much shorter than regular phone numbers and can be used to - // address messages in MMS and SMS systems, as well as for abbreviated dialing - // (e.g. "Text 611 to see how many minutes you have remaining on your plan."). - // - // Short codes are restricted to a region and are not internationally - // dialable, which means the same short code can exist in different regions, - // with different usage and pricing, even if those regions share the same - // country calling code (e.g. US and CA). - message ShortCode { - // Required. The BCP-47 region code of the location where calls to this - // short code can be made, such as "US" and "BB". - // - // Reference(s): - // - http://www.unicode.org/reports/tr35/#unicode_region_subtag - string region_code = 1; - - // Required. The short code digits, without a leading plus ('+') or country - // calling code, e.g. "611". - string number = 2; - } - - // Required. Either a regular number, or a short code. New fields may be - // added to the oneof below in the future, so clients should ignore phone - // numbers for which none of the fields they coded against are set. - oneof kind { - // The phone number, represented as a leading plus sign ('+'), followed by a - // phone number that uses a relaxed ITU E.164 format consisting of the - // country calling code (1 to 3 digits) and the subscriber number, with no - // additional spaces or formatting, e.g.: - // - correct: "+15552220123" - // - incorrect: "+1 (555) 222-01234 x123". - // - // The ITU E.164 format limits the latter to 12 digits, but in practice not - // all countries respect that, so we relax that restriction here. - // National-only numbers are not allowed. - // - // References: - // - https://www.itu.int/rec/T-REC-E.164-201011-I - // - https://en.wikipedia.org/wiki/E.164. - // - https://en.wikipedia.org/wiki/List_of_country_calling_codes - string e164_number = 1; - - // A short code. - // - // Reference(s): - // - https://en.wikipedia.org/wiki/Short_code - ShortCode short_code = 2; - } - - // The phone number's extension. The extension is not standardized in ITU - // recommendations, except for being defined as a series of numbers with a - // maximum length of 40 digits. Other than digits, some other dialing - // characters such as ',' (indicating a wait) or '#' may be stored here. - // - // Note that no regions currently use extensions with short codes, so this - // field is normally only set in conjunction with an E.164 number. It is held - // separately from the E.164 number to allow for short code extensions in the - // future. - string extension = 3; -} diff --git a/opensafely/_vendor/google/type/phone_number_pb2.py b/opensafely/_vendor/google/type/phone_number_pb2.py deleted file mode 100644 index 32eaf1d9..00000000 --- a/opensafely/_vendor/google/type/phone_number_pb2.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/phone_number.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1egoogle/type/phone_number.proto\x12\x0bgoogle.type"\xab\x01\n\x0bPhoneNumber\x12\x15\n\x0b\x65\x31\x36\x34_number\x18\x01 \x01(\tH\x00\x12\x38\n\nshort_code\x18\x02 \x01(\x0b\x32".google.type.PhoneNumber.ShortCodeH\x00\x12\x11\n\textension\x18\x03 \x01(\t\x1a\x30\n\tShortCode\x12\x13\n\x0bregion_code\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\tB\x06\n\x04kindBt\n\x0f\x63om.google.typeB\x10PhoneNumberProtoP\x01ZDgoogle.golang.org/genproto/googleapis/type/phone_number;phone_number\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_PHONENUMBER = DESCRIPTOR.message_types_by_name["PhoneNumber"] -_PHONENUMBER_SHORTCODE = _PHONENUMBER.nested_types_by_name["ShortCode"] -PhoneNumber = _reflection.GeneratedProtocolMessageType( - "PhoneNumber", - (_message.Message,), - { - "ShortCode": _reflection.GeneratedProtocolMessageType( - "ShortCode", - (_message.Message,), - { - "DESCRIPTOR": _PHONENUMBER_SHORTCODE, - "__module__": "google.type.phone_number_pb2" - # @@protoc_insertion_point(class_scope:google.type.PhoneNumber.ShortCode) - }, - ), - "DESCRIPTOR": _PHONENUMBER, - "__module__": "google.type.phone_number_pb2" - # @@protoc_insertion_point(class_scope:google.type.PhoneNumber) - }, -) -_sym_db.RegisterMessage(PhoneNumber) -_sym_db.RegisterMessage(PhoneNumber.ShortCode) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\020PhoneNumberProtoP\001ZDgoogle.golang.org/genproto/googleapis/type/phone_number;phone_number\370\001\001\242\002\003GTP" - _PHONENUMBER._serialized_start = 48 - _PHONENUMBER._serialized_end = 219 - _PHONENUMBER_SHORTCODE._serialized_start = 163 - _PHONENUMBER_SHORTCODE._serialized_end = 211 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/postal_address.proto b/opensafely/_vendor/google/type/postal_address.proto deleted file mode 100644 index c57c7c31..00000000 --- a/opensafely/_vendor/google/type/postal_address.proto +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/postaladdress;postaladdress"; -option java_multiple_files = true; -option java_outer_classname = "PostalAddressProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a postal address, e.g. for postal delivery or payments addresses. -// Given a postal address, a postal service can deliver items to a premise, P.O. -// Box or similar. -// It is not intended to model geographical locations (roads, towns, -// mountains). -// -// In typical usage an address would be created via user input or from importing -// existing data, depending on the type of process. -// -// Advice on address input / editing: -// - Use an i18n-ready address widget such as -// https://github.com/google/libaddressinput) -// - Users should not be presented with UI elements for input or editing of -// fields outside countries where that field is used. -// -// For more guidance on how to use this schema, please see: -// https://support.google.com/business/answer/6397478 -message PostalAddress { - // The schema revision of the `PostalAddress`. This must be set to 0, which is - // the latest revision. - // - // All new revisions **must** be backward compatible with old revisions. - int32 revision = 1; - - // Required. CLDR region code of the country/region of the address. This - // is never inferred and it is up to the user to ensure the value is - // correct. See http://cldr.unicode.org/ and - // http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html - // for details. Example: "CH" for Switzerland. - string region_code = 2; - - // Optional. BCP-47 language code of the contents of this address (if - // known). This is often the UI language of the input form or is expected - // to match one of the languages used in the address' country/region, or their - // transliterated equivalents. - // This can affect formatting in certain countries, but is not critical - // to the correctness of the data and will never affect any validation or - // other non-formatting related operations. - // - // If this value is not known, it should be omitted (rather than specifying a - // possibly incorrect default). - // - // Examples: "zh-Hant", "ja", "ja-Latn", "en". - string language_code = 3; - - // Optional. Postal code of the address. Not all countries use or require - // postal codes to be present, but where they are used, they may trigger - // additional validation with other parts of the address (e.g. state/zip - // validation in the U.S.A.). - string postal_code = 4; - - // Optional. Additional, country-specific, sorting code. This is not used - // in most regions. Where it is used, the value is either a string like - // "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number - // alone, representing the "sector code" (Jamaica), "delivery area indicator" - // (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). - string sorting_code = 5; - - // Optional. Highest administrative subdivision which is used for postal - // addresses of a country or region. - // For example, this can be a state, a province, an oblast, or a prefecture. - // Specifically, for Spain this is the province and not the autonomous - // community (e.g. "Barcelona" and not "Catalonia"). - // Many countries don't use an administrative area in postal addresses. E.g. - // in Switzerland this should be left unpopulated. - string administrative_area = 6; - - // Optional. Generally refers to the city/town portion of the address. - // Examples: US city, IT comune, UK post town. - // In regions of the world where localities are not well defined or do not fit - // into this structure well, leave locality empty and use address_lines. - string locality = 7; - - // Optional. Sublocality of the address. - // For example, this can be neighborhoods, boroughs, districts. - string sublocality = 8; - - // Unstructured address lines describing the lower levels of an address. - // - // Because values in address_lines do not have type information and may - // sometimes contain multiple values in a single field (e.g. - // "Austin, TX"), it is important that the line order is clear. The order of - // address lines should be "envelope order" for the country/region of the - // address. In places where this can vary (e.g. Japan), address_language is - // used to make it explicit (e.g. "ja" for large-to-small ordering and - // "ja-Latn" or "en" for small-to-large). This way, the most specific line of - // an address can be selected based on the language. - // - // The minimum permitted structural representation of an address consists - // of a region_code with all remaining information placed in the - // address_lines. It would be possible to format such an address very - // approximately without geocoding, but no semantic reasoning could be - // made about any of the address components until it was at least - // partially resolved. - // - // Creating an address only containing a region_code and address_lines, and - // then geocoding is the recommended way to handle completely unstructured - // addresses (as opposed to guessing which parts of the address should be - // localities or administrative areas). - repeated string address_lines = 9; - - // Optional. The recipient at the address. - // This field may, under certain circumstances, contain multiline information. - // For example, it might contain "care of" information. - repeated string recipients = 10; - - // Optional. The name of the organization at the address. - string organization = 11; -} diff --git a/opensafely/_vendor/google/type/postal_address_pb2.py b/opensafely/_vendor/google/type/postal_address_pb2.py deleted file mode 100644 index c6f27d3b..00000000 --- a/opensafely/_vendor/google/type/postal_address_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/postal_address.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n google/type/postal_address.proto\x12\x0bgoogle.type"\xfd\x01\n\rPostalAddress\x12\x10\n\x08revision\x18\x01 \x01(\x05\x12\x13\n\x0bregion_code\x18\x02 \x01(\t\x12\x15\n\rlanguage_code\x18\x03 \x01(\t\x12\x13\n\x0bpostal_code\x18\x04 \x01(\t\x12\x14\n\x0csorting_code\x18\x05 \x01(\t\x12\x1b\n\x13\x61\x64ministrative_area\x18\x06 \x01(\t\x12\x10\n\x08locality\x18\x07 \x01(\t\x12\x13\n\x0bsublocality\x18\x08 \x01(\t\x12\x15\n\raddress_lines\x18\t \x03(\t\x12\x12\n\nrecipients\x18\n \x03(\t\x12\x14\n\x0corganization\x18\x0b \x01(\tBx\n\x0f\x63om.google.typeB\x12PostalAddressProtoP\x01ZFgoogle.golang.org/genproto/googleapis/type/postaladdress;postaladdress\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_POSTALADDRESS = DESCRIPTOR.message_types_by_name["PostalAddress"] -PostalAddress = _reflection.GeneratedProtocolMessageType( - "PostalAddress", - (_message.Message,), - { - "DESCRIPTOR": _POSTALADDRESS, - "__module__": "google.type.postal_address_pb2" - # @@protoc_insertion_point(class_scope:google.type.PostalAddress) - }, -) -_sym_db.RegisterMessage(PostalAddress) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\022PostalAddressProtoP\001ZFgoogle.golang.org/genproto/googleapis/type/postaladdress;postaladdress\370\001\001\242\002\003GTP" - _POSTALADDRESS._serialized_start = 50 - _POSTALADDRESS._serialized_end = 303 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/quaternion.proto b/opensafely/_vendor/google/type/quaternion.proto deleted file mode 100644 index dfb822de..00000000 --- a/opensafely/_vendor/google/type/quaternion.proto +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/quaternion;quaternion"; -option java_multiple_files = true; -option java_outer_classname = "QuaternionProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// A quaternion is defined as the quotient of two directed lines in a -// three-dimensional space or equivalently as the quotient of two Euclidean -// vectors (https://en.wikipedia.org/wiki/Quaternion). -// -// Quaternions are often used in calculations involving three-dimensional -// rotations (https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation), -// as they provide greater mathematical robustness by avoiding the gimbal lock -// problems that can be encountered when using Euler angles -// (https://en.wikipedia.org/wiki/Gimbal_lock). -// -// Quaternions are generally represented in this form: -// -// w + xi + yj + zk -// -// where x, y, z, and w are real numbers, and i, j, and k are three imaginary -// numbers. -// -// Our naming choice `(x, y, z, w)` comes from the desire to avoid confusion for -// those interested in the geometric properties of the quaternion in the 3D -// Cartesian space. Other texts often use alternative names or subscripts, such -// as `(a, b, c, d)`, `(1, i, j, k)`, or `(0, 1, 2, 3)`, which are perhaps -// better suited for mathematical interpretations. -// -// To avoid any confusion, as well as to maintain compatibility with a large -// number of software libraries, the quaternions represented using the protocol -// buffer below *must* follow the Hamilton convention, which defines `ij = k` -// (i.e. a right-handed algebra), and therefore: -// -// i^2 = j^2 = k^2 = ijk = −1 -// ij = −ji = k -// jk = −kj = i -// ki = −ik = j -// -// Please DO NOT use this to represent quaternions that follow the JPL -// convention, or any of the other quaternion flavors out there. -// -// Definitions: -// -// - Quaternion norm (or magnitude): `sqrt(x^2 + y^2 + z^2 + w^2)`. -// - Unit (or normalized) quaternion: a quaternion whose norm is 1. -// - Pure quaternion: a quaternion whose scalar component (`w`) is 0. -// - Rotation quaternion: a unit quaternion used to represent rotation. -// - Orientation quaternion: a unit quaternion used to represent orientation. -// -// A quaternion can be normalized by dividing it by its norm. The resulting -// quaternion maintains the same direction, but has a norm of 1, i.e. it moves -// on the unit sphere. This is generally necessary for rotation and orientation -// quaternions, to avoid rounding errors: -// https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions -// -// Note that `(x, y, z, w)` and `(-x, -y, -z, -w)` represent the same rotation, -// but normalization would be even more useful, e.g. for comparison purposes, if -// it would produce a unique representation. It is thus recommended that `w` be -// kept positive, which can be achieved by changing all the signs when `w` is -// negative. -// -message Quaternion { - // The x component. - double x = 1; - - // The y component. - double y = 2; - - // The z component. - double z = 3; - - // The scalar component. - double w = 4; -} diff --git a/opensafely/_vendor/google/type/quaternion_pb2.py b/opensafely/_vendor/google/type/quaternion_pb2.py deleted file mode 100644 index 1ef7c7db..00000000 --- a/opensafely/_vendor/google/type/quaternion_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/quaternion.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1cgoogle/type/quaternion.proto\x12\x0bgoogle.type"8\n\nQuaternion\x12\t\n\x01x\x18\x01 \x01(\x01\x12\t\n\x01y\x18\x02 \x01(\x01\x12\t\n\x01z\x18\x03 \x01(\x01\x12\t\n\x01w\x18\x04 \x01(\x01\x42o\n\x0f\x63om.google.typeB\x0fQuaternionProtoP\x01Z@google.golang.org/genproto/googleapis/type/quaternion;quaternion\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_QUATERNION = DESCRIPTOR.message_types_by_name["Quaternion"] -Quaternion = _reflection.GeneratedProtocolMessageType( - "Quaternion", - (_message.Message,), - { - "DESCRIPTOR": _QUATERNION, - "__module__": "google.type.quaternion_pb2" - # @@protoc_insertion_point(class_scope:google.type.Quaternion) - }, -) -_sym_db.RegisterMessage(Quaternion) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\017QuaternionProtoP\001Z@google.golang.org/genproto/googleapis/type/quaternion;quaternion\370\001\001\242\002\003GTP" - _QUATERNION._serialized_start = 45 - _QUATERNION._serialized_end = 101 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/google/type/timeofday.proto b/opensafely/_vendor/google/type/timeofday.proto deleted file mode 100644 index 5cb48aa9..00000000 --- a/opensafely/_vendor/google/type/timeofday.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2021 Google LLC -// -// 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. - -syntax = "proto3"; - -package google.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/timeofday;timeofday"; -option java_multiple_files = true; -option java_outer_classname = "TimeOfDayProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a time of day. The date and time zone are either not significant -// or are specified elsewhere. An API may choose to allow leap seconds. Related -// types are [google.type.Date][google.type.Date] and -// `google.protobuf.Timestamp`. -message TimeOfDay { - // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose - // to allow the value "24:00:00" for scenarios like business closing time. - int32 hours = 1; - - // Minutes of hour of day. Must be from 0 to 59. - int32 minutes = 2; - - // Seconds of minutes of the time. Must normally be from 0 to 59. An API may - // allow the value 60 if it allows leap-seconds. - int32 seconds = 3; - - // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. - int32 nanos = 4; -} diff --git a/opensafely/_vendor/google/type/timeofday_pb2.py b/opensafely/_vendor/google/type/timeofday_pb2.py deleted file mode 100644 index 887d7db3..00000000 --- a/opensafely/_vendor/google/type/timeofday_pb2.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC -# -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/type/timeofday.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import descriptor_pool as _descriptor_pool -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1bgoogle/type/timeofday.proto\x12\x0bgoogle.type"K\n\tTimeOfDay\x12\r\n\x05hours\x18\x01 \x01(\x05\x12\x0f\n\x07minutes\x18\x02 \x01(\x05\x12\x0f\n\x07seconds\x18\x03 \x01(\x05\x12\r\n\x05nanos\x18\x04 \x01(\x05\x42l\n\x0f\x63om.google.typeB\x0eTimeOfDayProtoP\x01Z>google.golang.org/genproto/googleapis/type/timeofday;timeofday\xf8\x01\x01\xa2\x02\x03GTPb\x06proto3' -) - - -_TIMEOFDAY = DESCRIPTOR.message_types_by_name["TimeOfDay"] -TimeOfDay = _reflection.GeneratedProtocolMessageType( - "TimeOfDay", - (_message.Message,), - { - "DESCRIPTOR": _TIMEOFDAY, - "__module__": "google.type.timeofday_pb2" - # @@protoc_insertion_point(class_scope:google.type.TimeOfDay) - }, -) -_sym_db.RegisterMessage(TimeOfDay) - -if _descriptor._USE_C_DESCRIPTORS == False: - - DESCRIPTOR._options = None - DESCRIPTOR._serialized_options = b"\n\017com.google.typeB\016TimeOfDayProtoP\001Z>google.golang.org/genproto/googleapis/type/timeofday;timeofday\370\001\001\242\002\003GTP" - _TIMEOFDAY._serialized_start = 44 - _TIMEOFDAY._serialized_end = 119 -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info.pyi b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info.pyi deleted file mode 100644 index c0fd12cd..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from googleapis_common_protos-1.56.4.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/INSTALLER b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/LICENSE b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/METADATA b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/METADATA deleted file mode 100644 index e556efec..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/METADATA +++ /dev/null @@ -1,32 +0,0 @@ -Metadata-Version: 2.1 -Name: googleapis-common-protos -Version: 1.56.4 -Summary: Common protobufs used in Google APIs -Home-page: https://github.com/googleapis/python-api-common-protos -Author: Google LLC -Author-email: googleapis-packages@google.com -License: Apache-2.0 -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: Implementation :: CPython -Requires-Python: >=3.7 -Description-Content-Type: text/markdown -License-File: LICENSE -Requires-Dist: protobuf (<5.0.0dev,>=3.15.0) -Provides-Extra: grpc -Requires-Dist: grpcio (<2.0.0dev,>=1.0.0) ; extra == 'grpc' - - -# Google APIs common protos - -[![pypi](https://img.shields.io/pypi/v/googleapis-common-protos.svg)](https://pypi.org/project/googleapis-common-protos/) - - -googleapis-common-protos contains the python classes generated from the common -protos in the [googleapis/api-common-protos](https://github.com/googleapis/api-common-protos) repository. diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/RECORD b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/RECORD deleted file mode 100644 index a4097917..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/RECORD +++ /dev/null @@ -1,137 +0,0 @@ -google/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/api/annotations.proto,sha256=09O0u-gMBIHDVQc3b1ZT_P38vcfxaKqwl_Ja5kO36-g,1045 -google/api/annotations_pb2.py,sha256=YF9EPjyDHsuST4Wc-6PKGTU8Me99WEvq4iJqhYxpfkA,2133 -google/api/auth.proto,sha256=ZyYpbr2Ibq-05cVWdBaA5ayNoVABfUh5fVJ2tRUx2cc,9050 -google/api/auth_pb2.py,sha256=psypKYhyUo6gbGe8vkKteWTx_0wYZOZxuTog8XkNciM,5569 -google/api/backend.proto,sha256=eYHzW3D23Vb36g6BR3jWuzxWCEwsgYJM2V2beNOEzHs,6957 -google/api/backend_pb2.py,sha256=BdCX71MtMIOqMDdUqlRWk-8q6uRxD7HyVIoobU8QqDg,3477 -google/api/billing.proto,sha256=AeoIQEp8PJ8XLZeQkZeFOJnT8Y5gWrGGPqQ61M2GUbo,3048 -google/api/billing_pb2.py,sha256=jgYLuA4FLUXJRF-Y0HeRDTsbQrkljz_KarHP9TWCgs0,2933 -google/api/client.proto,sha256=izObuuGj8JKjBdooDua2-zGYWRPzfcvfbDE0NYmZXEU,3392 -google/api/client_pb2.py,sha256=PeKcwQGh8hbLeR-UDx34zBKjGfev_-58c184dQl-C7g,2623 -google/api/config_change.proto,sha256=Fgn9-SmFS8-2KGmGca1RPnWdASZhED28LLQHBDODjvM,3166 -google/api/config_change_pb2.py,sha256=cUbDOjd9uwousOYM9p7qA4Q7y68aLnKFjF1sSu6bOIM,3374 -google/api/consumer.proto,sha256=nRIVNOKCPv2beOI2AfALSLJfmYlkRe2QriVRBY-lIIQ,2717 -google/api/consumer_pb2.py,sha256=Ov5COY4mlEBH0Hc3Eg6izxrd1iOfBcw78Ue3GG4dZCU,3138 -google/api/context.proto,sha256=-WpAf8dU8RTiITgafKiEqNYIpwSMi_PRvSRPbY8QgYE,3062 -google/api/context_pb2.py,sha256=yP4_kQz8Zm_GnVf8L-DuUvghfnPOKMccabQeB-MWupw,2844 -google/api/control.proto,sha256=5Kx3cEK_sCMdvbgnewBuKgVPbMWf2sHSDAkU744NdQo,1223 -google/api/control_pb2.py,sha256=EYLfbCP6LkYDGHV6hqUekbGSS4MgkAPyXtyB6f25G1k,2122 -google/api/distribution.proto,sha256=StoB0ws7o-DL9FHNrP6OEYvAZGuppy0tyZ5mbzBHJ_E,8646 -google/api/distribution_pb2.py,sha256=9dKLzQiLjbUyYxfPEAp0NkKSJcgUugfOkcfTo1-SE2Q,7845 -google/api/documentation.proto,sha256=cuomVIaVBw8gPo7FzfoOvKZ47kO9k3yOle5K5JqbSmc,6456 -google/api/documentation_pb2.py,sha256=Mux0olXLDUgMuZ9KBXtrowzwjEO8SjbV_4d9DGSr5AA,3698 -google/api/endpoint.proto,sha256=_Ra3zHIhMWCq3grLCo3spJ32IAEXuz8YYU9Wt1PLi3A,2817 -google/api/endpoint_pb2.py,sha256=lj5ZV1xx8oczPmqFYSOUGUqPYR9jh0ADBkSBoDQswEc,2380 -google/api/error_reason.proto,sha256=a-nYiIxt5CO_1iKMACz1bremCpSiCU_H73l9ZwGS9yg,15717 -google/api/error_reason_pb2.py,sha256=bMG5-xFk14ktj8JWj4znc9SJCgRIN4UkL_PUtjVzRtQ,3449 -google/api/field_behavior.proto,sha256=fufIO7FQR0aRiOGFj9GdZ4CG-LbdrNFiK_zcSJIiYsE,3604 -google/api/field_behavior_pb2.py,sha256=QMZJu37d9m_0qAR2nyMCZqqJbFv1YXHT5tCu4PMka4I,2824 -google/api/http.proto,sha256=OgO3XUTaWVJHkR9iIJvrGdfs7DHzrfg9TdLXIZ8lr_I,15140 -google/api/http_pb2.py,sha256=koUyg-VEMqSMlv-kJklMyBDN3jxjHjMpJL-VJbm5sGA,3701 -google/api/httpbody.proto,sha256=oahm10FtHwN2-3NsqNT4Sg-i0q5mAyYpBBRwaijESd8,2693 -google/api/httpbody_pb2.py,sha256=OISoFp1ICdU5VKD0eHiVOqyQEC6XkjcwYpQZLoPYt1c,2344 -google/api/label.proto,sha256=m3h3wBCaOj0RBiqPchOH5iC_F3IeASQ5Pit5T3PnMiQ,1389 -google/api/label_pb2.py,sha256=_V5_MSffDWP5ONpU1peWP0H_3N4S7qP54MtJxAfVKp4,2581 -google/api/launch_stage.proto,sha256=tD7q4sh7nhsj-eHrfuJgyT8OwYTm9XJ-UDLFxq0Tmbk,3088 -google/api/launch_stage_pb2.py,sha256=dyaJQ0t77VOXH3XO0n_jbyidIFfrFiMzvLkQ7eCEzF8,2277 -google/api/log.proto,sha256=CUn51C-enHnjfdsT_iZmE1NsSU1BZXzEdqHkGOvOS48,2043 -google/api/log_pb2.py,sha256=H_YgxiGviHLtv7iqTWICVjjV2Al_Fx7voyRy5JySGL4,2402 -google/api/logging.proto,sha256=TzRgrGzHtihBP7ab8XqnBqemyFNJwOrRjOAKpTYI9ts,3167 -google/api/logging_pb2.py,sha256=PUtosIJ9S36_E4ZA4czj16mr1rOh_a_7te5LyXWWHoA,3014 -google/api/metric.proto,sha256=hXn2T3ZJfeKnTG40fCcIwsO3BtPM2PfUOHKBaikZSu8,10581 -google/api/metric_pb2.py,sha256=EUk_3BU3a8Fw37apksZ_hlc93ynSUu3XRZV52GgUpVA,6432 -google/api/monitored_resource.proto,sha256=OJPSMLhNyr7hqo8JTKdU6cf7tB_57uRo7MsR2gy28KE,5472 -google/api/monitored_resource_pb2.py,sha256=yKAPdtiTiEfKYSFIeCQwPWZfdo-RxLNSbuz5qVYFlqY,6324 -google/api/monitoring.proto,sha256=MAFqOlNq6-0KOhwbdrALUHx4wHWW3e3cOz1qHaxcq14,4443 -google/api/monitoring_pb2.py,sha256=sqB9wfL4Ms1jpjThYz0gUbttNu1bMIegV8JnQM1jtpg,3129 -google/api/quota.proto,sha256=WyTEvlerf47cfUbr60L_ftPWBeGzLleEl02TzJZCNqE,7140 -google/api/quota_pb2.py,sha256=WUc5bd9VEtegpSdQFjHjW13G93KQSI6g8INdMDg4N3Q,5303 -google/api/resource.proto,sha256=hJLBwa7xJ_7pt1Kn56xh4lMG752HMTeITNsjw6hiBCA,8744 -google/api/resource_pb2.py,sha256=fkpZbj1fa13oQEWlR2mJyEhwVmE0Z2JPtziWx43p6LQ,4870 -google/api/routing.proto,sha256=YhYKMfKVtE29YxXQyRdwrIM-pwUBERJ2p9BYm-cwJmg,14929 -google/api/routing_pb2.py,sha256=jMlornQKLJA5QWV2Uvg3zkbsYt4MxERuTAGyzAGvi90,3189 -google/api/service.proto,sha256=FIBLpFATnC20aOiDR04M9cOk1FzLdBKZO8Vno2NK8-4,6140 -google/api/service_pb2.py,sha256=9DCEWcUv_3sXu4iDX5R8iXtVc5RiNloWrEQpR82xwXI,5974 -google/api/source_info.proto,sha256=dqMr-DZOLD4L-KrzLjq7JDpgMd1J3GnygxwqGlrkK-M,1091 -google/api/source_info_pb2.py,sha256=PLZrMXESnQSXpxYUHjiUrVFqTiepW3j4sk4wyxEAU2c,2292 -google/api/system_parameter.proto,sha256=GWztsKGKyf_CTHzKKdgUJgkrb9GaIbkyhiiTHIg8wCY,3470 -google/api/system_parameter_pb2.py,sha256=PSwnzUUjh2mzEoM5hWKwp0EIU_3wXmxBl9-qNocrJnA,3583 -google/api/usage.proto,sha256=enuwFwDQVS3oIThl0yAHyuxwMsTIgw-it00z0-Ox5lI,3782 -google/api/usage_pb2.py,sha256=sx_aUDinwllJqMW1bTz61583bnAXNHXrYqZ4GSZTrxk,2791 -google/api/visibility.proto,sha256=QkLc8zVzCU1n4ERHzGl8pGBeiIwfAltHZzoOjM5gaE4,3673 -google/api/visibility_pb2.py,sha256=LqZr2qeBjnzV8IR9tqNRmXI8Bskxt69xMDFD-Fa4u8c,4956 -google/cloud/extended_operations.proto,sha256=YJSiUZyj11GQWoC33lbtUkttnz1--TfvVlpk4g9iu60,6308 -google/cloud/extended_operations_pb2.py,sha256=xKWiAi1sLCfEKPYkYnDiwlA7z7rnlBYUMTnWmKsSJDQ,4032 -google/cloud/location/locations.proto,sha256=7DPpJRIbH8jMe44Isz-8X6vooGE6AnkIFT0sFE84dhs,3604 -google/cloud/location/locations_pb2.py,sha256=ECp0OFSg2o1UiMfy2lWdpqulf4UEish8W20N0eU8PLQ,6899 -google/gapic/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/gapic/metadata/gapic_metadata.proto,sha256=QuhLul-63A_1cdrk57GUm3dtbimtpSSCCbjIt6olym8,3393 -google/gapic/metadata/gapic_metadata_pb2.py,sha256=x-EJeba3Btl9E0K3W5SqRGKgmjDsEA1FLa6CFVKXv7I,8346 -google/logging/type/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/logging/type/http_request.proto,sha256=Z_4B394wnm4Oa2RSW-cBsu52ph3DOxx5ptDXyxLXb3E,3596 -google/logging/type/http_request_pb2.py,sha256=Nb-XAlILoKbfpfj1tpJVpIyx0NvFf-2fttombdlJhhc,3176 -google/logging/type/log_severity.proto,sha256=myPbqoeucoUZkZXG7FAmWz2njSIddj97hp8jA9wJ4gg,2555 -google/logging/type/log_severity_pb2.py,sha256=gVb0R8dOvN6fYTLRnWnZyel-YIMRcBsj0GAFVQDXqTA,2622 -google/longrunning/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/longrunning/operations.proto,sha256=ShBuepe0MmbtekgLX9RbTqQK47xPBGxet_b7q_8-FlA,10507 -google/longrunning/operations_grpc.py,sha256=nulj2Z10WF2ggHn3LMJ4IhUbtAmTbISk6zb7RDKJc3c,797 -google/longrunning/operations_grpc_pb2.py,sha256=eUCKbAgcHJRKT1Dq1iud7y9SacGX1B96g4sX-UJiMfk,914 -google/longrunning/operations_pb2.py,sha256=GEezQBLVw5LvEZYwq_V7zptQJLL9gWs3dUNqHDotHK8,2253 -google/longrunning/operations_pb2_grpc.py,sha256=XCmhWtnahuW6TIfekqggTAChF49ZF7TU6kY3j7Wgqk8,14464 -google/longrunning/operations_proto.py,sha256=ZXPIBp7WWZoZ9wn_Dr5UBi7XDYduodBqMlihm30f6NM,222 -google/longrunning/operations_proto_pb2.py,sha256=mVoixm6sWA12OVmzSGrmG5gXXF1Ano5qe6KCg1ztuyg,10431 -google/rpc/__init__.py,sha256=B54uqovCU6_8ZHGcxnj11ixlUut5H8Nr21dQBYktIw8,774 -google/rpc/code.proto,sha256=VbqENiISp0QIMDMNRyeaeFSaXNmnYyAXx6zHlupaoYw,7125 -google/rpc/code_pb2.py,sha256=vvDGSq77csBfVJRLj0BUfvM5ZFiVozaFe6DKR1996z0,2707 -google/rpc/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/rpc/context/attribute_context.proto,sha256=IEVzyxg3BdrJ4oCNGiuVnc_SE5EFEy5JzxicSjtc1X4,14772 -google/rpc/context/attribute_context_pb2.py,sha256=e0PIy8ksorphcJR9bGw4ai43KPZxCr-ofa2fODBtPjY,14660 -google/rpc/error_details.proto,sha256=Qcbqed1Q1DPzHZZiPgs_qDc2p5dDRXBEX6PmW7f2LrM,9581 -google/rpc/error_details_pb2.py,sha256=xaYiQhLm-woagTLoBjmeOBUUQUd5Tgi819HjVTtvVms,11094 -google/rpc/status.proto,sha256=EIViwteFSBKQjNzQ2YgTKICCKwWrXk8olg4aVXIheFQ,1924 -google/rpc/status_pb2.py,sha256=SGM-WxVgLbnqxCc1JQGmPJKvOpVOVhfiWSg-KrH8Ujs,2302 -google/type/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/type/calendar_period.proto,sha256=Uv20O4lquXuT9Au_bJKJ94UHgD3V9XIZURjtgVIUdUE,1762 -google/type/calendar_period_pb2.py,sha256=hZCpKJsaRPCWGp1vNC5XI2B0IUjiHnoBGeFHI7EwCP4,2343 -google/type/color.proto,sha256=kK9GArFcQ4lj6mkLueoapkOSUprR3lNFpng43YNrUI0,6376 -google/type/color_pb2.py,sha256=IUMmF1mMTBbj6iZtGH0Jocx-duS_T-dSbFIoeUKjiqo,2343 -google/type/date.proto,sha256=BuBfGZRa3GepdFMQ_1cRhpdyio8qJ8BtYkkQdvAOIws,1955 -google/type/date_pb2.py,sha256=hpA97snLnWGhirx7dt7tq3J3MOl4vU909-K0QnfTIVE,2138 -google/type/datetime.proto,sha256=iRLRmPPSRZ5b86o6yjiIsK810RXGysWwSaF08CXtAlU,3905 -google/type/datetime_pb2.py,sha256=PuOi4a1AmmOFWijE417NB1Wh5zJxQKFyz3rLQs5LjrU,3165 -google/type/dayofweek.proto,sha256=56YBXUUcCxXQmPWNg76G3OII-bPLtAjCmvCTkgs6JwY,1204 -google/type/dayofweek_pb2.py,sha256=izQmV3nNwX5BH_1gHTD43hQYZdm1HhqKSFeFevsUH8s,2278 -google/type/decimal.proto,sha256=MHwhtJvxLOmTnmlFr7zjUzUMv-GtKWjt8KjI7h8ocSc,4213 -google/type/decimal_pb2.py,sha256=o3ik8jpNxmHKIQFTt3jQ0yolx7hg6FHhcZBqj9O6bRw,2132 -google/type/expr.proto,sha256=h01oPawn_bZZuE8tazwwU4A2dHd27gDTyp89xO2NbV0,2730 -google/type/expr_pb2.py,sha256=e45VfWwvvEAeJkcZOnLLd-QiuJadyC9isZh4PuL8lDw,2153 -google/type/fraction.proto,sha256=v_UMj40abInG6gzw386a9poFH3R1qs1NL7LZCWHfmIs,1156 -google/type/fraction_pb2.py,sha256=AXyzZFbgOpNsWApJ9gETgtZH6-gbWG7XxIjL-zSBQZU,2166 -google/type/interval.proto,sha256=aL9e8GY36gd30t-e4cDPOVMoGb4t_zXhtx-3vGPa_So,1667 -google/type/interval_pb2.py,sha256=1YWhrG1aII6vPMZO2C9PBLIkbLugFgmXCAAdqiedAvo,2364 -google/type/latlng.proto,sha256=p2KWOD4xxxfxeajCt-yigHRhH0uBmejeAZv_qwFXTV8,1447 -google/type/latlng_pb2.py,sha256=JjEHmRlkz4mtNwjkH2uJ265GHb2zCGn7-P_l1uv-AE0,2144 -google/type/localized_text.proto,sha256=nSlltBLvrTIYY-mF04BFlrqybqtvnUFS6_DqD6SOgbw,1303 -google/type/localized_text_pb2.py,sha256=1PoTaA6FpVLEMdvUnu9Yy2kYpiH3WKP_IW0whK3aWuc,2270 -google/type/money.proto,sha256=c-E8J98shWtC68tlqUWcS_xZ3Z4JzEjhp2W74GufpAY,1603 -google/type/money_pb2.py,sha256=xhpDpw13jLt_pim5l7r6Jx-QHd1TvRQgj1gSyQHTOzA,2151 -google/type/month.proto,sha256=76TvqQEdADPekbSnpQxBJ1P_xBr8o-BI_qG3ByHJIfI,1479 -google/type/month_pb2.py,sha256=nSmTfRZiOGe2NHr5zeUm3bNiGFEW0RAKk-sw1QtIGt8,2398 -google/type/phone_number.proto,sha256=V_GJma9FFGht1pEkCzMG9IL4nd-KQZQWT574PzsGudI,4744 -google/type/phone_number_pb2.py,sha256=phMqj3ouEDRmYoxNZSC9aBzL0M_Ej_-EU9OujIZGm5c,3046 -google/type/postal_address.proto,sha256=_R41zeaO1PcGqfEU4gHlFzUubKJ2SERzxhnvJxTIID0,6235 -google/type/postal_address_pb2.py,sha256=_akaf6XBB_6o8EsS2Lw1BIeJdwEL8rLvvO8_0NMpcrE,2654 -google/type/quaternion.proto,sha256=KfoTNWnwo2LypdBv8rMPHB5pf_kdcI5QPiLXrucdOpw,3791 -google/type/quaternion_pb2.py,sha256=iO651jhNnTaHqcQQkFmIjh0510o3q2RNF5s4Q5Teeps,2261 -google/type/timeofday.proto,sha256=7zMEkJWeYteVVcz3SpM686GFL66hX-aguaqIKZwJv2M,1667 -google/type/timeofday_pb2.py,sha256=mHFQIkY9h2QWrvHFa2AWc6uzco-nF3LoVCcVnjt8XRQ,2266 -googleapis_common_protos-1.56.4-py3.10-nspkg.pth,sha256=Tg4rpjewFx7OQ2T0FgJr03q1pjDuv0s3_Kt7Om6NRTY,1710 -googleapis_common_protos-1.56.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -googleapis_common_protos-1.56.4.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358 -googleapis_common_protos-1.56.4.dist-info/METADATA,sha256=bCPK4AH73QMmPbQh_UIasi33TWz75l4zglbWB6qw6Xg,1292 -googleapis_common_protos-1.56.4.dist-info/RECORD,, -googleapis_common_protos-1.56.4.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -googleapis_common_protos-1.56.4.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110 -googleapis_common_protos-1.56.4.dist-info/namespace_packages.txt,sha256=ZYDWu9vCgZTsAUTtX60BH9vYx2tjPFGQnUjgJAk_uus,22 -googleapis_common_protos-1.56.4.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7 diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/REQUESTED b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/WHEEL b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/WHEEL deleted file mode 100644 index 0b18a281..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/namespace_packages.txt b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/namespace_packages.txt deleted file mode 100644 index cc5325d5..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/namespace_packages.txt +++ /dev/null @@ -1,2 +0,0 @@ -google -google.logging diff --git a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/top_level.txt b/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/top_level.txt deleted file mode 100644 index cb429113..00000000 --- a/opensafely/_vendor/googleapis_common_protos-1.56.4.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -google diff --git a/opensafely/_vendor/googleapis_common_protos.LICENSE b/opensafely/_vendor/googleapis_common_protos.LICENSE deleted file mode 100644 index d6456956..00000000 --- a/opensafely/_vendor/googleapis_common_protos.LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/__init__.py b/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/__init__.py deleted file mode 100644 index 80677aad..00000000 --- a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/__init__.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - - -""" -This library allows to export tracing data to an OTLP collector. - -Usage ------ - -The **OTLP Span Exporter** allows to export `OpenTelemetry`_ traces to the -`OTLP`_ collector. - -You can configure the exporter with the following environment variables: - -- :envvar:`OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` -- :envvar:`OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` -- :envvar:`OTEL_EXPORTER_OTLP_TRACES_HEADERS` -- :envvar:`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` -- :envvar:`OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` -- :envvar:`OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` -- :envvar:`OTEL_EXPORTER_OTLP_TIMEOUT` -- :envvar:`OTEL_EXPORTER_OTLP_PROTOCOL` -- :envvar:`OTEL_EXPORTER_OTLP_HEADERS` -- :envvar:`OTEL_EXPORTER_OTLP_ENDPOINT` -- :envvar:`OTEL_EXPORTER_OTLP_COMPRESSION` -- :envvar:`OTEL_EXPORTER_OTLP_CERTIFICATE` - -.. _OTLP: https://github.com/open-telemetry/opentelemetry-collector/ -.. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/ - -.. code:: python - - from opensafely._vendor.opentelemetry import trace - from opensafely._vendor.opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter - from opensafely._vendor.opentelemetry.sdk.resources import Resource - from opensafely._vendor.opentelemetry.sdk.trace import TracerProvider - from opensafely._vendor.opentelemetry.sdk.trace.export import BatchSpanProcessor - - # Resource can be required for some backends, e.g. Jaeger - # If resource wouldn't be set - traces wouldn't appears in Jaeger - resource = Resource(attributes={ - "service.name": "service" - }) - - trace.set_tracer_provider(TracerProvider(resource=resource)) - tracer = trace.get_tracer(__name__) - - otlp_exporter = OTLPSpanExporter() - - span_processor = BatchSpanProcessor(otlp_exporter) - - trace.get_tracer_provider().add_span_processor(span_processor) - - with tracer.start_as_current_span("foo"): - print("Hello world!") - -API ---- -""" -import enum - - -class Compression(enum.Enum): - NoCompression = "none" - Deflate = "deflate" - Gzip = "gzip" diff --git a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py b/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py deleted file mode 100644 index 95675be3..00000000 --- a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py +++ /dev/null @@ -1,168 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 gzip -import logging -import zlib -from io import BytesIO -from os import environ -from typing import Dict, Optional, Sequence -from time import sleep - -from opensafely._vendor import requests -from opensafely._vendor.backoff import expo - -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - OTEL_EXPORTER_OTLP_CERTIFICATE, - OTEL_EXPORTER_OTLP_COMPRESSION, - OTEL_EXPORTER_OTLP_ENDPOINT, - OTEL_EXPORTER_OTLP_HEADERS, - OTEL_EXPORTER_OTLP_TIMEOUT, -) -from opensafely._vendor.opentelemetry.sdk._logs.export import ( - LogExporter, - LogExportResult, - LogData, -) -from opensafely._vendor.opentelemetry.exporter.otlp.proto.http import Compression -from opensafely._vendor.opentelemetry.exporter.otlp.proto.http._log_exporter.encoder import ( - _ProtobufEncoder, -) -from opensafely._vendor.opentelemetry.util.re import parse_headers - - -_logger = logging.getLogger(__name__) - - -DEFAULT_COMPRESSION = Compression.NoCompression -DEFAULT_ENDPOINT = "http://localhost:4318/" -DEFAULT_LOGS_EXPORT_PATH = "v1/logs" -DEFAULT_TIMEOUT = 10 # in seconds - - -class OTLPLogExporter(LogExporter): - - _MAX_RETRY_TIMEOUT = 64 - - def __init__( - self, - endpoint: Optional[str] = None, - certificate_file: Optional[str] = None, - headers: Optional[Dict[str, str]] = None, - timeout: Optional[int] = None, - compression: Optional[Compression] = None, - session: Optional[requests.Session] = None, - ): - self._endpoint = endpoint or _append_logs_path( - environ.get(OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_ENDPOINT) - ) - self._certificate_file = certificate_file or environ.get( - OTEL_EXPORTER_OTLP_CERTIFICATE, True - ) - headers_string = environ.get(OTEL_EXPORTER_OTLP_HEADERS, "") - self._headers = headers or parse_headers(headers_string) - self._timeout = timeout or int( - environ.get(OTEL_EXPORTER_OTLP_TIMEOUT, DEFAULT_TIMEOUT) - ) - self._compression = compression or _compression_from_env() - self._session = session or requests.Session() - self._session.headers.update(self._headers) - self._session.headers.update( - {"Content-Type": _ProtobufEncoder._CONTENT_TYPE} - ) - if self._compression is not Compression.NoCompression: - self._session.headers.update( - {"Content-Encoding": self._compression.value} - ) - self._shutdown = False - - def _export(self, serialized_data: str): - data = serialized_data - if self._compression == Compression.Gzip: - gzip_data = BytesIO() - with gzip.GzipFile(fileobj=gzip_data, mode="w") as gzip_stream: - gzip_stream.write(serialized_data) - data = gzip_data.getvalue() - elif self._compression == Compression.Deflate: - data = zlib.compress(bytes(serialized_data)) - - return self._session.post( - url=self._endpoint, - data=data, - verify=self._certificate_file, - timeout=self._timeout, - ) - - @staticmethod - def _retryable(resp: requests.Response) -> bool: - if resp.status_code == 408: - return True - if resp.status_code >= 500 and resp.status_code <= 599: - return True - return False - - def export(self, batch: Sequence[LogData]) -> LogExportResult: - # After the call to Shutdown subsequent calls to Export are - # not allowed and should return a Failure result. - if self._shutdown: - _logger.warning("Exporter already shutdown, ignoring batch") - return LogExportResult.FAILURE - - serialized_data = _ProtobufEncoder.serialize(batch) - - for delay in expo(max_value=self._MAX_RETRY_TIMEOUT): - - if delay == self._MAX_RETRY_TIMEOUT: - return LogExportResult.FAILURE - - resp = self._export(serialized_data) - # pylint: disable=no-else-return - if resp.status_code in (200, 202): - return LogExportResult.SUCCESS - elif self._retryable(resp): - _logger.warning( - "Transient error %s encountered while exporting logs batch, retrying in %ss.", - resp.reason, - delay, - ) - sleep(delay) - continue - else: - _logger.error( - "Failed to export logs batch code: %s, reason: %s", - resp.status_code, - resp.text, - ) - return LogExportResult.FAILURE - return LogExportResult.FAILURE - - def shutdown(self): - if self._shutdown: - _logger.warning("Exporter already shutdown, ignoring call") - return - self._session.close() - self._shutdown = True - - -def _compression_from_env() -> Compression: - compression = ( - environ.get(OTEL_EXPORTER_OTLP_COMPRESSION, "none").lower().strip() - ) - return Compression(compression) - - -def _append_logs_path(endpoint: str) -> str: - if endpoint.endswith("/"): - return endpoint + DEFAULT_LOGS_EXPORT_PATH - return endpoint + f"/{DEFAULT_LOGS_EXPORT_PATH}" diff --git a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py b/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py deleted file mode 100644 index ddf46069..00000000 --- a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 Sequence, List - -from opensafely._vendor.opentelemetry.proto.collector.logs.v1.logs_service_pb2 import ( - ExportLogsServiceRequest, -) -from opensafely._vendor.opentelemetry.proto.logs.v1.logs_pb2 import ( - ScopeLogs, - ResourceLogs, -) -from opensafely._vendor.opentelemetry.proto.logs.v1.logs_pb2 import LogRecord as PB2LogRecord -from opensafely._vendor.opentelemetry.exporter.otlp.proto.http.trace_exporter.encoder import ( - _encode_instrumentation_scope, - _encode_resource, - _encode_span_id, - _encode_trace_id, - _encode_value, - _encode_attributes, -) - - -from opensafely._vendor.opentelemetry.sdk._logs.export import LogData - - -class _ProtobufEncoder: - _CONTENT_TYPE = "application/x-protobuf" - - @classmethod - def serialize(cls, batch: Sequence[LogData]) -> str: - return cls.encode(batch).SerializeToString() - - @staticmethod - def encode(batch: Sequence[LogData]) -> ExportLogsServiceRequest: - return ExportLogsServiceRequest( - resource_logs=_encode_resource_logs(batch) - ) - - -def _encode_log(log_data: LogData) -> PB2LogRecord: - kwargs = {} - kwargs["time_unix_nano"] = log_data.log_record.timestamp - kwargs["span_id"] = _encode_span_id(log_data.log_record.span_id) - kwargs["trace_id"] = _encode_trace_id(log_data.log_record.trace_id) - kwargs["flags"] = int(log_data.log_record.trace_flags) - kwargs["body"] = _encode_value(log_data.log_record.body) - kwargs["severity_text"] = log_data.log_record.severity_text - kwargs["attributes"] = _encode_attributes(log_data.log_record.attributes) - kwargs["severity_number"] = log_data.log_record.severity_number.value - - return PB2LogRecord(**kwargs) - - -def _encode_resource_logs(batch: Sequence[LogData]) -> List[ResourceLogs]: - - sdk_resource_logs = {} - - for sdk_log in batch: - sdk_resource = sdk_log.log_record.resource - sdk_instrumentation = sdk_log.instrumentation_scope or None - pb2_log = _encode_log(sdk_log) - - if sdk_resource not in sdk_resource_logs.keys(): - sdk_resource_logs[sdk_resource] = {sdk_instrumentation: [pb2_log]} - elif sdk_instrumentation not in sdk_resource_logs[sdk_resource].keys(): - sdk_resource_logs[sdk_resource][sdk_instrumentation] = [pb2_log] - else: - sdk_resource_logs[sdk_resource][sdk_instrumentation].append( - pb2_log - ) - - pb2_resource_logs = [] - - for sdk_resource, sdk_instrumentations in sdk_resource_logs.items(): - scope_logs = [] - for sdk_instrumentation, pb2_logs in sdk_instrumentations.items(): - scope_logs.append( - ScopeLogs( - scope=(_encode_instrumentation_scope(sdk_instrumentation)), - log_records=pb2_logs, - ) - ) - pb2_resource_logs.append( - ResourceLogs( - resource=_encode_resource(sdk_resource), - scope_logs=scope_logs, - ) - ) - - return pb2_resource_logs diff --git a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py b/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py deleted file mode 100644 index 45831ed1..00000000 --- a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py +++ /dev/null @@ -1,184 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 gzip -import logging -import zlib -from io import BytesIO -from os import environ -from typing import Dict, Optional -from time import sleep - -from opensafely._vendor import requests -from opensafely._vendor.backoff import expo - -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE, - OTEL_EXPORTER_OTLP_TRACES_COMPRESSION, - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, - OTEL_EXPORTER_OTLP_TRACES_HEADERS, - OTEL_EXPORTER_OTLP_TRACES_TIMEOUT, - OTEL_EXPORTER_OTLP_CERTIFICATE, - OTEL_EXPORTER_OTLP_COMPRESSION, - OTEL_EXPORTER_OTLP_ENDPOINT, - OTEL_EXPORTER_OTLP_HEADERS, - OTEL_EXPORTER_OTLP_TIMEOUT, -) -from opensafely._vendor.opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult -from opensafely._vendor.opentelemetry.exporter.otlp.proto.http import Compression -from opensafely._vendor.opentelemetry.exporter.otlp.proto.http.trace_exporter.encoder import ( - _ProtobufEncoder, -) -from opensafely._vendor.opentelemetry.util.re import parse_headers - - -_logger = logging.getLogger(__name__) - - -DEFAULT_COMPRESSION = Compression.NoCompression -DEFAULT_ENDPOINT = "http://localhost:4318/" -DEFAULT_TRACES_EXPORT_PATH = "v1/traces" -DEFAULT_TIMEOUT = 10 # in seconds - - -class OTLPSpanExporter(SpanExporter): - - _MAX_RETRY_TIMEOUT = 64 - - def __init__( - self, - endpoint: Optional[str] = None, - certificate_file: Optional[str] = None, - headers: Optional[Dict[str, str]] = None, - timeout: Optional[int] = None, - compression: Optional[Compression] = None, - session: Optional[requests.Session] = None, - ): - self._endpoint = endpoint or environ.get( - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, - _append_trace_path( - environ.get(OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_ENDPOINT) - ), - ) - self._certificate_file = certificate_file or environ.get( - OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE, - environ.get(OTEL_EXPORTER_OTLP_CERTIFICATE, True), - ) - headers_string = environ.get( - OTEL_EXPORTER_OTLP_TRACES_HEADERS, - environ.get(OTEL_EXPORTER_OTLP_HEADERS, ""), - ) - self._headers = headers or parse_headers(headers_string) - self._timeout = timeout or int( - environ.get( - OTEL_EXPORTER_OTLP_TRACES_TIMEOUT, - environ.get(OTEL_EXPORTER_OTLP_TIMEOUT, DEFAULT_TIMEOUT), - ) - ) - self._compression = compression or _compression_from_env() - self._session = session or requests.Session() - self._session.headers.update(self._headers) - self._session.headers.update( - {"Content-Type": _ProtobufEncoder._CONTENT_TYPE} - ) - if self._compression is not Compression.NoCompression: - self._session.headers.update( - {"Content-Encoding": self._compression.value} - ) - self._shutdown = False - - def _export(self, serialized_data: str): - data = serialized_data - if self._compression == Compression.Gzip: - gzip_data = BytesIO() - with gzip.GzipFile(fileobj=gzip_data, mode="w") as gzip_stream: - gzip_stream.write(serialized_data) - data = gzip_data.getvalue() - elif self._compression == Compression.Deflate: - data = zlib.compress(bytes(serialized_data)) - - return self._session.post( - url=self._endpoint, - data=data, - verify=self._certificate_file, - timeout=self._timeout, - ) - - @staticmethod - def _retryable(resp: requests.Response) -> bool: - if resp.status_code == 408: - return True - if resp.status_code >= 500 and resp.status_code <= 599: - return True - return False - - def export(self, spans) -> SpanExportResult: - # After the call to Shutdown subsequent calls to Export are - # not allowed and should return a Failure result. - if self._shutdown: - _logger.warning("Exporter already shutdown, ignoring batch") - return SpanExportResult.FAILURE - - serialized_data = _ProtobufEncoder.serialize(spans) - - for delay in expo(max_value=self._MAX_RETRY_TIMEOUT): - - if delay == self._MAX_RETRY_TIMEOUT: - return SpanExportResult.FAILURE - - resp = self._export(serialized_data) - # pylint: disable=no-else-return - if resp.status_code in (200, 202): - return SpanExportResult.SUCCESS - elif self._retryable(resp): - _logger.warning( - "Transient error %s encountered while exporting span batch, retrying in %ss.", - resp.reason, - delay, - ) - sleep(delay) - continue - else: - _logger.error( - "Failed to export batch code: %s, reason: %s", - resp.status_code, - resp.text, - ) - return SpanExportResult.FAILURE - return SpanExportResult.FAILURE - - def shutdown(self): - if self._shutdown: - _logger.warning("Exporter already shutdown, ignoring call") - return - self._session.close() - self._shutdown = True - - -def _compression_from_env() -> Compression: - compression = ( - environ.get( - OTEL_EXPORTER_OTLP_TRACES_COMPRESSION, - environ.get(OTEL_EXPORTER_OTLP_COMPRESSION, "none"), - ) - .lower() - .strip() - ) - return Compression(compression) - - -def _append_trace_path(endpoint: str) -> str: - if endpoint.endswith("/"): - return endpoint + DEFAULT_TRACES_EXPORT_PATH - return endpoint + f"/{DEFAULT_TRACES_EXPORT_PATH}" diff --git a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/encoder/__init__.py b/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/encoder/__init__.py deleted file mode 100644 index 6e2575c0..00000000 --- a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/trace_exporter/encoder/__init__.py +++ /dev/null @@ -1,290 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 logging -from collections import abc -from typing import Any, List, Optional, Sequence - -from opensafely._vendor.opentelemetry.proto.collector.trace.v1.trace_service_pb2 import ( - ExportTraceServiceRequest as PB2ExportTraceServiceRequest, -) -from opensafely._vendor.opentelemetry.proto.common.v1.common_pb2 import AnyValue as PB2AnyValue -from opensafely._vendor.opentelemetry.proto.common.v1.common_pb2 import ( - ArrayValue as PB2ArrayValue, -) -from opensafely._vendor.opentelemetry.proto.common.v1.common_pb2 import ( - InstrumentationScope as PB2InstrumentationScope, -) -from opensafely._vendor.opentelemetry.proto.common.v1.common_pb2 import KeyValue as PB2KeyValue -from opensafely._vendor.opentelemetry.proto.resource.v1.resource_pb2 import ( - Resource as PB2Resource, -) -from opensafely._vendor.opentelemetry.proto.trace.v1.trace_pb2 import ( - ScopeSpans as PB2ScopeSpans, -) -from opensafely._vendor.opentelemetry.proto.trace.v1.trace_pb2 import ( - ResourceSpans as PB2ResourceSpans, -) -from opensafely._vendor.opentelemetry.proto.trace.v1.trace_pb2 import Span as PB2SPan -from opensafely._vendor.opentelemetry.proto.trace.v1.trace_pb2 import Status as PB2Status -from opensafely._vendor.opentelemetry.sdk.trace import Event -from opensafely._vendor.opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opensafely._vendor.opentelemetry.sdk.trace import Resource -from opensafely._vendor.opentelemetry.sdk.trace import Span as SDKSpan -from opensafely._vendor.opentelemetry.trace import Link -from opensafely._vendor.opentelemetry.trace import SpanKind -from opensafely._vendor.opentelemetry.trace.span import SpanContext, TraceState, Status -from opensafely._vendor.opentelemetry.util.types import Attributes - -# pylint: disable=E1101 -_SPAN_KIND_MAP = { - SpanKind.INTERNAL: PB2SPan.SpanKind.SPAN_KIND_INTERNAL, - SpanKind.SERVER: PB2SPan.SpanKind.SPAN_KIND_SERVER, - SpanKind.CLIENT: PB2SPan.SpanKind.SPAN_KIND_CLIENT, - SpanKind.PRODUCER: PB2SPan.SpanKind.SPAN_KIND_PRODUCER, - SpanKind.CONSUMER: PB2SPan.SpanKind.SPAN_KIND_CONSUMER, -} - -_logger = logging.getLogger(__name__) - - -class _ProtobufEncoder: - _CONTENT_TYPE = "application/x-protobuf" - - @classmethod - def serialize(cls, sdk_spans: Sequence[SDKSpan]) -> str: - return cls.encode(sdk_spans).SerializeToString() - - @staticmethod - def encode(sdk_spans: Sequence[SDKSpan]) -> PB2ExportTraceServiceRequest: - return PB2ExportTraceServiceRequest( - resource_spans=_encode_resource_spans(sdk_spans) - ) - - -def _encode_resource_spans( - sdk_spans: Sequence[SDKSpan], -) -> List[PB2ResourceSpans]: - # We need to inspect the spans and group + structure them as: - # - # Resource - # Instrumentation Library - # Spans - # - # First loop organizes the SDK spans in this structure. Protobuf messages - # are not hashable so we stick with SDK data in this phase. - # - # Second loop encodes the data into Protobuf format. - # - sdk_resource_spans = {} - - for sdk_span in sdk_spans: - sdk_resource = sdk_span.resource - sdk_instrumentation = sdk_span.instrumentation_scope or None - pb2_span = _encode_span(sdk_span) - - if sdk_resource not in sdk_resource_spans.keys(): - sdk_resource_spans[sdk_resource] = { - sdk_instrumentation: [pb2_span] - } - elif ( - sdk_instrumentation not in sdk_resource_spans[sdk_resource].keys() - ): - sdk_resource_spans[sdk_resource][sdk_instrumentation] = [pb2_span] - else: - sdk_resource_spans[sdk_resource][sdk_instrumentation].append( - pb2_span - ) - - pb2_resource_spans = [] - - for sdk_resource, sdk_instrumentations in sdk_resource_spans.items(): - scope_spans = [] - for sdk_instrumentation, pb2_spans in sdk_instrumentations.items(): - scope_spans.append( - PB2ScopeSpans( - scope=(_encode_instrumentation_scope(sdk_instrumentation)), - spans=pb2_spans, - ) - ) - pb2_resource_spans.append( - PB2ResourceSpans( - resource=_encode_resource(sdk_resource), - scope_spans=scope_spans, - ) - ) - - return pb2_resource_spans - - -def _encode_span(sdk_span: SDKSpan) -> PB2SPan: - span_context = sdk_span.get_span_context() - return PB2SPan( - trace_id=_encode_trace_id(span_context.trace_id), - span_id=_encode_span_id(span_context.span_id), - trace_state=_encode_trace_state(span_context.trace_state), - parent_span_id=_encode_parent_id(sdk_span.parent), - name=sdk_span.name, - kind=_SPAN_KIND_MAP[sdk_span.kind], - start_time_unix_nano=sdk_span.start_time, - end_time_unix_nano=sdk_span.end_time, - attributes=_encode_attributes(sdk_span.attributes), - events=_encode_events(sdk_span.events), - links=_encode_links(sdk_span.links), - status=_encode_status(sdk_span.status), - ) - - -def _encode_events( - events: Sequence[Event], -) -> Optional[List[PB2SPan.Event]]: - pb2_events = None - if events: - pb2_events = [] - for event in events: - encoded_event = PB2SPan.Event( - name=event.name, - time_unix_nano=event.timestamp, - ) - for key, value in event.attributes.items(): - try: - encoded_event.attributes.append( - _encode_key_value(key, value) - ) - # pylint: disable=broad-except - except Exception as error: - _logger.exception(error) - pb2_events.append(encoded_event) - return pb2_events - - -def _encode_links(links: List[Link]) -> List[PB2SPan.Link]: - pb2_links = None - if links: - pb2_links = [] - for link in links: - encoded_link = PB2SPan.Link( - trace_id=_encode_trace_id(link.context.trace_id), - span_id=_encode_span_id(link.context.span_id), - ) - for key, value in link.attributes.items(): - try: - encoded_link.attributes.append( - _encode_key_value(key, value) - ) - # pylint: disable=broad-except - except Exception as error: - _logger.exception(error) - pb2_links.append(encoded_link) - return pb2_links - - -def _encode_status(status: Status) -> Optional[PB2Status]: - pb2_status = None - if status is not None: - pb2_status = PB2Status( - code=status.status_code.value, - message=status.description, - ) - return pb2_status - - -def _encode_trace_state(trace_state: TraceState) -> Optional[str]: - pb2_trace_state = None - if trace_state is not None: - pb2_trace_state = ",".join( - [f"{key}={value}" for key, value in (trace_state.items())] - ) - return pb2_trace_state - - -def _encode_parent_id(context: Optional[SpanContext]) -> Optional[bytes]: - if isinstance(context, SpanContext): - encoded_parent_id = _encode_span_id(context.span_id) - else: - encoded_parent_id = None - return encoded_parent_id - - -def _encode_attributes( - attributes: Attributes, -) -> Optional[List[PB2KeyValue]]: - if attributes: - pb2_attributes = [] - for key, value in attributes.items(): - try: - pb2_attributes.append(_encode_key_value(key, value)) - except Exception as error: # pylint: disable=broad-except - _logger.exception(error) - else: - pb2_attributes = None - return pb2_attributes - - -def _encode_resource(resource: Resource) -> PB2Resource: - pb2_resource = PB2Resource() - for key, value in resource.attributes.items(): - try: - # pylint: disable=no-member - pb2_resource.attributes.append(_encode_key_value(key, value)) - except Exception as error: # pylint: disable=broad-except - _logger.exception(error) - return pb2_resource - - -def _encode_instrumentation_scope( - instrumentation_scope: InstrumentationScope, -) -> PB2InstrumentationScope: - if instrumentation_scope is None: - pb2_instrumentation_scope = PB2InstrumentationScope() - else: - pb2_instrumentation_scope = PB2InstrumentationScope( - name=instrumentation_scope.name, - version=instrumentation_scope.version, - ) - return pb2_instrumentation_scope - - -def _encode_value(value: Any) -> PB2AnyValue: - if isinstance(value, bool): - any_value = PB2AnyValue(bool_value=value) - elif isinstance(value, str): - any_value = PB2AnyValue(string_value=value) - elif isinstance(value, int): - any_value = PB2AnyValue(int_value=value) - elif isinstance(value, float): - any_value = PB2AnyValue(double_value=value) - elif isinstance(value, abc.Sequence): - any_value = PB2AnyValue( - array_value=PB2ArrayValue(values=[_encode_value(v) for v in value]) - ) - # tracing specs currently does not support Mapping type attributes. - # elif isinstance(value, abc.Mapping): - # pass - else: - raise Exception(f"Invalid type {type(value)} of value {value}") - return any_value - - -def _encode_key_value(key: str, value: Any) -> PB2KeyValue: - any_value = _encode_value(value) - return PB2KeyValue(key=key, value=any_value) - - -def _encode_span_id(span_id: int) -> bytes: - return span_id.to_bytes(length=8, byteorder="big", signed=False) - - -def _encode_trace_id(trace_id: int) -> bytes: - return trace_id.to_bytes(length=16, byteorder="big", signed=False) diff --git a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/version.py b/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/version.py deleted file mode 100644 index 797af7e4..00000000 --- a/opensafely/_vendor/opentelemetry/exporter/otlp/proto/http/version.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -__version__ = "1.12.0" diff --git a/opensafely/_vendor/opentelemetry/proto/__init__.py b/opensafely/_vendor/opentelemetry/proto/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/collector/__init__.py b/opensafely/_vendor/opentelemetry/proto/collector/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py b/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py deleted file mode 100644 index a52d88cc..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py +++ /dev/null @@ -1,133 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/collector/logs/v1/logs_service.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.logs.v1 import logs_pb2 as opentelemetry_dot_proto_dot_logs_dot_v1_dot_logs__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/collector/logs/v1/logs_service.proto', - package='opentelemetry.proto.collector.logs.v1', - syntax='proto3', - serialized_options=b'\n(io.opentelemetry.proto.collector.logs.v1B\020LogsServiceProtoP\001Z0go.opentelemetry.io/proto/otlp/collector/logs/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n8opentelemetry/proto/collector/logs/v1/logs_service.proto\x12%opentelemetry.proto.collector.logs.v1\x1a&opentelemetry/proto/logs/v1/logs.proto\"\\\n\x18\x45xportLogsServiceRequest\x12@\n\rresource_logs\x18\x01 \x03(\x0b\x32).opentelemetry.proto.logs.v1.ResourceLogs\"\x1b\n\x19\x45xportLogsServiceResponse2\x9d\x01\n\x0bLogsService\x12\x8d\x01\n\x06\x45xport\x12?.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest\x1a@.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse\"\x00\x42p\n(io.opentelemetry.proto.collector.logs.v1B\x10LogsServiceProtoP\x01Z0go.opentelemetry.io/proto/otlp/collector/logs/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_logs_dot_v1_dot_logs__pb2.DESCRIPTOR,]) - - - - -_EXPORTLOGSSERVICEREQUEST = _descriptor.Descriptor( - name='ExportLogsServiceRequest', - full_name='opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_logs', full_name='opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resource_logs', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=139, - serialized_end=231, -) - - -_EXPORTLOGSSERVICERESPONSE = _descriptor.Descriptor( - name='ExportLogsServiceResponse', - full_name='opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=233, - serialized_end=260, -) - -_EXPORTLOGSSERVICEREQUEST.fields_by_name['resource_logs'].message_type = opentelemetry_dot_proto_dot_logs_dot_v1_dot_logs__pb2._RESOURCELOGS -DESCRIPTOR.message_types_by_name['ExportLogsServiceRequest'] = _EXPORTLOGSSERVICEREQUEST -DESCRIPTOR.message_types_by_name['ExportLogsServiceResponse'] = _EXPORTLOGSSERVICERESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ExportLogsServiceRequest = _reflection.GeneratedProtocolMessageType('ExportLogsServiceRequest', (_message.Message,), { - 'DESCRIPTOR' : _EXPORTLOGSSERVICEREQUEST, - '__module__' : 'opentelemetry.proto.collector.logs.v1.logs_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest) - }) -_sym_db.RegisterMessage(ExportLogsServiceRequest) - -ExportLogsServiceResponse = _reflection.GeneratedProtocolMessageType('ExportLogsServiceResponse', (_message.Message,), { - 'DESCRIPTOR' : _EXPORTLOGSSERVICERESPONSE, - '__module__' : 'opentelemetry.proto.collector.logs.v1.logs_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse) - }) -_sym_db.RegisterMessage(ExportLogsServiceResponse) - - -DESCRIPTOR._options = None - -_LOGSSERVICE = _descriptor.ServiceDescriptor( - name='LogsService', - full_name='opentelemetry.proto.collector.logs.v1.LogsService', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=263, - serialized_end=420, - methods=[ - _descriptor.MethodDescriptor( - name='Export', - full_name='opentelemetry.proto.collector.logs.v1.LogsService.Export', - index=0, - containing_service=None, - input_type=_EXPORTLOGSSERVICEREQUEST, - output_type=_EXPORTLOGSSERVICERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_LOGSSERVICE) - -DESCRIPTOR.services_by_name['LogsService'] = _LOGSSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.pyi deleted file mode 100644 index 5940c192..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2.pyi +++ /dev/null @@ -1,38 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.message -import opentelemetry.proto.logs.v1.logs_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class ExportLogsServiceRequest(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_LOGS_FIELD_NUMBER: builtins.int - @property - def resource_logs(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.logs.v1.logs_pb2.ResourceLogs]: - """An array of ResourceLogs. - For data coming from a single resource this array will typically contain one - element. Intermediary nodes (such as OpenTelemetry Collector) that receive - data from multiple origins typically batch the data before forwarding further and - in that case this array will contain multiple elements. - """ - pass - def __init__(self, - *, - resource_logs : typing.Optional[typing.Iterable[opentelemetry.proto.logs.v1.logs_pb2.ResourceLogs]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["resource_logs",b"resource_logs"]) -> None: ... -global___ExportLogsServiceRequest = ExportLogsServiceRequest - -class ExportLogsServiceResponse(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - def __init__(self, - ) -> None: ... -global___ExportLogsServiceResponse = ExportLogsServiceResponse diff --git a/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2_grpc.py b/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2_grpc.py deleted file mode 100644 index ca012c7a..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/logs/v1/logs_service_pb2_grpc.py +++ /dev/null @@ -1,77 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from opensafely._vendor.opentelemetry.proto.collector.logs.v1 import logs_service_pb2 as opentelemetry_dot_proto_dot_collector_dot_logs_dot_v1_dot_logs__service__pb2 - - -class LogsServiceStub(object): - """Service that can be used to push logs between one Application instrumented with - OpenTelemetry and an collector, or between an collector and a central collector (in this - case logs are sent/received to/from multiple Applications). - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.Export = channel.unary_unary( - '/opentelemetry.proto.collector.logs.v1.LogsService/Export', - request_serializer=opentelemetry_dot_proto_dot_collector_dot_logs_dot_v1_dot_logs__service__pb2.ExportLogsServiceRequest.SerializeToString, - response_deserializer=opentelemetry_dot_proto_dot_collector_dot_logs_dot_v1_dot_logs__service__pb2.ExportLogsServiceResponse.FromString, - ) - - -class LogsServiceServicer(object): - """Service that can be used to push logs between one Application instrumented with - OpenTelemetry and an collector, or between an collector and a central collector (in this - case logs are sent/received to/from multiple Applications). - """ - - def Export(self, request, context): - """For performance reasons, it is recommended to keep this RPC - alive for the entire life of the application. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_LogsServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'Export': grpc.unary_unary_rpc_method_handler( - servicer.Export, - request_deserializer=opentelemetry_dot_proto_dot_collector_dot_logs_dot_v1_dot_logs__service__pb2.ExportLogsServiceRequest.FromString, - response_serializer=opentelemetry_dot_proto_dot_collector_dot_logs_dot_v1_dot_logs__service__pb2.ExportLogsServiceResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'opentelemetry.proto.collector.logs.v1.LogsService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class LogsService(object): - """Service that can be used to push logs between one Application instrumented with - OpenTelemetry and an collector, or between an collector and a central collector (in this - case logs are sent/received to/from multiple Applications). - """ - - @staticmethod - def Export(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/opentelemetry.proto.collector.logs.v1.LogsService/Export', - opentelemetry_dot_proto_dot_collector_dot_logs_dot_v1_dot_logs__service__pb2.ExportLogsServiceRequest.SerializeToString, - opentelemetry_dot_proto_dot_collector_dot_logs_dot_v1_dot_logs__service__pb2.ExportLogsServiceResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/opensafely/_vendor/opentelemetry/proto/collector/metrics/__init__.py b/opensafely/_vendor/opentelemetry/proto/collector/metrics/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/__init__.py b/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py b/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py deleted file mode 100644 index c049b648..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py +++ /dev/null @@ -1,133 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.metrics.v1 import metrics_pb2 as opentelemetry_dot_proto_dot_metrics_dot_v1_dot_metrics__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/collector/metrics/v1/metrics_service.proto', - package='opentelemetry.proto.collector.metrics.v1', - syntax='proto3', - serialized_options=b'\n+io.opentelemetry.proto.collector.metrics.v1B\023MetricsServiceProtoP\001Z3go.opentelemetry.io/proto/otlp/collector/metrics/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n>opentelemetry/proto/collector/metrics/v1/metrics_service.proto\x12(opentelemetry.proto.collector.metrics.v1\x1a,opentelemetry/proto/metrics/v1/metrics.proto\"h\n\x1b\x45xportMetricsServiceRequest\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\x1e\n\x1c\x45xportMetricsServiceResponse2\xac\x01\n\x0eMetricsService\x12\x99\x01\n\x06\x45xport\x12\x45.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest\x1a\x46.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse\"\x00\x42y\n+io.opentelemetry.proto.collector.metrics.v1B\x13MetricsServiceProtoP\x01Z3go.opentelemetry.io/proto/otlp/collector/metrics/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_metrics_dot_v1_dot_metrics__pb2.DESCRIPTOR,]) - - - - -_EXPORTMETRICSSERVICEREQUEST = _descriptor.Descriptor( - name='ExportMetricsServiceRequest', - full_name='opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_metrics', full_name='opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resource_metrics', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=154, - serialized_end=258, -) - - -_EXPORTMETRICSSERVICERESPONSE = _descriptor.Descriptor( - name='ExportMetricsServiceResponse', - full_name='opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=260, - serialized_end=290, -) - -_EXPORTMETRICSSERVICEREQUEST.fields_by_name['resource_metrics'].message_type = opentelemetry_dot_proto_dot_metrics_dot_v1_dot_metrics__pb2._RESOURCEMETRICS -DESCRIPTOR.message_types_by_name['ExportMetricsServiceRequest'] = _EXPORTMETRICSSERVICEREQUEST -DESCRIPTOR.message_types_by_name['ExportMetricsServiceResponse'] = _EXPORTMETRICSSERVICERESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ExportMetricsServiceRequest = _reflection.GeneratedProtocolMessageType('ExportMetricsServiceRequest', (_message.Message,), { - 'DESCRIPTOR' : _EXPORTMETRICSSERVICEREQUEST, - '__module__' : 'opentelemetry.proto.collector.metrics.v1.metrics_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest) - }) -_sym_db.RegisterMessage(ExportMetricsServiceRequest) - -ExportMetricsServiceResponse = _reflection.GeneratedProtocolMessageType('ExportMetricsServiceResponse', (_message.Message,), { - 'DESCRIPTOR' : _EXPORTMETRICSSERVICERESPONSE, - '__module__' : 'opentelemetry.proto.collector.metrics.v1.metrics_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse) - }) -_sym_db.RegisterMessage(ExportMetricsServiceResponse) - - -DESCRIPTOR._options = None - -_METRICSSERVICE = _descriptor.ServiceDescriptor( - name='MetricsService', - full_name='opentelemetry.proto.collector.metrics.v1.MetricsService', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=293, - serialized_end=465, - methods=[ - _descriptor.MethodDescriptor( - name='Export', - full_name='opentelemetry.proto.collector.metrics.v1.MetricsService.Export', - index=0, - containing_service=None, - input_type=_EXPORTMETRICSSERVICEREQUEST, - output_type=_EXPORTMETRICSSERVICERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_METRICSSERVICE) - -DESCRIPTOR.services_by_name['MetricsService'] = _METRICSSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.pyi deleted file mode 100644 index 1acc1de3..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.pyi +++ /dev/null @@ -1,38 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.message -import opentelemetry.proto.metrics.v1.metrics_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class ExportMetricsServiceRequest(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_METRICS_FIELD_NUMBER: builtins.int - @property - def resource_metrics(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.metrics.v1.metrics_pb2.ResourceMetrics]: - """An array of ResourceMetrics. - For data coming from a single resource this array will typically contain one - element. Intermediary nodes (such as OpenTelemetry Collector) that receive - data from multiple origins typically batch the data before forwarding further and - in that case this array will contain multiple elements. - """ - pass - def __init__(self, - *, - resource_metrics : typing.Optional[typing.Iterable[opentelemetry.proto.metrics.v1.metrics_pb2.ResourceMetrics]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["resource_metrics",b"resource_metrics"]) -> None: ... -global___ExportMetricsServiceRequest = ExportMetricsServiceRequest - -class ExportMetricsServiceResponse(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - def __init__(self, - ) -> None: ... -global___ExportMetricsServiceResponse = ExportMetricsServiceResponse diff --git a/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2_grpc.py b/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2_grpc.py deleted file mode 100644 index a491c418..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2_grpc.py +++ /dev/null @@ -1,77 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from opensafely._vendor.opentelemetry.proto.collector.metrics.v1 import metrics_service_pb2 as opentelemetry_dot_proto_dot_collector_dot_metrics_dot_v1_dot_metrics__service__pb2 - - -class MetricsServiceStub(object): - """Service that can be used to push metrics between one Application - instrumented with OpenTelemetry and a collector, or between a collector and a - central collector. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.Export = channel.unary_unary( - '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export', - request_serializer=opentelemetry_dot_proto_dot_collector_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceRequest.SerializeToString, - response_deserializer=opentelemetry_dot_proto_dot_collector_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceResponse.FromString, - ) - - -class MetricsServiceServicer(object): - """Service that can be used to push metrics between one Application - instrumented with OpenTelemetry and a collector, or between a collector and a - central collector. - """ - - def Export(self, request, context): - """For performance reasons, it is recommended to keep this RPC - alive for the entire life of the application. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_MetricsServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'Export': grpc.unary_unary_rpc_method_handler( - servicer.Export, - request_deserializer=opentelemetry_dot_proto_dot_collector_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceRequest.FromString, - response_serializer=opentelemetry_dot_proto_dot_collector_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'opentelemetry.proto.collector.metrics.v1.MetricsService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class MetricsService(object): - """Service that can be used to push metrics between one Application - instrumented with OpenTelemetry and a collector, or between a collector and a - central collector. - """ - - @staticmethod - def Export(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export', - opentelemetry_dot_proto_dot_collector_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceRequest.SerializeToString, - opentelemetry_dot_proto_dot_collector_dot_metrics_dot_v1_dot_metrics__service__pb2.ExportMetricsServiceResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/opensafely/_vendor/opentelemetry/proto/collector/trace/__init__.py b/opensafely/_vendor/opentelemetry/proto/collector/trace/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/__init__.py b/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py b/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py deleted file mode 100644 index 189c4e11..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py +++ /dev/null @@ -1,133 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/collector/trace/v1/trace_service.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.trace.v1 import trace_pb2 as opentelemetry_dot_proto_dot_trace_dot_v1_dot_trace__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/collector/trace/v1/trace_service.proto', - package='opentelemetry.proto.collector.trace.v1', - syntax='proto3', - serialized_options=b'\n)io.opentelemetry.proto.collector.trace.v1B\021TraceServiceProtoP\001Z1go.opentelemetry.io/proto/otlp/collector/trace/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n:opentelemetry/proto/collector/trace/v1/trace_service.proto\x12&opentelemetry.proto.collector.trace.v1\x1a(opentelemetry/proto/trace/v1/trace.proto\"`\n\x19\x45xportTraceServiceRequest\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\x1c\n\x1a\x45xportTraceServiceResponse2\xa2\x01\n\x0cTraceService\x12\x91\x01\n\x06\x45xport\x12\x41.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest\x1a\x42.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse\"\x00\x42s\n)io.opentelemetry.proto.collector.trace.v1B\x11TraceServiceProtoP\x01Z1go.opentelemetry.io/proto/otlp/collector/trace/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_trace_dot_v1_dot_trace__pb2.DESCRIPTOR,]) - - - - -_EXPORTTRACESERVICEREQUEST = _descriptor.Descriptor( - name='ExportTraceServiceRequest', - full_name='opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_spans', full_name='opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resource_spans', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=144, - serialized_end=240, -) - - -_EXPORTTRACESERVICERESPONSE = _descriptor.Descriptor( - name='ExportTraceServiceResponse', - full_name='opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=242, - serialized_end=270, -) - -_EXPORTTRACESERVICEREQUEST.fields_by_name['resource_spans'].message_type = opentelemetry_dot_proto_dot_trace_dot_v1_dot_trace__pb2._RESOURCESPANS -DESCRIPTOR.message_types_by_name['ExportTraceServiceRequest'] = _EXPORTTRACESERVICEREQUEST -DESCRIPTOR.message_types_by_name['ExportTraceServiceResponse'] = _EXPORTTRACESERVICERESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ExportTraceServiceRequest = _reflection.GeneratedProtocolMessageType('ExportTraceServiceRequest', (_message.Message,), { - 'DESCRIPTOR' : _EXPORTTRACESERVICEREQUEST, - '__module__' : 'opentelemetry.proto.collector.trace.v1.trace_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest) - }) -_sym_db.RegisterMessage(ExportTraceServiceRequest) - -ExportTraceServiceResponse = _reflection.GeneratedProtocolMessageType('ExportTraceServiceResponse', (_message.Message,), { - 'DESCRIPTOR' : _EXPORTTRACESERVICERESPONSE, - '__module__' : 'opentelemetry.proto.collector.trace.v1.trace_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse) - }) -_sym_db.RegisterMessage(ExportTraceServiceResponse) - - -DESCRIPTOR._options = None - -_TRACESERVICE = _descriptor.ServiceDescriptor( - name='TraceService', - full_name='opentelemetry.proto.collector.trace.v1.TraceService', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=273, - serialized_end=435, - methods=[ - _descriptor.MethodDescriptor( - name='Export', - full_name='opentelemetry.proto.collector.trace.v1.TraceService.Export', - index=0, - containing_service=None, - input_type=_EXPORTTRACESERVICEREQUEST, - output_type=_EXPORTTRACESERVICERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_TRACESERVICE) - -DESCRIPTOR.services_by_name['TraceService'] = _TRACESERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.pyi deleted file mode 100644 index 7ed93e76..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2.pyi +++ /dev/null @@ -1,38 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.message -import opentelemetry.proto.trace.v1.trace_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class ExportTraceServiceRequest(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_SPANS_FIELD_NUMBER: builtins.int - @property - def resource_spans(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.trace.v1.trace_pb2.ResourceSpans]: - """An array of ResourceSpans. - For data coming from a single resource this array will typically contain one - element. Intermediary nodes (such as OpenTelemetry Collector) that receive - data from multiple origins typically batch the data before forwarding further and - in that case this array will contain multiple elements. - """ - pass - def __init__(self, - *, - resource_spans : typing.Optional[typing.Iterable[opentelemetry.proto.trace.v1.trace_pb2.ResourceSpans]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["resource_spans",b"resource_spans"]) -> None: ... -global___ExportTraceServiceRequest = ExportTraceServiceRequest - -class ExportTraceServiceResponse(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - def __init__(self, - ) -> None: ... -global___ExportTraceServiceResponse = ExportTraceServiceResponse diff --git a/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2_grpc.py b/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2_grpc.py deleted file mode 100644 index 279e2cad..00000000 --- a/opensafely/_vendor/opentelemetry/proto/collector/trace/v1/trace_service_pb2_grpc.py +++ /dev/null @@ -1,77 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from opensafely._vendor.opentelemetry.proto.collector.trace.v1 import trace_service_pb2 as opentelemetry_dot_proto_dot_collector_dot_trace_dot_v1_dot_trace__service__pb2 - - -class TraceServiceStub(object): - """Service that can be used to push spans between one Application instrumented with - OpenTelemetry and a collector, or between a collector and a central collector (in this - case spans are sent/received to/from multiple Applications). - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.Export = channel.unary_unary( - '/opentelemetry.proto.collector.trace.v1.TraceService/Export', - request_serializer=opentelemetry_dot_proto_dot_collector_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceRequest.SerializeToString, - response_deserializer=opentelemetry_dot_proto_dot_collector_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceResponse.FromString, - ) - - -class TraceServiceServicer(object): - """Service that can be used to push spans between one Application instrumented with - OpenTelemetry and a collector, or between a collector and a central collector (in this - case spans are sent/received to/from multiple Applications). - """ - - def Export(self, request, context): - """For performance reasons, it is recommended to keep this RPC - alive for the entire life of the application. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_TraceServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'Export': grpc.unary_unary_rpc_method_handler( - servicer.Export, - request_deserializer=opentelemetry_dot_proto_dot_collector_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceRequest.FromString, - response_serializer=opentelemetry_dot_proto_dot_collector_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'opentelemetry.proto.collector.trace.v1.TraceService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class TraceService(object): - """Service that can be used to push spans between one Application instrumented with - OpenTelemetry and a collector, or between a collector and a central collector (in this - case spans are sent/received to/from multiple Applications). - """ - - @staticmethod - def Export(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/opentelemetry.proto.collector.trace.v1.TraceService/Export', - opentelemetry_dot_proto_dot_collector_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceRequest.SerializeToString, - opentelemetry_dot_proto_dot_collector_dot_trace_dot_v1_dot_trace__service__pb2.ExportTraceServiceResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/opensafely/_vendor/opentelemetry/proto/common/__init__.py b/opensafely/_vendor/opentelemetry/proto/common/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/common/v1/__init__.py b/opensafely/_vendor/opentelemetry/proto/common/v1/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.py b/opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.py deleted file mode 100644 index 44d39a84..00000000 --- a/opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.py +++ /dev/null @@ -1,366 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/common/v1/common.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/common/v1/common.proto', - package='opentelemetry.proto.common.v1', - syntax='proto3', - serialized_options=b'\n io.opentelemetry.proto.common.v1B\013CommonProtoP\001Z(go.opentelemetry.io/proto/otlp/common/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n*opentelemetry/proto/common/v1/common.proto\x12\x1dopentelemetry.proto.common.v1\"\x8c\x02\n\x08\x41nyValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12@\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32).opentelemetry.proto.common.v1.ArrayValueH\x00\x12\x43\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32+.opentelemetry.proto.common.v1.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value\"E\n\nArrayValue\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\"G\n\x0cKeyValueList\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\"O\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\";\n\x16InstrumentationLibrary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t:\x02\x18\x01\"5\n\x14InstrumentationScope\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\tB[\n io.opentelemetry.proto.common.v1B\x0b\x43ommonProtoP\x01Z(go.opentelemetry.io/proto/otlp/common/v1b\x06proto3' -) - - - - -_ANYVALUE = _descriptor.Descriptor( - name='AnyValue', - full_name='opentelemetry.proto.common.v1.AnyValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='string_value', full_name='opentelemetry.proto.common.v1.AnyValue.string_value', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bool_value', full_name='opentelemetry.proto.common.v1.AnyValue.bool_value', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='int_value', full_name='opentelemetry.proto.common.v1.AnyValue.int_value', index=2, - number=3, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='double_value', full_name='opentelemetry.proto.common.v1.AnyValue.double_value', index=3, - number=4, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='array_value', full_name='opentelemetry.proto.common.v1.AnyValue.array_value', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='kvlist_value', full_name='opentelemetry.proto.common.v1.AnyValue.kvlist_value', index=5, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bytes_value', full_name='opentelemetry.proto.common.v1.AnyValue.bytes_value', index=6, - number=7, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='opentelemetry.proto.common.v1.AnyValue.value', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=78, - serialized_end=346, -) - - -_ARRAYVALUE = _descriptor.Descriptor( - name='ArrayValue', - full_name='opentelemetry.proto.common.v1.ArrayValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='values', full_name='opentelemetry.proto.common.v1.ArrayValue.values', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=348, - serialized_end=417, -) - - -_KEYVALUELIST = _descriptor.Descriptor( - name='KeyValueList', - full_name='opentelemetry.proto.common.v1.KeyValueList', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='values', full_name='opentelemetry.proto.common.v1.KeyValueList.values', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=419, - serialized_end=490, -) - - -_KEYVALUE = _descriptor.Descriptor( - name='KeyValue', - full_name='opentelemetry.proto.common.v1.KeyValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='key', full_name='opentelemetry.proto.common.v1.KeyValue.key', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='opentelemetry.proto.common.v1.KeyValue.value', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=492, - serialized_end=571, -) - - -_INSTRUMENTATIONLIBRARY = _descriptor.Descriptor( - name='InstrumentationLibrary', - full_name='opentelemetry.proto.common.v1.InstrumentationLibrary', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.common.v1.InstrumentationLibrary.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='version', full_name='opentelemetry.proto.common.v1.InstrumentationLibrary.version', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=573, - serialized_end=632, -) - - -_INSTRUMENTATIONSCOPE = _descriptor.Descriptor( - name='InstrumentationScope', - full_name='opentelemetry.proto.common.v1.InstrumentationScope', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.common.v1.InstrumentationScope.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='version', full_name='opentelemetry.proto.common.v1.InstrumentationScope.version', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=634, - serialized_end=687, -) - -_ANYVALUE.fields_by_name['array_value'].message_type = _ARRAYVALUE -_ANYVALUE.fields_by_name['kvlist_value'].message_type = _KEYVALUELIST -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['string_value']) -_ANYVALUE.fields_by_name['string_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['bool_value']) -_ANYVALUE.fields_by_name['bool_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['int_value']) -_ANYVALUE.fields_by_name['int_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['double_value']) -_ANYVALUE.fields_by_name['double_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['array_value']) -_ANYVALUE.fields_by_name['array_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['kvlist_value']) -_ANYVALUE.fields_by_name['kvlist_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['bytes_value']) -_ANYVALUE.fields_by_name['bytes_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ARRAYVALUE.fields_by_name['values'].message_type = _ANYVALUE -_KEYVALUELIST.fields_by_name['values'].message_type = _KEYVALUE -_KEYVALUE.fields_by_name['value'].message_type = _ANYVALUE -DESCRIPTOR.message_types_by_name['AnyValue'] = _ANYVALUE -DESCRIPTOR.message_types_by_name['ArrayValue'] = _ARRAYVALUE -DESCRIPTOR.message_types_by_name['KeyValueList'] = _KEYVALUELIST -DESCRIPTOR.message_types_by_name['KeyValue'] = _KEYVALUE -DESCRIPTOR.message_types_by_name['InstrumentationLibrary'] = _INSTRUMENTATIONLIBRARY -DESCRIPTOR.message_types_by_name['InstrumentationScope'] = _INSTRUMENTATIONSCOPE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -AnyValue = _reflection.GeneratedProtocolMessageType('AnyValue', (_message.Message,), { - 'DESCRIPTOR' : _ANYVALUE, - '__module__' : 'opentelemetry.proto.common.v1.common_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.AnyValue) - }) -_sym_db.RegisterMessage(AnyValue) - -ArrayValue = _reflection.GeneratedProtocolMessageType('ArrayValue', (_message.Message,), { - 'DESCRIPTOR' : _ARRAYVALUE, - '__module__' : 'opentelemetry.proto.common.v1.common_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.ArrayValue) - }) -_sym_db.RegisterMessage(ArrayValue) - -KeyValueList = _reflection.GeneratedProtocolMessageType('KeyValueList', (_message.Message,), { - 'DESCRIPTOR' : _KEYVALUELIST, - '__module__' : 'opentelemetry.proto.common.v1.common_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.KeyValueList) - }) -_sym_db.RegisterMessage(KeyValueList) - -KeyValue = _reflection.GeneratedProtocolMessageType('KeyValue', (_message.Message,), { - 'DESCRIPTOR' : _KEYVALUE, - '__module__' : 'opentelemetry.proto.common.v1.common_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.KeyValue) - }) -_sym_db.RegisterMessage(KeyValue) - -InstrumentationLibrary = _reflection.GeneratedProtocolMessageType('InstrumentationLibrary', (_message.Message,), { - 'DESCRIPTOR' : _INSTRUMENTATIONLIBRARY, - '__module__' : 'opentelemetry.proto.common.v1.common_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.InstrumentationLibrary) - }) -_sym_db.RegisterMessage(InstrumentationLibrary) - -InstrumentationScope = _reflection.GeneratedProtocolMessageType('InstrumentationScope', (_message.Message,), { - 'DESCRIPTOR' : _INSTRUMENTATIONSCOPE, - '__module__' : 'opentelemetry.proto.common.v1.common_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.InstrumentationScope) - }) -_sym_db.RegisterMessage(InstrumentationScope) - - -DESCRIPTOR._options = None -_INSTRUMENTATIONLIBRARY._options = None -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.pyi deleted file mode 100644 index 0d1ff4f0..00000000 --- a/opensafely/_vendor/opentelemetry/proto/common/v1/common_pb2.pyi +++ /dev/null @@ -1,150 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.message -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class AnyValue(google.protobuf.message.Message): - """AnyValue is used to represent any type of attribute value. AnyValue may contain a - primitive value such as a string or integer or it may contain an arbitrary nested - object containing arrays, key-value lists and primitives. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - STRING_VALUE_FIELD_NUMBER: builtins.int - BOOL_VALUE_FIELD_NUMBER: builtins.int - INT_VALUE_FIELD_NUMBER: builtins.int - DOUBLE_VALUE_FIELD_NUMBER: builtins.int - ARRAY_VALUE_FIELD_NUMBER: builtins.int - KVLIST_VALUE_FIELD_NUMBER: builtins.int - BYTES_VALUE_FIELD_NUMBER: builtins.int - string_value: typing.Text = ... - bool_value: builtins.bool = ... - int_value: builtins.int = ... - double_value: builtins.float = ... - @property - def array_value(self) -> global___ArrayValue: ... - @property - def kvlist_value(self) -> global___KeyValueList: ... - bytes_value: builtins.bytes = ... - def __init__(self, - *, - string_value : typing.Text = ..., - bool_value : builtins.bool = ..., - int_value : builtins.int = ..., - double_value : builtins.float = ..., - array_value : typing.Optional[global___ArrayValue] = ..., - kvlist_value : typing.Optional[global___KeyValueList] = ..., - bytes_value : builtins.bytes = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["array_value",b"array_value","bool_value",b"bool_value","bytes_value",b"bytes_value","double_value",b"double_value","int_value",b"int_value","kvlist_value",b"kvlist_value","string_value",b"string_value","value",b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["array_value",b"array_value","bool_value",b"bool_value","bytes_value",b"bytes_value","double_value",b"double_value","int_value",b"int_value","kvlist_value",b"kvlist_value","string_value",b"string_value","value",b"value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["value",b"value"]) -> typing.Optional[typing_extensions.Literal["string_value","bool_value","int_value","double_value","array_value","kvlist_value","bytes_value"]]: ... -global___AnyValue = AnyValue - -class ArrayValue(google.protobuf.message.Message): - """ArrayValue is a list of AnyValue messages. We need ArrayValue as a message - since oneof in AnyValue does not allow repeated fields. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - VALUES_FIELD_NUMBER: builtins.int - @property - def values(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___AnyValue]: - """Array of values. The array may be empty (contain 0 elements).""" - pass - def __init__(self, - *, - values : typing.Optional[typing.Iterable[global___AnyValue]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["values",b"values"]) -> None: ... -global___ArrayValue = ArrayValue - -class KeyValueList(google.protobuf.message.Message): - """KeyValueList is a list of KeyValue messages. We need KeyValueList as a message - since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need - a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to - avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches - are semantically equivalent. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - VALUES_FIELD_NUMBER: builtins.int - @property - def values(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___KeyValue]: - """A collection of key/value pairs of key-value pairs. The list may be empty (may - contain 0 elements). - The keys MUST be unique (it is not allowed to have more than one - value with the same key). - """ - pass - def __init__(self, - *, - values : typing.Optional[typing.Iterable[global___KeyValue]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["values",b"values"]) -> None: ... -global___KeyValueList = KeyValueList - -class KeyValue(google.protobuf.message.Message): - """KeyValue is a key-value pair that is used to store Span attributes, Link - attributes, etc. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - KEY_FIELD_NUMBER: builtins.int - VALUE_FIELD_NUMBER: builtins.int - key: typing.Text = ... - @property - def value(self) -> global___AnyValue: ... - def __init__(self, - *, - key : typing.Text = ..., - value : typing.Optional[global___AnyValue] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ... -global___KeyValue = KeyValue - -class InstrumentationLibrary(google.protobuf.message.Message): - """InstrumentationLibrary is a message representing the instrumentation library information - such as the fully qualified name and version. - InstrumentationLibrary is wire-compatible with InstrumentationScope for binary - Protobuf format. - This message is deprecated and will be removed on June 15, 2022. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - NAME_FIELD_NUMBER: builtins.int - VERSION_FIELD_NUMBER: builtins.int - name: typing.Text = ... - """An empty instrumentation library name means the name is unknown.""" - - version: typing.Text = ... - def __init__(self, - *, - name : typing.Text = ..., - version : typing.Text = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["name",b"name","version",b"version"]) -> None: ... -global___InstrumentationLibrary = InstrumentationLibrary - -class InstrumentationScope(google.protobuf.message.Message): - """InstrumentationScope is a message representing the instrumentation scope information - such as the fully qualified name and version. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - NAME_FIELD_NUMBER: builtins.int - VERSION_FIELD_NUMBER: builtins.int - name: typing.Text = ... - """An empty instrumentation scope name means the name is unknown.""" - - version: typing.Text = ... - def __init__(self, - *, - name : typing.Text = ..., - version : typing.Text = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["name",b"name","version",b"version"]) -> None: ... -global___InstrumentationScope = InstrumentationScope diff --git a/opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.py b/opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.py deleted file mode 100644 index 2f48a8e0..00000000 --- a/opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.py +++ /dev/null @@ -1,556 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/logs/v1/logs.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.common.v1 import common_pb2 as opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2 -from opensafely._vendor.opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/logs/v1/logs.proto', - package='opentelemetry.proto.logs.v1', - syntax='proto3', - serialized_options=b'\n\036io.opentelemetry.proto.logs.v1B\tLogsProtoP\001Z&go.opentelemetry.io/proto/otlp/logs/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n&opentelemetry/proto/logs/v1/logs.proto\x12\x1bopentelemetry.proto.logs.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"L\n\x08LogsData\x12@\n\rresource_logs\x18\x01 \x03(\x0b\x32).opentelemetry.proto.logs.v1.ResourceLogs\"\xff\x01\n\x0cResourceLogs\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12:\n\nscope_logs\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.ScopeLogs\x12\x62\n\x1cinstrumentation_library_logs\x18\xe8\x07 \x03(\x0b\x32\x37.opentelemetry.proto.logs.v1.InstrumentationLibraryLogsB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xa0\x01\n\tScopeLogs\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12;\n\x0blog_records\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.LogRecord\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc9\x01\n\x1aInstrumentationLibraryLogs\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12;\n\x0blog_records\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.LogRecord\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\xef\x02\n\tLogRecord\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x1f\n\x17observed_time_unix_nano\x18\x0b \x01(\x06\x12\x44\n\x0fseverity_number\x18\x02 \x01(\x0e\x32+.opentelemetry.proto.logs.v1.SeverityNumber\x12\x15\n\rseverity_text\x18\x03 \x01(\t\x12\x35\n\x04\x62ody\x18\x05 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\x12;\n\nattributes\x18\x06 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x07 \x01(\r\x12\r\n\x05\x66lags\x18\x08 \x01(\x07\x12\x10\n\x08trace_id\x18\t \x01(\x0c\x12\x0f\n\x07span_id\x18\n \x01(\x0cJ\x04\x08\x04\x10\x05*\xc3\x05\n\x0eSeverityNumber\x12\x1f\n\x1bSEVERITY_NUMBER_UNSPECIFIED\x10\x00\x12\x19\n\x15SEVERITY_NUMBER_TRACE\x10\x01\x12\x1a\n\x16SEVERITY_NUMBER_TRACE2\x10\x02\x12\x1a\n\x16SEVERITY_NUMBER_TRACE3\x10\x03\x12\x1a\n\x16SEVERITY_NUMBER_TRACE4\x10\x04\x12\x19\n\x15SEVERITY_NUMBER_DEBUG\x10\x05\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG2\x10\x06\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG3\x10\x07\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG4\x10\x08\x12\x18\n\x14SEVERITY_NUMBER_INFO\x10\t\x12\x19\n\x15SEVERITY_NUMBER_INFO2\x10\n\x12\x19\n\x15SEVERITY_NUMBER_INFO3\x10\x0b\x12\x19\n\x15SEVERITY_NUMBER_INFO4\x10\x0c\x12\x18\n\x14SEVERITY_NUMBER_WARN\x10\r\x12\x19\n\x15SEVERITY_NUMBER_WARN2\x10\x0e\x12\x19\n\x15SEVERITY_NUMBER_WARN3\x10\x0f\x12\x19\n\x15SEVERITY_NUMBER_WARN4\x10\x10\x12\x19\n\x15SEVERITY_NUMBER_ERROR\x10\x11\x12\x1a\n\x16SEVERITY_NUMBER_ERROR2\x10\x12\x12\x1a\n\x16SEVERITY_NUMBER_ERROR3\x10\x13\x12\x1a\n\x16SEVERITY_NUMBER_ERROR4\x10\x14\x12\x19\n\x15SEVERITY_NUMBER_FATAL\x10\x15\x12\x1a\n\x16SEVERITY_NUMBER_FATAL2\x10\x16\x12\x1a\n\x16SEVERITY_NUMBER_FATAL3\x10\x17\x12\x1a\n\x16SEVERITY_NUMBER_FATAL4\x10\x18*X\n\x0eLogRecordFlags\x12\x1f\n\x1bLOG_RECORD_FLAG_UNSPECIFIED\x10\x00\x12%\n LOG_RECORD_FLAG_TRACE_FLAGS_MASK\x10\xff\x01\x42U\n\x1eio.opentelemetry.proto.logs.v1B\tLogsProtoP\x01Z&go.opentelemetry.io/proto/otlp/logs/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - -_SEVERITYNUMBER = _descriptor.EnumDescriptor( - name='SeverityNumber', - full_name='opentelemetry.proto.logs.v1.SeverityNumber', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE2', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE3', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE4', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG', index=5, number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG2', index=6, number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG3', index=7, number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG4', index=8, number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO', index=9, number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO2', index=10, number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO3', index=11, number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO4', index=12, number=12, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN', index=13, number=13, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN2', index=14, number=14, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN3', index=15, number=15, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN4', index=16, number=16, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR', index=17, number=17, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR2', index=18, number=18, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR3', index=19, number=19, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR4', index=20, number=20, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL', index=21, number=21, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL2', index=22, number=22, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL3', index=23, number=23, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL4', index=24, number=24, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1237, - serialized_end=1944, -) -_sym_db.RegisterEnumDescriptor(_SEVERITYNUMBER) - -SeverityNumber = enum_type_wrapper.EnumTypeWrapper(_SEVERITYNUMBER) -_LOGRECORDFLAGS = _descriptor.EnumDescriptor( - name='LogRecordFlags', - full_name='opentelemetry.proto.logs.v1.LogRecordFlags', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='LOG_RECORD_FLAG_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LOG_RECORD_FLAG_TRACE_FLAGS_MASK', index=1, number=255, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1946, - serialized_end=2034, -) -_sym_db.RegisterEnumDescriptor(_LOGRECORDFLAGS) - -LogRecordFlags = enum_type_wrapper.EnumTypeWrapper(_LOGRECORDFLAGS) -SEVERITY_NUMBER_UNSPECIFIED = 0 -SEVERITY_NUMBER_TRACE = 1 -SEVERITY_NUMBER_TRACE2 = 2 -SEVERITY_NUMBER_TRACE3 = 3 -SEVERITY_NUMBER_TRACE4 = 4 -SEVERITY_NUMBER_DEBUG = 5 -SEVERITY_NUMBER_DEBUG2 = 6 -SEVERITY_NUMBER_DEBUG3 = 7 -SEVERITY_NUMBER_DEBUG4 = 8 -SEVERITY_NUMBER_INFO = 9 -SEVERITY_NUMBER_INFO2 = 10 -SEVERITY_NUMBER_INFO3 = 11 -SEVERITY_NUMBER_INFO4 = 12 -SEVERITY_NUMBER_WARN = 13 -SEVERITY_NUMBER_WARN2 = 14 -SEVERITY_NUMBER_WARN3 = 15 -SEVERITY_NUMBER_WARN4 = 16 -SEVERITY_NUMBER_ERROR = 17 -SEVERITY_NUMBER_ERROR2 = 18 -SEVERITY_NUMBER_ERROR3 = 19 -SEVERITY_NUMBER_ERROR4 = 20 -SEVERITY_NUMBER_FATAL = 21 -SEVERITY_NUMBER_FATAL2 = 22 -SEVERITY_NUMBER_FATAL3 = 23 -SEVERITY_NUMBER_FATAL4 = 24 -LOG_RECORD_FLAG_UNSPECIFIED = 0 -LOG_RECORD_FLAG_TRACE_FLAGS_MASK = 255 - - - -_LOGSDATA = _descriptor.Descriptor( - name='LogsData', - full_name='opentelemetry.proto.logs.v1.LogsData', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_logs', full_name='opentelemetry.proto.logs.v1.LogsData.resource_logs', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=163, - serialized_end=239, -) - - -_RESOURCELOGS = _descriptor.Descriptor( - name='ResourceLogs', - full_name='opentelemetry.proto.logs.v1.ResourceLogs', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.logs.v1.ResourceLogs.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scope_logs', full_name='opentelemetry.proto.logs.v1.ResourceLogs.scope_logs', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='instrumentation_library_logs', full_name='opentelemetry.proto.logs.v1.ResourceLogs.instrumentation_library_logs', index=2, - number=1000, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.logs.v1.ResourceLogs.schema_url', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=242, - serialized_end=497, -) - - -_SCOPELOGS = _descriptor.Descriptor( - name='ScopeLogs', - full_name='opentelemetry.proto.logs.v1.ScopeLogs', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='scope', full_name='opentelemetry.proto.logs.v1.ScopeLogs.scope', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='log_records', full_name='opentelemetry.proto.logs.v1.ScopeLogs.log_records', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.logs.v1.ScopeLogs.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=500, - serialized_end=660, -) - - -_INSTRUMENTATIONLIBRARYLOGS = _descriptor.Descriptor( - name='InstrumentationLibraryLogs', - full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='instrumentation_library', full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs.instrumentation_library', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='log_records', full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs.log_records', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=663, - serialized_end=864, -) - - -_LOGRECORD = _descriptor.Descriptor( - name='LogRecord', - full_name='opentelemetry.proto.logs.v1.LogRecord', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.logs.v1.LogRecord.time_unix_nano', index=0, - number=1, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='observed_time_unix_nano', full_name='opentelemetry.proto.logs.v1.LogRecord.observed_time_unix_nano', index=1, - number=11, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='severity_number', full_name='opentelemetry.proto.logs.v1.LogRecord.severity_number', index=2, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='severity_text', full_name='opentelemetry.proto.logs.v1.LogRecord.severity_text', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='body', full_name='opentelemetry.proto.logs.v1.LogRecord.body', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.logs.v1.LogRecord.attributes', index=5, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.logs.v1.LogRecord.dropped_attributes_count', index=6, - number=7, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.logs.v1.LogRecord.flags', index=7, - number=8, type=7, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.logs.v1.LogRecord.trace_id', index=8, - number=9, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.logs.v1.LogRecord.span_id', index=9, - number=10, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=867, - serialized_end=1234, -) - -_LOGSDATA.fields_by_name['resource_logs'].message_type = _RESOURCELOGS -_RESOURCELOGS.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_RESOURCELOGS.fields_by_name['scope_logs'].message_type = _SCOPELOGS -_RESOURCELOGS.fields_by_name['instrumentation_library_logs'].message_type = _INSTRUMENTATIONLIBRARYLOGS -_SCOPELOGS.fields_by_name['scope'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONSCOPE -_SCOPELOGS.fields_by_name['log_records'].message_type = _LOGRECORD -_INSTRUMENTATIONLIBRARYLOGS.fields_by_name['instrumentation_library'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONLIBRARY -_INSTRUMENTATIONLIBRARYLOGS.fields_by_name['log_records'].message_type = _LOGRECORD -_LOGRECORD.fields_by_name['severity_number'].enum_type = _SEVERITYNUMBER -_LOGRECORD.fields_by_name['body'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._ANYVALUE -_LOGRECORD.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -DESCRIPTOR.message_types_by_name['LogsData'] = _LOGSDATA -DESCRIPTOR.message_types_by_name['ResourceLogs'] = _RESOURCELOGS -DESCRIPTOR.message_types_by_name['ScopeLogs'] = _SCOPELOGS -DESCRIPTOR.message_types_by_name['InstrumentationLibraryLogs'] = _INSTRUMENTATIONLIBRARYLOGS -DESCRIPTOR.message_types_by_name['LogRecord'] = _LOGRECORD -DESCRIPTOR.enum_types_by_name['SeverityNumber'] = _SEVERITYNUMBER -DESCRIPTOR.enum_types_by_name['LogRecordFlags'] = _LOGRECORDFLAGS -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -LogsData = _reflection.GeneratedProtocolMessageType('LogsData', (_message.Message,), { - 'DESCRIPTOR' : _LOGSDATA, - '__module__' : 'opentelemetry.proto.logs.v1.logs_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.logs.v1.LogsData) - }) -_sym_db.RegisterMessage(LogsData) - -ResourceLogs = _reflection.GeneratedProtocolMessageType('ResourceLogs', (_message.Message,), { - 'DESCRIPTOR' : _RESOURCELOGS, - '__module__' : 'opentelemetry.proto.logs.v1.logs_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.logs.v1.ResourceLogs) - }) -_sym_db.RegisterMessage(ResourceLogs) - -ScopeLogs = _reflection.GeneratedProtocolMessageType('ScopeLogs', (_message.Message,), { - 'DESCRIPTOR' : _SCOPELOGS, - '__module__' : 'opentelemetry.proto.logs.v1.logs_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.logs.v1.ScopeLogs) - }) -_sym_db.RegisterMessage(ScopeLogs) - -InstrumentationLibraryLogs = _reflection.GeneratedProtocolMessageType('InstrumentationLibraryLogs', (_message.Message,), { - 'DESCRIPTOR' : _INSTRUMENTATIONLIBRARYLOGS, - '__module__' : 'opentelemetry.proto.logs.v1.logs_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.logs.v1.InstrumentationLibraryLogs) - }) -_sym_db.RegisterMessage(InstrumentationLibraryLogs) - -LogRecord = _reflection.GeneratedProtocolMessageType('LogRecord', (_message.Message,), { - 'DESCRIPTOR' : _LOGRECORD, - '__module__' : 'opentelemetry.proto.logs.v1.logs_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.logs.v1.LogRecord) - }) -_sym_db.RegisterMessage(LogRecord) - - -DESCRIPTOR._options = None -_RESOURCELOGS.fields_by_name['instrumentation_library_logs']._options = None -_INSTRUMENTATIONLIBRARYLOGS._options = None -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.pyi deleted file mode 100644 index db4da2af..00000000 --- a/opensafely/_vendor/opentelemetry/proto/logs/v1/logs_pb2.pyi +++ /dev/null @@ -1,356 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.internal.enum_type_wrapper -import google.protobuf.message -import opentelemetry.proto.common.v1.common_pb2 -import opentelemetry.proto.resource.v1.resource_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class SeverityNumber(_SeverityNumber, metaclass=_SeverityNumberEnumTypeWrapper): - """Possible values for LogRecord.SeverityNumber.""" - pass -class _SeverityNumber: - V = typing.NewType('V', builtins.int) -class _SeverityNumberEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_SeverityNumber.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - SEVERITY_NUMBER_UNSPECIFIED = SeverityNumber.V(0) - """UNSPECIFIED is the default SeverityNumber, it MUST NOT be used.""" - - SEVERITY_NUMBER_TRACE = SeverityNumber.V(1) - SEVERITY_NUMBER_TRACE2 = SeverityNumber.V(2) - SEVERITY_NUMBER_TRACE3 = SeverityNumber.V(3) - SEVERITY_NUMBER_TRACE4 = SeverityNumber.V(4) - SEVERITY_NUMBER_DEBUG = SeverityNumber.V(5) - SEVERITY_NUMBER_DEBUG2 = SeverityNumber.V(6) - SEVERITY_NUMBER_DEBUG3 = SeverityNumber.V(7) - SEVERITY_NUMBER_DEBUG4 = SeverityNumber.V(8) - SEVERITY_NUMBER_INFO = SeverityNumber.V(9) - SEVERITY_NUMBER_INFO2 = SeverityNumber.V(10) - SEVERITY_NUMBER_INFO3 = SeverityNumber.V(11) - SEVERITY_NUMBER_INFO4 = SeverityNumber.V(12) - SEVERITY_NUMBER_WARN = SeverityNumber.V(13) - SEVERITY_NUMBER_WARN2 = SeverityNumber.V(14) - SEVERITY_NUMBER_WARN3 = SeverityNumber.V(15) - SEVERITY_NUMBER_WARN4 = SeverityNumber.V(16) - SEVERITY_NUMBER_ERROR = SeverityNumber.V(17) - SEVERITY_NUMBER_ERROR2 = SeverityNumber.V(18) - SEVERITY_NUMBER_ERROR3 = SeverityNumber.V(19) - SEVERITY_NUMBER_ERROR4 = SeverityNumber.V(20) - SEVERITY_NUMBER_FATAL = SeverityNumber.V(21) - SEVERITY_NUMBER_FATAL2 = SeverityNumber.V(22) - SEVERITY_NUMBER_FATAL3 = SeverityNumber.V(23) - SEVERITY_NUMBER_FATAL4 = SeverityNumber.V(24) - -SEVERITY_NUMBER_UNSPECIFIED = SeverityNumber.V(0) -"""UNSPECIFIED is the default SeverityNumber, it MUST NOT be used.""" - -SEVERITY_NUMBER_TRACE = SeverityNumber.V(1) -SEVERITY_NUMBER_TRACE2 = SeverityNumber.V(2) -SEVERITY_NUMBER_TRACE3 = SeverityNumber.V(3) -SEVERITY_NUMBER_TRACE4 = SeverityNumber.V(4) -SEVERITY_NUMBER_DEBUG = SeverityNumber.V(5) -SEVERITY_NUMBER_DEBUG2 = SeverityNumber.V(6) -SEVERITY_NUMBER_DEBUG3 = SeverityNumber.V(7) -SEVERITY_NUMBER_DEBUG4 = SeverityNumber.V(8) -SEVERITY_NUMBER_INFO = SeverityNumber.V(9) -SEVERITY_NUMBER_INFO2 = SeverityNumber.V(10) -SEVERITY_NUMBER_INFO3 = SeverityNumber.V(11) -SEVERITY_NUMBER_INFO4 = SeverityNumber.V(12) -SEVERITY_NUMBER_WARN = SeverityNumber.V(13) -SEVERITY_NUMBER_WARN2 = SeverityNumber.V(14) -SEVERITY_NUMBER_WARN3 = SeverityNumber.V(15) -SEVERITY_NUMBER_WARN4 = SeverityNumber.V(16) -SEVERITY_NUMBER_ERROR = SeverityNumber.V(17) -SEVERITY_NUMBER_ERROR2 = SeverityNumber.V(18) -SEVERITY_NUMBER_ERROR3 = SeverityNumber.V(19) -SEVERITY_NUMBER_ERROR4 = SeverityNumber.V(20) -SEVERITY_NUMBER_FATAL = SeverityNumber.V(21) -SEVERITY_NUMBER_FATAL2 = SeverityNumber.V(22) -SEVERITY_NUMBER_FATAL3 = SeverityNumber.V(23) -SEVERITY_NUMBER_FATAL4 = SeverityNumber.V(24) -global___SeverityNumber = SeverityNumber - - -class LogRecordFlags(_LogRecordFlags, metaclass=_LogRecordFlagsEnumTypeWrapper): - """Masks for LogRecord.flags field.""" - pass -class _LogRecordFlags: - V = typing.NewType('V', builtins.int) -class _LogRecordFlagsEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_LogRecordFlags.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - LOG_RECORD_FLAG_UNSPECIFIED = LogRecordFlags.V(0) - LOG_RECORD_FLAG_TRACE_FLAGS_MASK = LogRecordFlags.V(255) - -LOG_RECORD_FLAG_UNSPECIFIED = LogRecordFlags.V(0) -LOG_RECORD_FLAG_TRACE_FLAGS_MASK = LogRecordFlags.V(255) -global___LogRecordFlags = LogRecordFlags - - -class LogsData(google.protobuf.message.Message): - """LogsData represents the logs data that can be stored in a persistent storage, - OR can be embedded by other protocols that transfer OTLP logs data but do not - implement the OTLP protocol. - - The main difference between this message and collector protocol is that - in this message there will not be any "control" or "metadata" specific to - OTLP protocol. - - When new fields are added into this message, the OTLP request MUST be updated - as well. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_LOGS_FIELD_NUMBER: builtins.int - @property - def resource_logs(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ResourceLogs]: - """An array of ResourceLogs. - For data coming from a single resource this array will typically contain - one element. Intermediary nodes that receive data from multiple origins - typically batch the data before forwarding further and in that case this - array will contain multiple elements. - """ - pass - def __init__(self, - *, - resource_logs : typing.Optional[typing.Iterable[global___ResourceLogs]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["resource_logs",b"resource_logs"]) -> None: ... -global___LogsData = LogsData - -class ResourceLogs(google.protobuf.message.Message): - """A collection of ScopeLogs from a Resource.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_FIELD_NUMBER: builtins.int - SCOPE_LOGS_FIELD_NUMBER: builtins.int - INSTRUMENTATION_LIBRARY_LOGS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def resource(self) -> opentelemetry.proto.resource.v1.resource_pb2.Resource: - """The resource for the logs in this message. - If this field is not set then resource info is unknown. - """ - pass - @property - def scope_logs(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ScopeLogs]: - """A list of ScopeLogs that originate from a resource.""" - pass - @property - def instrumentation_library_logs(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___InstrumentationLibraryLogs]: - """A list of InstrumentationLibraryLogs that originate from a resource. - This field is deprecated and will be removed after grace period expires on June 15, 2022. - - During the grace period the following rules SHOULD be followed: - - For Binary Protobufs - ==================== - Binary Protobuf senders SHOULD NOT set instrumentation_library_logs. Instead - scope_logs SHOULD be set. - - Binary Protobuf receivers SHOULD check if instrumentation_library_logs is set - and scope_logs is not set then the value in instrumentation_library_logs - SHOULD be used instead by converting InstrumentationLibraryLogs into ScopeLogs. - If scope_logs is set then instrumentation_library_logs SHOULD be ignored. - - For JSON - ======== - JSON senders that set instrumentation_library_logs field MAY also set - scope_logs to carry the same logs, essentially double-publishing the same data. - Such double-publishing MAY be controlled by a user-settable option. - If double-publishing is not used then the senders SHOULD set scope_logs and - SHOULD NOT set instrumentation_library_logs. - - JSON receivers SHOULD check if instrumentation_library_logs is set and - scope_logs is not set then the value in instrumentation_library_logs - SHOULD be used instead by converting InstrumentationLibraryLogs into ScopeLogs. - If scope_logs is set then instrumentation_library_logs field SHOULD be ignored. - """ - pass - schema_url: typing.Text = ... - """This schema_url applies to the data in the "resource" field. It does not apply - to the data in the "scope_logs" field which have their own schema_url field. - """ - - def __init__(self, - *, - resource : typing.Optional[opentelemetry.proto.resource.v1.resource_pb2.Resource] = ..., - scope_logs : typing.Optional[typing.Iterable[global___ScopeLogs]] = ..., - instrumentation_library_logs : typing.Optional[typing.Iterable[global___InstrumentationLibraryLogs]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["resource",b"resource"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["instrumentation_library_logs",b"instrumentation_library_logs","resource",b"resource","schema_url",b"schema_url","scope_logs",b"scope_logs"]) -> None: ... -global___ResourceLogs = ResourceLogs - -class ScopeLogs(google.protobuf.message.Message): - """A collection of Logs produced by a Scope.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - SCOPE_FIELD_NUMBER: builtins.int - LOG_RECORDS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def scope(self) -> opentelemetry.proto.common.v1.common_pb2.InstrumentationScope: - """The instrumentation scope information for the logs in this message. - Semantically when InstrumentationScope isn't set, it is equivalent with - an empty instrumentation scope name (unknown). - """ - pass - @property - def log_records(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___LogRecord]: - """A list of log records.""" - pass - schema_url: typing.Text = ... - """This schema_url applies to all logs in the "logs" field.""" - - def __init__(self, - *, - scope : typing.Optional[opentelemetry.proto.common.v1.common_pb2.InstrumentationScope] = ..., - log_records : typing.Optional[typing.Iterable[global___LogRecord]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["scope",b"scope"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["log_records",b"log_records","schema_url",b"schema_url","scope",b"scope"]) -> None: ... -global___ScopeLogs = ScopeLogs - -class InstrumentationLibraryLogs(google.protobuf.message.Message): - """A collection of Logs produced by an InstrumentationLibrary. - InstrumentationLibraryLogs is wire-compatible with ScopeLogs for binary - Protobuf format. - This message is deprecated and will be removed on June 15, 2022. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - INSTRUMENTATION_LIBRARY_FIELD_NUMBER: builtins.int - LOG_RECORDS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def instrumentation_library(self) -> opentelemetry.proto.common.v1.common_pb2.InstrumentationLibrary: - """The instrumentation library information for the logs in this message. - Semantically when InstrumentationLibrary isn't set, it is equivalent with - an empty instrumentation library name (unknown). - """ - pass - @property - def log_records(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___LogRecord]: - """A list of logs that originate from an instrumentation library.""" - pass - schema_url: typing.Text = ... - """This schema_url applies to all logs in the "logs" field.""" - - def __init__(self, - *, - instrumentation_library : typing.Optional[opentelemetry.proto.common.v1.common_pb2.InstrumentationLibrary] = ..., - log_records : typing.Optional[typing.Iterable[global___LogRecord]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["instrumentation_library",b"instrumentation_library"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["instrumentation_library",b"instrumentation_library","log_records",b"log_records","schema_url",b"schema_url"]) -> None: ... -global___InstrumentationLibraryLogs = InstrumentationLibraryLogs - -class LogRecord(google.protobuf.message.Message): - """A log record according to OpenTelemetry Log Data Model: - https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - OBSERVED_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - SEVERITY_NUMBER_FIELD_NUMBER: builtins.int - SEVERITY_TEXT_FIELD_NUMBER: builtins.int - BODY_FIELD_NUMBER: builtins.int - ATTRIBUTES_FIELD_NUMBER: builtins.int - DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int - FLAGS_FIELD_NUMBER: builtins.int - TRACE_ID_FIELD_NUMBER: builtins.int - SPAN_ID_FIELD_NUMBER: builtins.int - time_unix_nano: builtins.int = ... - """time_unix_nano is the time when the event occurred. - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - Value of 0 indicates unknown or missing timestamp. - """ - - observed_time_unix_nano: builtins.int = ... - """Time when the event was observed by the collection system. - For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK) - this timestamp is typically set at the generation time and is equal to Timestamp. - For events originating externally and collected by OpenTelemetry (e.g. using - Collector) this is the time when OpenTelemetry's code observed the event measured - by the clock of the OpenTelemetry code. This field MUST be set once the event is - observed by OpenTelemetry. - - For converting OpenTelemetry log data to formats that support only one timestamp or - when receiving OpenTelemetry log data by recipients that support only one timestamp - internally the following logic is recommended: - - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - Value of 0 indicates unknown or missing timestamp. - """ - - severity_number: global___SeverityNumber.V = ... - """Numerical value of the severity, normalized to values described in Log Data Model. - [Optional]. - """ - - severity_text: typing.Text = ... - """The severity text (also known as log level). The original string representation as - it is known at the source. [Optional]. - """ - - @property - def body(self) -> opentelemetry.proto.common.v1.common_pb2.AnyValue: - """A value containing the body of the log record. Can be for example a human-readable - string message (including multi-line) describing the event in a free form or it can - be a structured data composed of arrays and maps of other values. [Optional]. - """ - pass - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """Additional attributes that describe the specific event occurrence. [Optional]. - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - dropped_attributes_count: builtins.int = ... - flags: builtins.int = ... - """Flags, a bit field. 8 least significant bits are the trace flags as - defined in W3C Trace Context specification. 24 most significant bits are reserved - and must be set to 0. Readers must not assume that 24 most significant bits - will be zero and must correctly mask the bits when reading 8-bit trace flag (use - flags & TRACE_FLAGS_MASK). [Optional]. - """ - - trace_id: builtins.bytes = ... - """A unique identifier for a trace. All logs from the same trace share - the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes - is considered invalid. Can be set for logs that are part of request processing - and have an assigned trace id. [Optional]. - """ - - span_id: builtins.bytes = ... - """A unique identifier for a span within a trace, assigned when the span - is created. The ID is an 8-byte array. An ID with all zeroes is considered - invalid. Can be set for logs that are part of a particular processing span. - If span_id is present trace_id SHOULD be also present. [Optional]. - """ - - def __init__(self, - *, - time_unix_nano : builtins.int = ..., - observed_time_unix_nano : builtins.int = ..., - severity_number : global___SeverityNumber.V = ..., - severity_text : typing.Text = ..., - body : typing.Optional[opentelemetry.proto.common.v1.common_pb2.AnyValue] = ..., - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - dropped_attributes_count : builtins.int = ..., - flags : builtins.int = ..., - trace_id : builtins.bytes = ..., - span_id : builtins.bytes = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["body",b"body"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","body",b"body","dropped_attributes_count",b"dropped_attributes_count","flags",b"flags","observed_time_unix_nano",b"observed_time_unix_nano","severity_number",b"severity_number","severity_text",b"severity_text","span_id",b"span_id","time_unix_nano",b"time_unix_nano","trace_id",b"trace_id"]) -> None: ... -global___LogRecord = LogRecord diff --git a/opensafely/_vendor/opentelemetry/proto/metrics/__init__.py b/opensafely/_vendor/opentelemetry/proto/metrics/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py b/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py deleted file mode 100644 index 4557a9d9..00000000 --- a/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/metrics/experimental/metrics_config_service.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/metrics/experimental/metrics_config_service.proto', - package='opentelemetry.proto.metrics.experimental', - syntax='proto3', - serialized_options=b'\n+io.opentelemetry.proto.metrics.experimentalB\030MetricConfigServiceProtoP\001ZIgithub.com/open-telemetry/opentelemetry-proto/gen/go/metrics/experimental', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\nEopentelemetry/proto/metrics/experimental/metrics_config_service.proto\x12(opentelemetry.proto.metrics.experimental\x1a.opentelemetry/proto/resource/v1/resource.proto\"r\n\x13MetricConfigRequest\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12\x1e\n\x16last_known_fingerprint\x18\x02 \x01(\x0c\"\xe0\x03\n\x14MetricConfigResponse\x12\x13\n\x0b\x66ingerprint\x18\x01 \x01(\x0c\x12Z\n\tschedules\x18\x02 \x03(\x0b\x32G.opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule\x12\x1f\n\x17suggested_wait_time_sec\x18\x03 \x01(\x05\x1a\xb5\x02\n\x08Schedule\x12k\n\x12\x65xclusion_patterns\x18\x01 \x03(\x0b\x32O.opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern\x12k\n\x12inclusion_patterns\x18\x02 \x03(\x0b\x32O.opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern\x12\x12\n\nperiod_sec\x18\x03 \x01(\x05\x1a;\n\x07Pattern\x12\x10\n\x06\x65quals\x18\x01 \x01(\tH\x00\x12\x15\n\x0bstarts_with\x18\x02 \x01(\tH\x00\x42\x07\n\x05match2\xa1\x01\n\x0cMetricConfig\x12\x90\x01\n\x0fGetMetricConfig\x12=.opentelemetry.proto.metrics.experimental.MetricConfigRequest\x1a>.opentelemetry.proto.metrics.experimental.MetricConfigResponseB\x94\x01\n+io.opentelemetry.proto.metrics.experimentalB\x18MetricConfigServiceProtoP\x01ZIgithub.com/open-telemetry/opentelemetry-proto/gen/go/metrics/experimentalb\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - - - - -_METRICCONFIGREQUEST = _descriptor.Descriptor( - name='MetricConfigRequest', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.metrics.experimental.MetricConfigRequest.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='last_known_fingerprint', full_name='opentelemetry.proto.metrics.experimental.MetricConfigRequest.last_known_fingerprint', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=163, - serialized_end=277, -) - - -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN = _descriptor.Descriptor( - name='Pattern', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='equals', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern.equals', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='starts_with', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern.starts_with', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='match', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern.match', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=701, - serialized_end=760, -) - -_METRICCONFIGRESPONSE_SCHEDULE = _descriptor.Descriptor( - name='Schedule', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='exclusion_patterns', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.exclusion_patterns', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='inclusion_patterns', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.inclusion_patterns', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='period_sec', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.period_sec', index=2, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_METRICCONFIGRESPONSE_SCHEDULE_PATTERN, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=451, - serialized_end=760, -) - -_METRICCONFIGRESPONSE = _descriptor.Descriptor( - name='MetricConfigResponse', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='fingerprint', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.fingerprint', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schedules', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.schedules', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='suggested_wait_time_sec', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.suggested_wait_time_sec', index=2, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_METRICCONFIGRESPONSE_SCHEDULE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=280, - serialized_end=760, -) - -_METRICCONFIGREQUEST.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.containing_type = _METRICCONFIGRESPONSE_SCHEDULE -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'].fields.append( - _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['equals']) -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['equals'].containing_oneof = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'] -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'].fields.append( - _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['starts_with']) -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['starts_with'].containing_oneof = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'] -_METRICCONFIGRESPONSE_SCHEDULE.fields_by_name['exclusion_patterns'].message_type = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN -_METRICCONFIGRESPONSE_SCHEDULE.fields_by_name['inclusion_patterns'].message_type = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN -_METRICCONFIGRESPONSE_SCHEDULE.containing_type = _METRICCONFIGRESPONSE -_METRICCONFIGRESPONSE.fields_by_name['schedules'].message_type = _METRICCONFIGRESPONSE_SCHEDULE -DESCRIPTOR.message_types_by_name['MetricConfigRequest'] = _METRICCONFIGREQUEST -DESCRIPTOR.message_types_by_name['MetricConfigResponse'] = _METRICCONFIGRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -MetricConfigRequest = _reflection.GeneratedProtocolMessageType('MetricConfigRequest', (_message.Message,), { - 'DESCRIPTOR' : _METRICCONFIGREQUEST, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigRequest) - }) -_sym_db.RegisterMessage(MetricConfigRequest) - -MetricConfigResponse = _reflection.GeneratedProtocolMessageType('MetricConfigResponse', (_message.Message,), { - - 'Schedule' : _reflection.GeneratedProtocolMessageType('Schedule', (_message.Message,), { - - 'Pattern' : _reflection.GeneratedProtocolMessageType('Pattern', (_message.Message,), { - 'DESCRIPTOR' : _METRICCONFIGRESPONSE_SCHEDULE_PATTERN, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern) - }) - , - 'DESCRIPTOR' : _METRICCONFIGRESPONSE_SCHEDULE, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule) - }) - , - 'DESCRIPTOR' : _METRICCONFIGRESPONSE, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigResponse) - }) -_sym_db.RegisterMessage(MetricConfigResponse) -_sym_db.RegisterMessage(MetricConfigResponse.Schedule) -_sym_db.RegisterMessage(MetricConfigResponse.Schedule.Pattern) - - -DESCRIPTOR._options = None - -_METRICCONFIG = _descriptor.ServiceDescriptor( - name='MetricConfig', - full_name='opentelemetry.proto.metrics.experimental.MetricConfig', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=763, - serialized_end=924, - methods=[ - _descriptor.MethodDescriptor( - name='GetMetricConfig', - full_name='opentelemetry.proto.metrics.experimental.MetricConfig.GetMetricConfig', - index=0, - containing_service=None, - input_type=_METRICCONFIGREQUEST, - output_type=_METRICCONFIGRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_METRICCONFIG) - -DESCRIPTOR.services_by_name['MetricConfig'] = _METRICCONFIG - -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi deleted file mode 100644 index ee805080..00000000 --- a/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi +++ /dev/null @@ -1,136 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.message -import opentelemetry.proto.resource.v1.resource_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class MetricConfigRequest(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_FIELD_NUMBER: builtins.int - LAST_KNOWN_FINGERPRINT_FIELD_NUMBER: builtins.int - @property - def resource(self) -> opentelemetry.proto.resource.v1.resource_pb2.Resource: - """Required. The resource for which configuration should be returned.""" - pass - last_known_fingerprint: builtins.bytes = ... - """Optional. The value of MetricConfigResponse.fingerprint for the last - configuration that the caller received and successfully applied. - """ - - def __init__(self, - *, - resource : typing.Optional[opentelemetry.proto.resource.v1.resource_pb2.Resource] = ..., - last_known_fingerprint : builtins.bytes = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["resource",b"resource"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["last_known_fingerprint",b"last_known_fingerprint","resource",b"resource"]) -> None: ... -global___MetricConfigRequest = MetricConfigRequest - -class MetricConfigResponse(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class Schedule(google.protobuf.message.Message): - """A Schedule is used to apply a particular scheduling configuration to - a metric. If a metric name matches a schedule's patterns, then the metric - adopts the configuration specified by the schedule. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class Pattern(google.protobuf.message.Message): - """A light-weight pattern that can match 1 or more - metrics, for which this schedule will apply. The string is used to - match against metric names. It should not exceed 100k characters. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - EQUALS_FIELD_NUMBER: builtins.int - STARTS_WITH_FIELD_NUMBER: builtins.int - equals: typing.Text = ... - """matches the metric name exactly""" - - starts_with: typing.Text = ... - """prefix-matches the metric name""" - - def __init__(self, - *, - equals : typing.Text = ..., - starts_with : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["equals",b"equals","match",b"match","starts_with",b"starts_with"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["equals",b"equals","match",b"match","starts_with",b"starts_with"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["match",b"match"]) -> typing.Optional[typing_extensions.Literal["equals","starts_with"]]: ... - - EXCLUSION_PATTERNS_FIELD_NUMBER: builtins.int - INCLUSION_PATTERNS_FIELD_NUMBER: builtins.int - PERIOD_SEC_FIELD_NUMBER: builtins.int - @property - def exclusion_patterns(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MetricConfigResponse.Schedule.Pattern]: - """Metrics with names that match a rule in the inclusion_patterns are - targeted by this schedule. Metrics that match the exclusion_patterns - are not targeted for this schedule, even if they match an inclusion - pattern. - """ - pass - @property - def inclusion_patterns(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MetricConfigResponse.Schedule.Pattern]: ... - period_sec: builtins.int = ... - """Describes the collection period for each metric in seconds. - A period of 0 means to not export. - """ - - def __init__(self, - *, - exclusion_patterns : typing.Optional[typing.Iterable[global___MetricConfigResponse.Schedule.Pattern]] = ..., - inclusion_patterns : typing.Optional[typing.Iterable[global___MetricConfigResponse.Schedule.Pattern]] = ..., - period_sec : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["exclusion_patterns",b"exclusion_patterns","inclusion_patterns",b"inclusion_patterns","period_sec",b"period_sec"]) -> None: ... - - FINGERPRINT_FIELD_NUMBER: builtins.int - SCHEDULES_FIELD_NUMBER: builtins.int - SUGGESTED_WAIT_TIME_SEC_FIELD_NUMBER: builtins.int - fingerprint: builtins.bytes = ... - """Optional. The fingerprint associated with this MetricConfigResponse. Each - change in configs yields a different fingerprint. The resource SHOULD copy - this value to MetricConfigRequest.last_known_fingerprint for the next - configuration request. If there are no changes between fingerprint and - MetricConfigRequest.last_known_fingerprint, then all other fields besides - fingerprint in the response are optional, or the same as the last update if - present. - - The exact mechanics of generating the fingerprint is up to the - implementation. However, a fingerprint must be deterministically determined - by the configurations -- the same configuration will generate the same - fingerprint on any instance of an implementation. Hence using a timestamp is - unacceptable, but a deterministic hash is fine. - """ - - @property - def schedules(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MetricConfigResponse.Schedule]: - """A single metric may match multiple schedules. In such cases, the schedule - that specifies the smallest period is applied. - - Note, for optimization purposes, it is recommended to use as few schedules - as possible to capture all required metric updates. Where you can be - conservative, do take full advantage of the inclusion/exclusion patterns to - capture as much of your targeted metrics. - """ - pass - suggested_wait_time_sec: builtins.int = ... - """Optional. The client is suggested to wait this long (in seconds) before - pinging the configuration service again. - """ - - def __init__(self, - *, - fingerprint : builtins.bytes = ..., - schedules : typing.Optional[typing.Iterable[global___MetricConfigResponse.Schedule]] = ..., - suggested_wait_time_sec : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["fingerprint",b"fingerprint","schedules",b"schedules","suggested_wait_time_sec",b"suggested_wait_time_sec"]) -> None: ... -global___MetricConfigResponse = MetricConfigResponse diff --git a/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py b/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py deleted file mode 100644 index 08b84fe5..00000000 --- a/opensafely/_vendor/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py +++ /dev/null @@ -1,84 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from opensafely._vendor.opentelemetry.proto.metrics.experimental import metrics_config_service_pb2 as opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2 - - -class MetricConfigStub(object): - """MetricConfig is a service that enables updating metric schedules, trace - parameters, and other configurations on the SDK without having to restart the - instrumented application. The collector can also serve as the configuration - service, acting as a bridge between third-party configuration services and - the SDK, piping updated configs from a third-party source to an instrumented - application. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.GetMetricConfig = channel.unary_unary( - '/opentelemetry.proto.metrics.experimental.MetricConfig/GetMetricConfig', - request_serializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigRequest.SerializeToString, - response_deserializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigResponse.FromString, - ) - - -class MetricConfigServicer(object): - """MetricConfig is a service that enables updating metric schedules, trace - parameters, and other configurations on the SDK without having to restart the - instrumented application. The collector can also serve as the configuration - service, acting as a bridge between third-party configuration services and - the SDK, piping updated configs from a third-party source to an instrumented - application. - """ - - def GetMetricConfig(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_MetricConfigServicer_to_server(servicer, server): - rpc_method_handlers = { - 'GetMetricConfig': grpc.unary_unary_rpc_method_handler( - servicer.GetMetricConfig, - request_deserializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigRequest.FromString, - response_serializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'opentelemetry.proto.metrics.experimental.MetricConfig', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class MetricConfig(object): - """MetricConfig is a service that enables updating metric schedules, trace - parameters, and other configurations on the SDK without having to restart the - instrumented application. The collector can also serve as the configuration - service, acting as a bridge between third-party configuration services and - the SDK, piping updated configs from a third-party source to an instrumented - application. - """ - - @staticmethod - def GetMetricConfig(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/opentelemetry.proto.metrics.experimental.MetricConfig/GetMetricConfig', - opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigRequest.SerializeToString, - opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/opensafely/_vendor/opentelemetry/proto/metrics/v1/__init__.py b/opensafely/_vendor/opentelemetry/proto/metrics/v1/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.py b/opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.py deleted file mode 100644 index 188a8030..00000000 --- a/opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.py +++ /dev/null @@ -1,1308 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/metrics/v1/metrics.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf.internal import enum_type_wrapper -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.common.v1 import common_pb2 as opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2 -from opensafely._vendor.opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/metrics/v1/metrics.proto', - package='opentelemetry.proto.metrics.v1', - syntax='proto3', - serialized_options=b'\n!io.opentelemetry.proto.metrics.v1B\014MetricsProtoP\001Z)go.opentelemetry.io/proto/otlp/metrics/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n,opentelemetry/proto/metrics/v1/metrics.proto\x12\x1eopentelemetry.proto.metrics.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"X\n\x0bMetricsData\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\x94\x02\n\x0fResourceMetrics\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12\x43\n\rscope_metrics\x18\x02 \x03(\x0b\x32,.opentelemetry.proto.metrics.v1.ScopeMetrics\x12k\n\x1finstrumentation_library_metrics\x18\xe8\x07 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.InstrumentationLibraryMetricsB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x9f\x01\n\x0cScopeMetrics\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc8\x01\n\x1dInstrumentationLibraryMetrics\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\x92\x03\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0c\n\x04unit\x18\x03 \x01(\t\x12\x36\n\x05gauge\x18\x05 \x01(\x0b\x32%.opentelemetry.proto.metrics.v1.GaugeH\x00\x12\x32\n\x03sum\x18\x07 \x01(\x0b\x32#.opentelemetry.proto.metrics.v1.SumH\x00\x12>\n\thistogram\x18\t \x01(\x0b\x32).opentelemetry.proto.metrics.v1.HistogramH\x00\x12U\n\x15\x65xponential_histogram\x18\n \x01(\x0b\x32\x34.opentelemetry.proto.metrics.v1.ExponentialHistogramH\x00\x12:\n\x07summary\x18\x0b \x01(\x0b\x32\'.opentelemetry.proto.metrics.v1.SummaryH\x00\x42\x06\n\x04\x64\x61taJ\x04\x08\x04\x10\x05J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\t\"M\n\x05Gauge\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\"\xba\x01\n\x03Sum\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\x12\x14\n\x0cis_monotonic\x18\x03 \x01(\x08\"\xad\x01\n\tHistogram\x12G\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x32.opentelemetry.proto.metrics.v1.HistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"\xc3\x01\n\x14\x45xponentialHistogram\x12R\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"P\n\x07Summary\x12\x45\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x30.opentelemetry.proto.metrics.v1.SummaryDataPoint\"\x86\x02\n\x0fNumberDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\x13\n\tas_double\x18\x04 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12;\n\texemplars\x18\x05 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\x08 \x01(\rB\x07\n\x05valueJ\x04\x08\x01\x10\x02\"\xe6\x02\n\x12HistogramDataPoint\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x10\n\x03sum\x18\x05 \x01(\x01H\x00\x88\x01\x01\x12\x15\n\rbucket_counts\x18\x06 \x03(\x06\x12\x17\n\x0f\x65xplicit_bounds\x18\x07 \x03(\x01\x12;\n\texemplars\x18\x08 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\n \x01(\r\x12\x10\n\x03min\x18\x0b \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03max\x18\x0c \x01(\x01H\x02\x88\x01\x01\x42\x06\n\x04_sumB\x06\n\x04_minB\x06\n\x04_maxJ\x04\x08\x01\x10\x02\"\xb5\x04\n\x1d\x45xponentialHistogramDataPoint\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12\r\n\x05scale\x18\x06 \x01(\x11\x12\x12\n\nzero_count\x18\x07 \x01(\x06\x12W\n\x08positive\x18\x08 \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12W\n\x08negative\x18\t \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12\r\n\x05\x66lags\x18\n \x01(\r\x12;\n\texemplars\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\x10\n\x03min\x18\x0c \x01(\x01H\x00\x88\x01\x01\x12\x10\n\x03max\x18\r \x01(\x01H\x01\x88\x01\x01\x1a\x30\n\x07\x42uckets\x12\x0e\n\x06offset\x18\x01 \x01(\x11\x12\x15\n\rbucket_counts\x18\x02 \x03(\x04\x42\x06\n\x04_minB\x06\n\x04_max\"\xc5\x02\n\x10SummaryDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12Y\n\x0fquantile_values\x18\x06 \x03(\x0b\x32@.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile\x12\r\n\x05\x66lags\x18\x08 \x01(\r\x1a\x32\n\x0fValueAtQuantile\x12\x10\n\x08quantile\x18\x01 \x01(\x01\x12\r\n\x05value\x18\x02 \x01(\x01J\x04\x08\x01\x10\x02\"\xc1\x01\n\x08\x45xemplar\x12\x44\n\x13\x66iltered_attributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x16\n\x0etime_unix_nano\x18\x02 \x01(\x06\x12\x13\n\tas_double\x18\x03 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12\x0f\n\x07span_id\x18\x04 \x01(\x0c\x12\x10\n\x08trace_id\x18\x05 \x01(\x0c\x42\x07\n\x05valueJ\x04\x08\x01\x10\x02*\x8c\x01\n\x16\x41ggregationTemporality\x12\'\n#AGGREGATION_TEMPORALITY_UNSPECIFIED\x10\x00\x12!\n\x1d\x41GGREGATION_TEMPORALITY_DELTA\x10\x01\x12&\n\"AGGREGATION_TEMPORALITY_CUMULATIVE\x10\x02*;\n\x0e\x44\x61taPointFlags\x12\r\n\tFLAG_NONE\x10\x00\x12\x1a\n\x16\x46LAG_NO_RECORDED_VALUE\x10\x01\x42^\n!io.opentelemetry.proto.metrics.v1B\x0cMetricsProtoP\x01Z)go.opentelemetry.io/proto/otlp/metrics/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - -_AGGREGATIONTEMPORALITY = _descriptor.EnumDescriptor( - name='AggregationTemporality', - full_name='opentelemetry.proto.metrics.v1.AggregationTemporality', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='AGGREGATION_TEMPORALITY_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='AGGREGATION_TEMPORALITY_DELTA', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='AGGREGATION_TEMPORALITY_CUMULATIVE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=3754, - serialized_end=3894, -) -_sym_db.RegisterEnumDescriptor(_AGGREGATIONTEMPORALITY) - -AggregationTemporality = enum_type_wrapper.EnumTypeWrapper(_AGGREGATIONTEMPORALITY) -_DATAPOINTFLAGS = _descriptor.EnumDescriptor( - name='DataPointFlags', - full_name='opentelemetry.proto.metrics.v1.DataPointFlags', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='FLAG_NONE', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='FLAG_NO_RECORDED_VALUE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=3896, - serialized_end=3955, -) -_sym_db.RegisterEnumDescriptor(_DATAPOINTFLAGS) - -DataPointFlags = enum_type_wrapper.EnumTypeWrapper(_DATAPOINTFLAGS) -AGGREGATION_TEMPORALITY_UNSPECIFIED = 0 -AGGREGATION_TEMPORALITY_DELTA = 1 -AGGREGATION_TEMPORALITY_CUMULATIVE = 2 -FLAG_NONE = 0 -FLAG_NO_RECORDED_VALUE = 1 - - - -_METRICSDATA = _descriptor.Descriptor( - name='MetricsData', - full_name='opentelemetry.proto.metrics.v1.MetricsData', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_metrics', full_name='opentelemetry.proto.metrics.v1.MetricsData.resource_metrics', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=172, - serialized_end=260, -) - - -_RESOURCEMETRICS = _descriptor.Descriptor( - name='ResourceMetrics', - full_name='opentelemetry.proto.metrics.v1.ResourceMetrics', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scope_metrics', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.scope_metrics', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='instrumentation_library_metrics', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.instrumentation_library_metrics', index=2, - number=1000, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.schema_url', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=263, - serialized_end=539, -) - - -_SCOPEMETRICS = _descriptor.Descriptor( - name='ScopeMetrics', - full_name='opentelemetry.proto.metrics.v1.ScopeMetrics', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='scope', full_name='opentelemetry.proto.metrics.v1.ScopeMetrics.scope', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metrics', full_name='opentelemetry.proto.metrics.v1.ScopeMetrics.metrics', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.metrics.v1.ScopeMetrics.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=542, - serialized_end=701, -) - - -_INSTRUMENTATIONLIBRARYMETRICS = _descriptor.Descriptor( - name='InstrumentationLibraryMetrics', - full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='instrumentation_library', full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics.instrumentation_library', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metrics', full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics.metrics', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=704, - serialized_end=904, -) - - -_METRIC = _descriptor.Descriptor( - name='Metric', - full_name='opentelemetry.proto.metrics.v1.Metric', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.metrics.v1.Metric.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='description', full_name='opentelemetry.proto.metrics.v1.Metric.description', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='unit', full_name='opentelemetry.proto.metrics.v1.Metric.unit', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='gauge', full_name='opentelemetry.proto.metrics.v1.Metric.gauge', index=3, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.Metric.sum', index=4, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='histogram', full_name='opentelemetry.proto.metrics.v1.Metric.histogram', index=5, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exponential_histogram', full_name='opentelemetry.proto.metrics.v1.Metric.exponential_histogram', index=6, - number=10, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='summary', full_name='opentelemetry.proto.metrics.v1.Metric.summary', index=7, - number=11, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='data', full_name='opentelemetry.proto.metrics.v1.Metric.data', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=907, - serialized_end=1309, -) - - -_GAUGE = _descriptor.Descriptor( - name='Gauge', - full_name='opentelemetry.proto.metrics.v1.Gauge', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Gauge.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1311, - serialized_end=1388, -) - - -_SUM = _descriptor.Descriptor( - name='Sum', - full_name='opentelemetry.proto.metrics.v1.Sum', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Sum.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='aggregation_temporality', full_name='opentelemetry.proto.metrics.v1.Sum.aggregation_temporality', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='is_monotonic', full_name='opentelemetry.proto.metrics.v1.Sum.is_monotonic', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1391, - serialized_end=1577, -) - - -_HISTOGRAM = _descriptor.Descriptor( - name='Histogram', - full_name='opentelemetry.proto.metrics.v1.Histogram', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Histogram.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='aggregation_temporality', full_name='opentelemetry.proto.metrics.v1.Histogram.aggregation_temporality', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1580, - serialized_end=1753, -) - - -_EXPONENTIALHISTOGRAM = _descriptor.Descriptor( - name='ExponentialHistogram', - full_name='opentelemetry.proto.metrics.v1.ExponentialHistogram', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogram.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='aggregation_temporality', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogram.aggregation_temporality', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1756, - serialized_end=1951, -) - - -_SUMMARY = _descriptor.Descriptor( - name='Summary', - full_name='opentelemetry.proto.metrics.v1.Summary', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Summary.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1953, - serialized_end=2033, -) - - -_NUMBERDATAPOINT = _descriptor.Descriptor( - name='NumberDataPoint', - full_name='opentelemetry.proto.metrics.v1.NumberDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.attributes', index=0, - number=7, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_double', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.as_double', index=3, - number=4, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_int', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.as_int', index=4, - number=6, type=16, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exemplars', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars', index=5, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.flags', index=6, - number=8, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.value', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=2036, - serialized_end=2298, -) - - -_HISTOGRAMDATAPOINT = _descriptor.Descriptor( - name='HistogramDataPoint', - full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes', index=0, - number=9, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='count', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.count', index=3, - number=4, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.sum', index=4, - number=5, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bucket_counts', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.bucket_counts', index=5, - number=6, type=6, cpp_type=4, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='explicit_bounds', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.explicit_bounds', index=6, - number=7, type=1, cpp_type=5, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exemplars', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars', index=7, - number=8, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.flags', index=8, - number=10, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='min', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.min', index=9, - number=11, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.max', index=10, - number=12, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='_sum', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint._sum', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - _descriptor.OneofDescriptor( - name='_min', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint._min', - index=1, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - _descriptor.OneofDescriptor( - name='_max', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint._max', - index=2, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=2301, - serialized_end=2659, -) - - -_EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS = _descriptor.Descriptor( - name='Buckets', - full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='offset', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.offset', index=0, - number=1, type=17, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bucket_counts', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucket_counts', index=1, - number=2, type=4, cpp_type=4, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=3163, - serialized_end=3211, -) - -_EXPONENTIALHISTOGRAMDATAPOINT = _descriptor.Descriptor( - name='ExponentialHistogramDataPoint', - full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='count', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.count', index=3, - number=4, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.sum', index=4, - number=5, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scale', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.scale', index=5, - number=6, type=17, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='zero_count', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.zero_count', index=6, - number=7, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='positive', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive', index=7, - number=8, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='negative', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.flags', index=9, - number=10, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exemplars', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars', index=10, - number=11, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='min', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.min', index=11, - number=12, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.max', index=12, - number=13, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='_min', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint._min', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - _descriptor.OneofDescriptor( - name='_max', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint._max', - index=1, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=2662, - serialized_end=3227, -) - - -_SUMMARYDATAPOINT_VALUEATQUANTILE = _descriptor.Descriptor( - name='ValueAtQuantile', - full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='quantile', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.quantile', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.value', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=3499, - serialized_end=3549, -) - -_SUMMARYDATAPOINT = _descriptor.Descriptor( - name='SummaryDataPoint', - full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes', index=0, - number=7, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='count', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.count', index=3, - number=4, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.sum', index=4, - number=5, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='quantile_values', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.quantile_values', index=5, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.flags', index=6, - number=8, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_SUMMARYDATAPOINT_VALUEATQUANTILE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=3230, - serialized_end=3555, -) - - -_EXEMPLAR = _descriptor.Descriptor( - name='Exemplar', - full_name='opentelemetry.proto.metrics.v1.Exemplar', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='filtered_attributes', full_name='opentelemetry.proto.metrics.v1.Exemplar.filtered_attributes', index=0, - number=7, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.Exemplar.time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_double', full_name='opentelemetry.proto.metrics.v1.Exemplar.as_double', index=2, - number=3, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_int', full_name='opentelemetry.proto.metrics.v1.Exemplar.as_int', index=3, - number=6, type=16, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.metrics.v1.Exemplar.span_id', index=4, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.metrics.v1.Exemplar.trace_id', index=5, - number=5, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='opentelemetry.proto.metrics.v1.Exemplar.value', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=3558, - serialized_end=3751, -) - -_METRICSDATA.fields_by_name['resource_metrics'].message_type = _RESOURCEMETRICS -_RESOURCEMETRICS.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_RESOURCEMETRICS.fields_by_name['scope_metrics'].message_type = _SCOPEMETRICS -_RESOURCEMETRICS.fields_by_name['instrumentation_library_metrics'].message_type = _INSTRUMENTATIONLIBRARYMETRICS -_SCOPEMETRICS.fields_by_name['scope'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONSCOPE -_SCOPEMETRICS.fields_by_name['metrics'].message_type = _METRIC -_INSTRUMENTATIONLIBRARYMETRICS.fields_by_name['instrumentation_library'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONLIBRARY -_INSTRUMENTATIONLIBRARYMETRICS.fields_by_name['metrics'].message_type = _METRIC -_METRIC.fields_by_name['gauge'].message_type = _GAUGE -_METRIC.fields_by_name['sum'].message_type = _SUM -_METRIC.fields_by_name['histogram'].message_type = _HISTOGRAM -_METRIC.fields_by_name['exponential_histogram'].message_type = _EXPONENTIALHISTOGRAM -_METRIC.fields_by_name['summary'].message_type = _SUMMARY -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['gauge']) -_METRIC.fields_by_name['gauge'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['sum']) -_METRIC.fields_by_name['sum'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['histogram']) -_METRIC.fields_by_name['histogram'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['exponential_histogram']) -_METRIC.fields_by_name['exponential_histogram'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['summary']) -_METRIC.fields_by_name['summary'].containing_oneof = _METRIC.oneofs_by_name['data'] -_GAUGE.fields_by_name['data_points'].message_type = _NUMBERDATAPOINT -_SUM.fields_by_name['data_points'].message_type = _NUMBERDATAPOINT -_SUM.fields_by_name['aggregation_temporality'].enum_type = _AGGREGATIONTEMPORALITY -_HISTOGRAM.fields_by_name['data_points'].message_type = _HISTOGRAMDATAPOINT -_HISTOGRAM.fields_by_name['aggregation_temporality'].enum_type = _AGGREGATIONTEMPORALITY -_EXPONENTIALHISTOGRAM.fields_by_name['data_points'].message_type = _EXPONENTIALHISTOGRAMDATAPOINT -_EXPONENTIALHISTOGRAM.fields_by_name['aggregation_temporality'].enum_type = _AGGREGATIONTEMPORALITY -_SUMMARY.fields_by_name['data_points'].message_type = _SUMMARYDATAPOINT -_NUMBERDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_NUMBERDATAPOINT.fields_by_name['exemplars'].message_type = _EXEMPLAR -_NUMBERDATAPOINT.oneofs_by_name['value'].fields.append( - _NUMBERDATAPOINT.fields_by_name['as_double']) -_NUMBERDATAPOINT.fields_by_name['as_double'].containing_oneof = _NUMBERDATAPOINT.oneofs_by_name['value'] -_NUMBERDATAPOINT.oneofs_by_name['value'].fields.append( - _NUMBERDATAPOINT.fields_by_name['as_int']) -_NUMBERDATAPOINT.fields_by_name['as_int'].containing_oneof = _NUMBERDATAPOINT.oneofs_by_name['value'] -_HISTOGRAMDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_HISTOGRAMDATAPOINT.fields_by_name['exemplars'].message_type = _EXEMPLAR -_HISTOGRAMDATAPOINT.oneofs_by_name['_sum'].fields.append( - _HISTOGRAMDATAPOINT.fields_by_name['sum']) -_HISTOGRAMDATAPOINT.fields_by_name['sum'].containing_oneof = _HISTOGRAMDATAPOINT.oneofs_by_name['_sum'] -_HISTOGRAMDATAPOINT.oneofs_by_name['_min'].fields.append( - _HISTOGRAMDATAPOINT.fields_by_name['min']) -_HISTOGRAMDATAPOINT.fields_by_name['min'].containing_oneof = _HISTOGRAMDATAPOINT.oneofs_by_name['_min'] -_HISTOGRAMDATAPOINT.oneofs_by_name['_max'].fields.append( - _HISTOGRAMDATAPOINT.fields_by_name['max']) -_HISTOGRAMDATAPOINT.fields_by_name['max'].containing_oneof = _HISTOGRAMDATAPOINT.oneofs_by_name['_max'] -_EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS.containing_type = _EXPONENTIALHISTOGRAMDATAPOINT -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['positive'].message_type = _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['negative'].message_type = _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['exemplars'].message_type = _EXEMPLAR -_EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_min'].fields.append( - _EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['min']) -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['min'].containing_oneof = _EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_min'] -_EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_max'].fields.append( - _EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['max']) -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['max'].containing_oneof = _EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_max'] -_SUMMARYDATAPOINT_VALUEATQUANTILE.containing_type = _SUMMARYDATAPOINT -_SUMMARYDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SUMMARYDATAPOINT.fields_by_name['quantile_values'].message_type = _SUMMARYDATAPOINT_VALUEATQUANTILE -_EXEMPLAR.fields_by_name['filtered_attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_EXEMPLAR.oneofs_by_name['value'].fields.append( - _EXEMPLAR.fields_by_name['as_double']) -_EXEMPLAR.fields_by_name['as_double'].containing_oneof = _EXEMPLAR.oneofs_by_name['value'] -_EXEMPLAR.oneofs_by_name['value'].fields.append( - _EXEMPLAR.fields_by_name['as_int']) -_EXEMPLAR.fields_by_name['as_int'].containing_oneof = _EXEMPLAR.oneofs_by_name['value'] -DESCRIPTOR.message_types_by_name['MetricsData'] = _METRICSDATA -DESCRIPTOR.message_types_by_name['ResourceMetrics'] = _RESOURCEMETRICS -DESCRIPTOR.message_types_by_name['ScopeMetrics'] = _SCOPEMETRICS -DESCRIPTOR.message_types_by_name['InstrumentationLibraryMetrics'] = _INSTRUMENTATIONLIBRARYMETRICS -DESCRIPTOR.message_types_by_name['Metric'] = _METRIC -DESCRIPTOR.message_types_by_name['Gauge'] = _GAUGE -DESCRIPTOR.message_types_by_name['Sum'] = _SUM -DESCRIPTOR.message_types_by_name['Histogram'] = _HISTOGRAM -DESCRIPTOR.message_types_by_name['ExponentialHistogram'] = _EXPONENTIALHISTOGRAM -DESCRIPTOR.message_types_by_name['Summary'] = _SUMMARY -DESCRIPTOR.message_types_by_name['NumberDataPoint'] = _NUMBERDATAPOINT -DESCRIPTOR.message_types_by_name['HistogramDataPoint'] = _HISTOGRAMDATAPOINT -DESCRIPTOR.message_types_by_name['ExponentialHistogramDataPoint'] = _EXPONENTIALHISTOGRAMDATAPOINT -DESCRIPTOR.message_types_by_name['SummaryDataPoint'] = _SUMMARYDATAPOINT -DESCRIPTOR.message_types_by_name['Exemplar'] = _EXEMPLAR -DESCRIPTOR.enum_types_by_name['AggregationTemporality'] = _AGGREGATIONTEMPORALITY -DESCRIPTOR.enum_types_by_name['DataPointFlags'] = _DATAPOINTFLAGS -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -MetricsData = _reflection.GeneratedProtocolMessageType('MetricsData', (_message.Message,), { - 'DESCRIPTOR' : _METRICSDATA, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.MetricsData) - }) -_sym_db.RegisterMessage(MetricsData) - -ResourceMetrics = _reflection.GeneratedProtocolMessageType('ResourceMetrics', (_message.Message,), { - 'DESCRIPTOR' : _RESOURCEMETRICS, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.ResourceMetrics) - }) -_sym_db.RegisterMessage(ResourceMetrics) - -ScopeMetrics = _reflection.GeneratedProtocolMessageType('ScopeMetrics', (_message.Message,), { - 'DESCRIPTOR' : _SCOPEMETRICS, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.ScopeMetrics) - }) -_sym_db.RegisterMessage(ScopeMetrics) - -InstrumentationLibraryMetrics = _reflection.GeneratedProtocolMessageType('InstrumentationLibraryMetrics', (_message.Message,), { - 'DESCRIPTOR' : _INSTRUMENTATIONLIBRARYMETRICS, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics) - }) -_sym_db.RegisterMessage(InstrumentationLibraryMetrics) - -Metric = _reflection.GeneratedProtocolMessageType('Metric', (_message.Message,), { - 'DESCRIPTOR' : _METRIC, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.Metric) - }) -_sym_db.RegisterMessage(Metric) - -Gauge = _reflection.GeneratedProtocolMessageType('Gauge', (_message.Message,), { - 'DESCRIPTOR' : _GAUGE, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.Gauge) - }) -_sym_db.RegisterMessage(Gauge) - -Sum = _reflection.GeneratedProtocolMessageType('Sum', (_message.Message,), { - 'DESCRIPTOR' : _SUM, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.Sum) - }) -_sym_db.RegisterMessage(Sum) - -Histogram = _reflection.GeneratedProtocolMessageType('Histogram', (_message.Message,), { - 'DESCRIPTOR' : _HISTOGRAM, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.Histogram) - }) -_sym_db.RegisterMessage(Histogram) - -ExponentialHistogram = _reflection.GeneratedProtocolMessageType('ExponentialHistogram', (_message.Message,), { - 'DESCRIPTOR' : _EXPONENTIALHISTOGRAM, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.ExponentialHistogram) - }) -_sym_db.RegisterMessage(ExponentialHistogram) - -Summary = _reflection.GeneratedProtocolMessageType('Summary', (_message.Message,), { - 'DESCRIPTOR' : _SUMMARY, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.Summary) - }) -_sym_db.RegisterMessage(Summary) - -NumberDataPoint = _reflection.GeneratedProtocolMessageType('NumberDataPoint', (_message.Message,), { - 'DESCRIPTOR' : _NUMBERDATAPOINT, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.NumberDataPoint) - }) -_sym_db.RegisterMessage(NumberDataPoint) - -HistogramDataPoint = _reflection.GeneratedProtocolMessageType('HistogramDataPoint', (_message.Message,), { - 'DESCRIPTOR' : _HISTOGRAMDATAPOINT, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.HistogramDataPoint) - }) -_sym_db.RegisterMessage(HistogramDataPoint) - -ExponentialHistogramDataPoint = _reflection.GeneratedProtocolMessageType('ExponentialHistogramDataPoint', (_message.Message,), { - - 'Buckets' : _reflection.GeneratedProtocolMessageType('Buckets', (_message.Message,), { - 'DESCRIPTOR' : _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets) - }) - , - 'DESCRIPTOR' : _EXPONENTIALHISTOGRAMDATAPOINT, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint) - }) -_sym_db.RegisterMessage(ExponentialHistogramDataPoint) -_sym_db.RegisterMessage(ExponentialHistogramDataPoint.Buckets) - -SummaryDataPoint = _reflection.GeneratedProtocolMessageType('SummaryDataPoint', (_message.Message,), { - - 'ValueAtQuantile' : _reflection.GeneratedProtocolMessageType('ValueAtQuantile', (_message.Message,), { - 'DESCRIPTOR' : _SUMMARYDATAPOINT_VALUEATQUANTILE, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile) - }) - , - 'DESCRIPTOR' : _SUMMARYDATAPOINT, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.SummaryDataPoint) - }) -_sym_db.RegisterMessage(SummaryDataPoint) -_sym_db.RegisterMessage(SummaryDataPoint.ValueAtQuantile) - -Exemplar = _reflection.GeneratedProtocolMessageType('Exemplar', (_message.Message,), { - 'DESCRIPTOR' : _EXEMPLAR, - '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.v1.Exemplar) - }) -_sym_db.RegisterMessage(Exemplar) - - -DESCRIPTOR._options = None -_RESOURCEMETRICS.fields_by_name['instrumentation_library_metrics']._options = None -_INSTRUMENTATIONLIBRARYMETRICS._options = None -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.pyi deleted file mode 100644 index ed1291a7..00000000 --- a/opensafely/_vendor/opentelemetry/proto/metrics/v1/metrics_pb2.pyi +++ /dev/null @@ -1,1125 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.internal.enum_type_wrapper -import google.protobuf.message -import opentelemetry.proto.common.v1.common_pb2 -import opentelemetry.proto.resource.v1.resource_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class AggregationTemporality(_AggregationTemporality, metaclass=_AggregationTemporalityEnumTypeWrapper): - """AggregationTemporality defines how a metric aggregator reports aggregated - values. It describes how those values relate to the time interval over - which they are aggregated. - """ - pass -class _AggregationTemporality: - V = typing.NewType('V', builtins.int) -class _AggregationTemporalityEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_AggregationTemporality.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - AGGREGATION_TEMPORALITY_UNSPECIFIED = AggregationTemporality.V(0) - """UNSPECIFIED is the default AggregationTemporality, it MUST not be used.""" - - AGGREGATION_TEMPORALITY_DELTA = AggregationTemporality.V(1) - """DELTA is an AggregationTemporality for a metric aggregator which reports - changes since last report time. Successive metrics contain aggregation of - values from continuous and non-overlapping intervals. - - The values for a DELTA metric are based only on the time interval - associated with one measurement cycle. There is no dependency on - previous measurements like is the case for CUMULATIVE metrics. - - For example, consider a system measuring the number of requests that - it receives and reports the sum of these requests every second as a - DELTA metric: - - 1. The system starts receiving at time=t_0. - 2. A request is received, the system measures 1 request. - 3. A request is received, the system measures 1 request. - 4. A request is received, the system measures 1 request. - 5. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+1 with a value of 3. - 6. A request is received, the system measures 1 request. - 7. A request is received, the system measures 1 request. - 8. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0+1 to - t_0+2 with a value of 2. - """ - - AGGREGATION_TEMPORALITY_CUMULATIVE = AggregationTemporality.V(2) - """CUMULATIVE is an AggregationTemporality for a metric aggregator which - reports changes since a fixed start time. This means that current values - of a CUMULATIVE metric depend on all previous measurements since the - start time. Because of this, the sender is required to retain this state - in some form. If this state is lost or invalidated, the CUMULATIVE metric - values MUST be reset and a new fixed start time following the last - reported measurement time sent MUST be used. - - For example, consider a system measuring the number of requests that - it receives and reports the sum of these requests every second as a - CUMULATIVE metric: - - 1. The system starts receiving at time=t_0. - 2. A request is received, the system measures 1 request. - 3. A request is received, the system measures 1 request. - 4. A request is received, the system measures 1 request. - 5. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+1 with a value of 3. - 6. A request is received, the system measures 1 request. - 7. A request is received, the system measures 1 request. - 8. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+2 with a value of 5. - 9. The system experiences a fault and loses state. - 10. The system recovers and resumes receiving at time=t_1. - 11. A request is received, the system measures 1 request. - 12. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_1 to - t_0+1 with a value of 1. - - Note: Even though, when reporting changes since last report time, using - CUMULATIVE is valid, it is not recommended. This may cause problems for - systems that do not use start_time to determine when the aggregation - value was reset (e.g. Prometheus). - """ - - -AGGREGATION_TEMPORALITY_UNSPECIFIED = AggregationTemporality.V(0) -"""UNSPECIFIED is the default AggregationTemporality, it MUST not be used.""" - -AGGREGATION_TEMPORALITY_DELTA = AggregationTemporality.V(1) -"""DELTA is an AggregationTemporality for a metric aggregator which reports -changes since last report time. Successive metrics contain aggregation of -values from continuous and non-overlapping intervals. - -The values for a DELTA metric are based only on the time interval -associated with one measurement cycle. There is no dependency on -previous measurements like is the case for CUMULATIVE metrics. - -For example, consider a system measuring the number of requests that -it receives and reports the sum of these requests every second as a -DELTA metric: - - 1. The system starts receiving at time=t_0. - 2. A request is received, the system measures 1 request. - 3. A request is received, the system measures 1 request. - 4. A request is received, the system measures 1 request. - 5. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+1 with a value of 3. - 6. A request is received, the system measures 1 request. - 7. A request is received, the system measures 1 request. - 8. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0+1 to - t_0+2 with a value of 2. -""" - -AGGREGATION_TEMPORALITY_CUMULATIVE = AggregationTemporality.V(2) -"""CUMULATIVE is an AggregationTemporality for a metric aggregator which -reports changes since a fixed start time. This means that current values -of a CUMULATIVE metric depend on all previous measurements since the -start time. Because of this, the sender is required to retain this state -in some form. If this state is lost or invalidated, the CUMULATIVE metric -values MUST be reset and a new fixed start time following the last -reported measurement time sent MUST be used. - -For example, consider a system measuring the number of requests that -it receives and reports the sum of these requests every second as a -CUMULATIVE metric: - - 1. The system starts receiving at time=t_0. - 2. A request is received, the system measures 1 request. - 3. A request is received, the system measures 1 request. - 4. A request is received, the system measures 1 request. - 5. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+1 with a value of 3. - 6. A request is received, the system measures 1 request. - 7. A request is received, the system measures 1 request. - 8. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+2 with a value of 5. - 9. The system experiences a fault and loses state. - 10. The system recovers and resumes receiving at time=t_1. - 11. A request is received, the system measures 1 request. - 12. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_1 to - t_0+1 with a value of 1. - -Note: Even though, when reporting changes since last report time, using -CUMULATIVE is valid, it is not recommended. This may cause problems for -systems that do not use start_time to determine when the aggregation -value was reset (e.g. Prometheus). -""" - -global___AggregationTemporality = AggregationTemporality - - -class DataPointFlags(_DataPointFlags, metaclass=_DataPointFlagsEnumTypeWrapper): - """DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a - bit-field representing 32 distinct boolean flags. Each flag defined in this - enum is a bit-mask. To test the presence of a single flag in the flags of - a data point, for example, use an expression like: - - (point.flags & FLAG_NO_RECORDED_VALUE) == FLAG_NO_RECORDED_VALUE - """ - pass -class _DataPointFlags: - V = typing.NewType('V', builtins.int) -class _DataPointFlagsEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_DataPointFlags.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - FLAG_NONE = DataPointFlags.V(0) - FLAG_NO_RECORDED_VALUE = DataPointFlags.V(1) - """This DataPoint is valid but has no recorded value. This value - SHOULD be used to reflect explicitly missing data in a series, as - for an equivalent to the Prometheus "staleness marker". - """ - - -FLAG_NONE = DataPointFlags.V(0) -FLAG_NO_RECORDED_VALUE = DataPointFlags.V(1) -"""This DataPoint is valid but has no recorded value. This value -SHOULD be used to reflect explicitly missing data in a series, as -for an equivalent to the Prometheus "staleness marker". -""" - -global___DataPointFlags = DataPointFlags - - -class MetricsData(google.protobuf.message.Message): - """MetricsData represents the metrics data that can be stored in a persistent - storage, OR can be embedded by other protocols that transfer OTLP metrics - data but do not implement the OTLP protocol. - - The main difference between this message and collector protocol is that - in this message there will not be any "control" or "metadata" specific to - OTLP protocol. - - When new fields are added into this message, the OTLP request MUST be updated - as well. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_METRICS_FIELD_NUMBER: builtins.int - @property - def resource_metrics(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ResourceMetrics]: - """An array of ResourceMetrics. - For data coming from a single resource this array will typically contain - one element. Intermediary nodes that receive data from multiple origins - typically batch the data before forwarding further and in that case this - array will contain multiple elements. - """ - pass - def __init__(self, - *, - resource_metrics : typing.Optional[typing.Iterable[global___ResourceMetrics]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["resource_metrics",b"resource_metrics"]) -> None: ... -global___MetricsData = MetricsData - -class ResourceMetrics(google.protobuf.message.Message): - """A collection of ScopeMetrics from a Resource.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_FIELD_NUMBER: builtins.int - SCOPE_METRICS_FIELD_NUMBER: builtins.int - INSTRUMENTATION_LIBRARY_METRICS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def resource(self) -> opentelemetry.proto.resource.v1.resource_pb2.Resource: - """The resource for the metrics in this message. - If this field is not set then no resource info is known. - """ - pass - @property - def scope_metrics(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ScopeMetrics]: - """A list of metrics that originate from a resource.""" - pass - @property - def instrumentation_library_metrics(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___InstrumentationLibraryMetrics]: - """A list of InstrumentationLibraryMetrics that originate from a resource. - This field is deprecated and will be removed after grace period expires on June 15, 2022. - - During the grace period the following rules SHOULD be followed: - - For Binary Protobufs - ==================== - Binary Protobuf senders SHOULD NOT set instrumentation_library_metrics. Instead - scope_metrics SHOULD be set. - - Binary Protobuf receivers SHOULD check if instrumentation_library_metrics is set - and scope_metrics is not set then the value in instrumentation_library_metrics - SHOULD be used instead by converting InstrumentationLibraryMetrics into ScopeMetrics. - If scope_metrics is set then instrumentation_library_metrics SHOULD be ignored. - - For JSON - ======== - JSON senders that set instrumentation_library_metrics field MAY also set - scope_metrics to carry the same metrics, essentially double-publishing the same data. - Such double-publishing MAY be controlled by a user-settable option. - If double-publishing is not used then the senders SHOULD set scope_metrics and - SHOULD NOT set instrumentation_library_metrics. - - JSON receivers SHOULD check if instrumentation_library_metrics is set and - scope_metrics is not set then the value in instrumentation_library_metrics - SHOULD be used instead by converting InstrumentationLibraryMetrics into ScopeMetrics. - If scope_metrics is set then instrumentation_library_metrics field SHOULD be ignored. - """ - pass - schema_url: typing.Text = ... - """This schema_url applies to the data in the "resource" field. It does not apply - to the data in the "scope_metrics" field which have their own schema_url field. - """ - - def __init__(self, - *, - resource : typing.Optional[opentelemetry.proto.resource.v1.resource_pb2.Resource] = ..., - scope_metrics : typing.Optional[typing.Iterable[global___ScopeMetrics]] = ..., - instrumentation_library_metrics : typing.Optional[typing.Iterable[global___InstrumentationLibraryMetrics]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["resource",b"resource"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["instrumentation_library_metrics",b"instrumentation_library_metrics","resource",b"resource","schema_url",b"schema_url","scope_metrics",b"scope_metrics"]) -> None: ... -global___ResourceMetrics = ResourceMetrics - -class ScopeMetrics(google.protobuf.message.Message): - """A collection of Metrics produced by an Scope.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - SCOPE_FIELD_NUMBER: builtins.int - METRICS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def scope(self) -> opentelemetry.proto.common.v1.common_pb2.InstrumentationScope: - """The instrumentation scope information for the metrics in this message. - Semantically when InstrumentationScope isn't set, it is equivalent with - an empty instrumentation scope name (unknown). - """ - pass - @property - def metrics(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Metric]: - """A list of metrics that originate from an instrumentation library.""" - pass - schema_url: typing.Text = ... - """This schema_url applies to all metrics in the "metrics" field.""" - - def __init__(self, - *, - scope : typing.Optional[opentelemetry.proto.common.v1.common_pb2.InstrumentationScope] = ..., - metrics : typing.Optional[typing.Iterable[global___Metric]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["scope",b"scope"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["metrics",b"metrics","schema_url",b"schema_url","scope",b"scope"]) -> None: ... -global___ScopeMetrics = ScopeMetrics - -class InstrumentationLibraryMetrics(google.protobuf.message.Message): - """A collection of Metrics produced by an InstrumentationLibrary. - InstrumentationLibraryMetrics is wire-compatible with ScopeMetrics for binary - Protobuf format. - This message is deprecated and will be removed on June 15, 2022. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - INSTRUMENTATION_LIBRARY_FIELD_NUMBER: builtins.int - METRICS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def instrumentation_library(self) -> opentelemetry.proto.common.v1.common_pb2.InstrumentationLibrary: - """The instrumentation library information for the metrics in this message. - Semantically when InstrumentationLibrary isn't set, it is equivalent with - an empty instrumentation library name (unknown). - """ - pass - @property - def metrics(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Metric]: - """A list of metrics that originate from an instrumentation library.""" - pass - schema_url: typing.Text = ... - """This schema_url applies to all metrics in the "metrics" field.""" - - def __init__(self, - *, - instrumentation_library : typing.Optional[opentelemetry.proto.common.v1.common_pb2.InstrumentationLibrary] = ..., - metrics : typing.Optional[typing.Iterable[global___Metric]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["instrumentation_library",b"instrumentation_library"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["instrumentation_library",b"instrumentation_library","metrics",b"metrics","schema_url",b"schema_url"]) -> None: ... -global___InstrumentationLibraryMetrics = InstrumentationLibraryMetrics - -class Metric(google.protobuf.message.Message): - """Defines a Metric which has one or more timeseries. The following is a - brief summary of the Metric data model. For more details, see: - - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md - - - The data model and relation between entities is shown in the - diagram below. Here, "DataPoint" is the term used to refer to any - one of the specific data point value types, and "points" is the term used - to refer to any one of the lists of points contained in the Metric. - - - Metric is composed of a metadata and data. - - Metadata part contains a name, description, unit. - - Data is one of the possible types (Sum, Gauge, Histogram, Summary). - - DataPoint contains timestamps, attributes, and one of the possible value type - fields. - - Metric - +------------+ - |name | - |description | - |unit | +------------------------------------+ - |data |---> |Gauge, Sum, Histogram, Summary, ... | - +------------+ +------------------------------------+ - - Data [One of Gauge, Sum, Histogram, Summary, ...] - +-----------+ - |... | // Metadata about the Data. - |points |--+ - +-----------+ | - | +---------------------------+ - | |DataPoint 1 | - v |+------+------+ +------+ | - +-----+ ||label |label |...|label | | - | 1 |-->||value1|value2|...|valueN| | - +-----+ |+------+------+ +------+ | - | . | |+-----+ | - | . | ||value| | - | . | |+-----+ | - | . | +---------------------------+ - | . | . - | . | . - | . | . - | . | +---------------------------+ - | . | |DataPoint M | - +-----+ |+------+------+ +------+ | - | M |-->||label |label |...|label | | - +-----+ ||value1|value2|...|valueN| | - |+------+------+ +------+ | - |+-----+ | - ||value| | - |+-----+ | - +---------------------------+ - - Each distinct type of DataPoint represents the output of a specific - aggregation function, the result of applying the DataPoint's - associated function of to one or more measurements. - - All DataPoint types have three common fields: - - Attributes includes key-value pairs associated with the data point - - TimeUnixNano is required, set to the end time of the aggregation - - StartTimeUnixNano is optional, but strongly encouraged for DataPoints - having an AggregationTemporality field, as discussed below. - - Both TimeUnixNano and StartTimeUnixNano values are expressed as - UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - - # TimeUnixNano - - This field is required, having consistent interpretation across - DataPoint types. TimeUnixNano is the moment corresponding to when - the data point's aggregate value was captured. - - Data points with the 0 value for TimeUnixNano SHOULD be rejected - by consumers. - - # StartTimeUnixNano - - StartTimeUnixNano in general allows detecting when a sequence of - observations is unbroken. This field indicates to consumers the - start time for points with cumulative and delta - AggregationTemporality, and it should be included whenever possible - to support correct rate calculation. Although it may be omitted - when the start time is truly unknown, setting StartTimeUnixNano is - strongly encouraged. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - NAME_FIELD_NUMBER: builtins.int - DESCRIPTION_FIELD_NUMBER: builtins.int - UNIT_FIELD_NUMBER: builtins.int - GAUGE_FIELD_NUMBER: builtins.int - SUM_FIELD_NUMBER: builtins.int - HISTOGRAM_FIELD_NUMBER: builtins.int - EXPONENTIAL_HISTOGRAM_FIELD_NUMBER: builtins.int - SUMMARY_FIELD_NUMBER: builtins.int - name: typing.Text = ... - """name of the metric, including its DNS name prefix. It must be unique.""" - - description: typing.Text = ... - """description of the metric, which can be used in documentation.""" - - unit: typing.Text = ... - """unit in which the metric value is reported. Follows the format - described by http://unitsofmeasure.org/ucum.html. - """ - - @property - def gauge(self) -> global___Gauge: ... - @property - def sum(self) -> global___Sum: ... - @property - def histogram(self) -> global___Histogram: ... - @property - def exponential_histogram(self) -> global___ExponentialHistogram: ... - @property - def summary(self) -> global___Summary: ... - def __init__(self, - *, - name : typing.Text = ..., - description : typing.Text = ..., - unit : typing.Text = ..., - gauge : typing.Optional[global___Gauge] = ..., - sum : typing.Optional[global___Sum] = ..., - histogram : typing.Optional[global___Histogram] = ..., - exponential_histogram : typing.Optional[global___ExponentialHistogram] = ..., - summary : typing.Optional[global___Summary] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["data",b"data","exponential_histogram",b"exponential_histogram","gauge",b"gauge","histogram",b"histogram","sum",b"sum","summary",b"summary"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["data",b"data","description",b"description","exponential_histogram",b"exponential_histogram","gauge",b"gauge","histogram",b"histogram","name",b"name","sum",b"sum","summary",b"summary","unit",b"unit"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["data",b"data"]) -> typing.Optional[typing_extensions.Literal["gauge","sum","histogram","exponential_histogram","summary"]]: ... -global___Metric = Metric - -class Gauge(google.protobuf.message.Message): - """Gauge represents the type of a scalar metric that always exports the - "current value" for every data point. It should be used for an "unknown" - aggregation. - - A Gauge does not support different aggregation temporalities. Given the - aggregation is unknown, points cannot be combined using the same - aggregation, regardless of aggregation temporalities. Therefore, - AggregationTemporality is not included. Consequently, this also means - "StartTimeUnixNano" is ignored for all data points. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - DATA_POINTS_FIELD_NUMBER: builtins.int - @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___NumberDataPoint]: ... - def __init__(self, - *, - data_points : typing.Optional[typing.Iterable[global___NumberDataPoint]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["data_points",b"data_points"]) -> None: ... -global___Gauge = Gauge - -class Sum(google.protobuf.message.Message): - """Sum represents the type of a scalar metric that is calculated as a sum of all - reported measurements over a time interval. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - DATA_POINTS_FIELD_NUMBER: builtins.int - AGGREGATION_TEMPORALITY_FIELD_NUMBER: builtins.int - IS_MONOTONIC_FIELD_NUMBER: builtins.int - @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___NumberDataPoint]: ... - aggregation_temporality: global___AggregationTemporality.V = ... - """aggregation_temporality describes if the aggregator reports delta changes - since last report time, or cumulative changes since a fixed start time. - """ - - is_monotonic: builtins.bool = ... - """If "true" means that the sum is monotonic.""" - - def __init__(self, - *, - data_points : typing.Optional[typing.Iterable[global___NumberDataPoint]] = ..., - aggregation_temporality : global___AggregationTemporality.V = ..., - is_monotonic : builtins.bool = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["aggregation_temporality",b"aggregation_temporality","data_points",b"data_points","is_monotonic",b"is_monotonic"]) -> None: ... -global___Sum = Sum - -class Histogram(google.protobuf.message.Message): - """Histogram represents the type of a metric that is calculated by aggregating - as a Histogram of all reported measurements over a time interval. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - DATA_POINTS_FIELD_NUMBER: builtins.int - AGGREGATION_TEMPORALITY_FIELD_NUMBER: builtins.int - @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___HistogramDataPoint]: ... - aggregation_temporality: global___AggregationTemporality.V = ... - """aggregation_temporality describes if the aggregator reports delta changes - since last report time, or cumulative changes since a fixed start time. - """ - - def __init__(self, - *, - data_points : typing.Optional[typing.Iterable[global___HistogramDataPoint]] = ..., - aggregation_temporality : global___AggregationTemporality.V = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["aggregation_temporality",b"aggregation_temporality","data_points",b"data_points"]) -> None: ... -global___Histogram = Histogram - -class ExponentialHistogram(google.protobuf.message.Message): - """ExponentialHistogram represents the type of a metric that is calculated by aggregating - as a ExponentialHistogram of all reported double measurements over a time interval. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - DATA_POINTS_FIELD_NUMBER: builtins.int - AGGREGATION_TEMPORALITY_FIELD_NUMBER: builtins.int - @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ExponentialHistogramDataPoint]: ... - aggregation_temporality: global___AggregationTemporality.V = ... - """aggregation_temporality describes if the aggregator reports delta changes - since last report time, or cumulative changes since a fixed start time. - """ - - def __init__(self, - *, - data_points : typing.Optional[typing.Iterable[global___ExponentialHistogramDataPoint]] = ..., - aggregation_temporality : global___AggregationTemporality.V = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["aggregation_temporality",b"aggregation_temporality","data_points",b"data_points"]) -> None: ... -global___ExponentialHistogram = ExponentialHistogram - -class Summary(google.protobuf.message.Message): - """Summary metric data are used to convey quantile summaries, - a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary) - and OpenMetrics (see: https://github.com/OpenObservability/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45) - data type. These data points cannot always be merged in a meaningful way. - While they can be useful in some applications, histogram data points are - recommended for new applications. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - DATA_POINTS_FIELD_NUMBER: builtins.int - @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SummaryDataPoint]: ... - def __init__(self, - *, - data_points : typing.Optional[typing.Iterable[global___SummaryDataPoint]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["data_points",b"data_points"]) -> None: ... -global___Summary = Summary - -class NumberDataPoint(google.protobuf.message.Message): - """NumberDataPoint is a single data point in a timeseries that describes the - time-varying scalar value of a metric. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - ATTRIBUTES_FIELD_NUMBER: builtins.int - START_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - AS_DOUBLE_FIELD_NUMBER: builtins.int - AS_INT_FIELD_NUMBER: builtins.int - EXEMPLARS_FIELD_NUMBER: builtins.int - FLAGS_FIELD_NUMBER: builtins.int - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """The set of key/value pairs that uniquely identify the timeseries from - where this point belongs. The list may be empty (may contain 0 elements). - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - start_time_unix_nano: builtins.int = ... - """StartTimeUnixNano is optional but strongly encouraged, see the - the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - time_unix_nano: builtins.int = ... - """TimeUnixNano is required, see the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - as_double: builtins.float = ... - as_int: builtins.int = ... - @property - def exemplars(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Exemplar]: - """(Optional) List of exemplars collected from - measurements that were used to form the data point - """ - pass - flags: builtins.int = ... - """Flags that apply to this specific data point. See DataPointFlags - for the available flags and their meaning. - """ - - def __init__(self, - *, - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - start_time_unix_nano : builtins.int = ..., - time_unix_nano : builtins.int = ..., - as_double : builtins.float = ..., - as_int : builtins.int = ..., - exemplars : typing.Optional[typing.Iterable[global___Exemplar]] = ..., - flags : builtins.int = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["as_double",b"as_double","as_int",b"as_int","value",b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["as_double",b"as_double","as_int",b"as_int","attributes",b"attributes","exemplars",b"exemplars","flags",b"flags","start_time_unix_nano",b"start_time_unix_nano","time_unix_nano",b"time_unix_nano","value",b"value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["value",b"value"]) -> typing.Optional[typing_extensions.Literal["as_double","as_int"]]: ... -global___NumberDataPoint = NumberDataPoint - -class HistogramDataPoint(google.protobuf.message.Message): - """HistogramDataPoint is a single data point in a timeseries that describes the - time-varying values of a Histogram. A Histogram contains summary statistics - for a population of values, it may optionally contain the distribution of - those values across a set of buckets. - - If the histogram contains the distribution of values, then both - "explicit_bounds" and "bucket counts" fields must be defined. - If the histogram does not contain the distribution of values, then both - "explicit_bounds" and "bucket_counts" must be omitted and only "count" and - "sum" are known. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - ATTRIBUTES_FIELD_NUMBER: builtins.int - START_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - COUNT_FIELD_NUMBER: builtins.int - SUM_FIELD_NUMBER: builtins.int - BUCKET_COUNTS_FIELD_NUMBER: builtins.int - EXPLICIT_BOUNDS_FIELD_NUMBER: builtins.int - EXEMPLARS_FIELD_NUMBER: builtins.int - FLAGS_FIELD_NUMBER: builtins.int - MIN_FIELD_NUMBER: builtins.int - MAX_FIELD_NUMBER: builtins.int - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """The set of key/value pairs that uniquely identify the timeseries from - where this point belongs. The list may be empty (may contain 0 elements). - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - start_time_unix_nano: builtins.int = ... - """StartTimeUnixNano is optional but strongly encouraged, see the - the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - time_unix_nano: builtins.int = ... - """TimeUnixNano is required, see the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - count: builtins.int = ... - """count is the number of values in the population. Must be non-negative. This - value must be equal to the sum of the "count" fields in buckets if a - histogram is provided. - """ - - sum: builtins.float = ... - """sum of the values in the population. If count is zero then this field - must be zero. - - Note: Sum should only be filled out when measuring non-negative discrete - events, and is assumed to be monotonic over the values of these events. - Negative events *can* be recorded, but sum should not be filled out when - doing so. This is specifically to enforce compatibility w/ OpenMetrics, - see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram - """ - - @property - def bucket_counts(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """bucket_counts is an optional field contains the count values of histogram - for each bucket. - - The sum of the bucket_counts must equal the value in the count field. - - The number of elements in bucket_counts array must be by one greater than - the number of elements in explicit_bounds array. - """ - pass - @property - def explicit_bounds(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.float]: - """explicit_bounds specifies buckets with explicitly defined bounds for values. - - The boundaries for bucket at index i are: - - (-infinity, explicit_bounds[i]] for i == 0 - (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds) - (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds) - - The values in the explicit_bounds array must be strictly increasing. - - Histogram buckets are inclusive of their upper boundary, except the last - bucket where the boundary is at infinity. This format is intentionally - compatible with the OpenMetrics histogram definition. - """ - pass - @property - def exemplars(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Exemplar]: - """(Optional) List of exemplars collected from - measurements that were used to form the data point - """ - pass - flags: builtins.int = ... - """Flags that apply to this specific data point. See DataPointFlags - for the available flags and their meaning. - """ - - min: builtins.float = ... - """min is the minimum value over (start_time, end_time].""" - - max: builtins.float = ... - """max is the maximum value over (start_time, end_time].""" - - def __init__(self, - *, - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - start_time_unix_nano : builtins.int = ..., - time_unix_nano : builtins.int = ..., - count : builtins.int = ..., - sum : builtins.float = ..., - bucket_counts : typing.Optional[typing.Iterable[builtins.int]] = ..., - explicit_bounds : typing.Optional[typing.Iterable[builtins.float]] = ..., - exemplars : typing.Optional[typing.Iterable[global___Exemplar]] = ..., - flags : builtins.int = ..., - min : builtins.float = ..., - max : builtins.float = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["_max",b"_max","_min",b"_min","_sum",b"_sum","max",b"max","min",b"min","sum",b"sum"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["_max",b"_max","_min",b"_min","_sum",b"_sum","attributes",b"attributes","bucket_counts",b"bucket_counts","count",b"count","exemplars",b"exemplars","explicit_bounds",b"explicit_bounds","flags",b"flags","max",b"max","min",b"min","start_time_unix_nano",b"start_time_unix_nano","sum",b"sum","time_unix_nano",b"time_unix_nano"]) -> None: ... - @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_max",b"_max"]) -> typing.Optional[typing_extensions.Literal["max"]]: ... - @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_min",b"_min"]) -> typing.Optional[typing_extensions.Literal["min"]]: ... - @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_sum",b"_sum"]) -> typing.Optional[typing_extensions.Literal["sum"]]: ... -global___HistogramDataPoint = HistogramDataPoint - -class ExponentialHistogramDataPoint(google.protobuf.message.Message): - """ExponentialHistogramDataPoint is a single data point in a timeseries that describes the - time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains - summary statistics for a population of values, it may optionally contain the - distribution of those values across a set of buckets. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class Buckets(google.protobuf.message.Message): - """Buckets are a set of bucket counts, encoded in a contiguous array - of counts. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - OFFSET_FIELD_NUMBER: builtins.int - BUCKET_COUNTS_FIELD_NUMBER: builtins.int - offset: builtins.int = ... - """Offset is the bucket index of the first entry in the bucket_counts array. - - Note: This uses a varint encoding as a simple form of compression. - """ - - @property - def bucket_counts(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """Count is an array of counts, where count[i] carries the count - of the bucket at index (offset+i). count[i] is the count of - values greater than or equal to base^(offset+i) and less than - base^(offset+i+1). - - Note: By contrast, the explicit HistogramDataPoint uses - fixed64. This field is expected to have many buckets, - especially zeros, so uint64 has been selected to ensure - varint encoding. - """ - pass - def __init__(self, - *, - offset : builtins.int = ..., - bucket_counts : typing.Optional[typing.Iterable[builtins.int]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["bucket_counts",b"bucket_counts","offset",b"offset"]) -> None: ... - - ATTRIBUTES_FIELD_NUMBER: builtins.int - START_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - COUNT_FIELD_NUMBER: builtins.int - SUM_FIELD_NUMBER: builtins.int - SCALE_FIELD_NUMBER: builtins.int - ZERO_COUNT_FIELD_NUMBER: builtins.int - POSITIVE_FIELD_NUMBER: builtins.int - NEGATIVE_FIELD_NUMBER: builtins.int - FLAGS_FIELD_NUMBER: builtins.int - EXEMPLARS_FIELD_NUMBER: builtins.int - MIN_FIELD_NUMBER: builtins.int - MAX_FIELD_NUMBER: builtins.int - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """The set of key/value pairs that uniquely identify the timeseries from - where this point belongs. The list may be empty (may contain 0 elements). - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - start_time_unix_nano: builtins.int = ... - """StartTimeUnixNano is optional but strongly encouraged, see the - the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - time_unix_nano: builtins.int = ... - """TimeUnixNano is required, see the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - count: builtins.int = ... - """count is the number of values in the population. Must be - non-negative. This value must be equal to the sum of the "bucket_counts" - values in the positive and negative Buckets plus the "zero_count" field. - """ - - sum: builtins.float = ... - """sum of the values in the population. If count is zero then this field - must be zero. - - Note: Sum should only be filled out when measuring non-negative discrete - events, and is assumed to be monotonic over the values of these events. - Negative events *can* be recorded, but sum should not be filled out when - doing so. This is specifically to enforce compatibility w/ OpenMetrics, - see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram - """ - - scale: builtins.int = ... - """scale describes the resolution of the histogram. Boundaries are - located at powers of the base, where: - - base = (2^(2^-scale)) - - The histogram bucket identified by `index`, a signed integer, - contains values that are greater than or equal to (base^index) and - less than (base^(index+1)). - - The positive and negative ranges of the histogram are expressed - separately. Negative values are mapped by their absolute value - into the negative range using the same scale as the positive range. - - scale is not restricted by the protocol, as the permissible - values depend on the range of the data. - """ - - zero_count: builtins.int = ... - """zero_count is the count of values that are either exactly zero or - within the region considered zero by the instrumentation at the - tolerated degree of precision. This bucket stores values that - cannot be expressed using the standard exponential formula as - well as values that have been rounded to zero. - - Implementations MAY consider the zero bucket to have probability - mass equal to (zero_count / count). - """ - - @property - def positive(self) -> global___ExponentialHistogramDataPoint.Buckets: - """positive carries the positive range of exponential bucket counts.""" - pass - @property - def negative(self) -> global___ExponentialHistogramDataPoint.Buckets: - """negative carries the negative range of exponential bucket counts.""" - pass - flags: builtins.int = ... - """Flags that apply to this specific data point. See DataPointFlags - for the available flags and their meaning. - """ - - @property - def exemplars(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Exemplar]: - """(Optional) List of exemplars collected from - measurements that were used to form the data point - """ - pass - min: builtins.float = ... - """min is the minimum value over (start_time, end_time].""" - - max: builtins.float = ... - """max is the maximum value over (start_time, end_time].""" - - def __init__(self, - *, - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - start_time_unix_nano : builtins.int = ..., - time_unix_nano : builtins.int = ..., - count : builtins.int = ..., - sum : builtins.float = ..., - scale : builtins.int = ..., - zero_count : builtins.int = ..., - positive : typing.Optional[global___ExponentialHistogramDataPoint.Buckets] = ..., - negative : typing.Optional[global___ExponentialHistogramDataPoint.Buckets] = ..., - flags : builtins.int = ..., - exemplars : typing.Optional[typing.Iterable[global___Exemplar]] = ..., - min : builtins.float = ..., - max : builtins.float = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["_max",b"_max","_min",b"_min","max",b"max","min",b"min","negative",b"negative","positive",b"positive"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["_max",b"_max","_min",b"_min","attributes",b"attributes","count",b"count","exemplars",b"exemplars","flags",b"flags","max",b"max","min",b"min","negative",b"negative","positive",b"positive","scale",b"scale","start_time_unix_nano",b"start_time_unix_nano","sum",b"sum","time_unix_nano",b"time_unix_nano","zero_count",b"zero_count"]) -> None: ... - @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_max",b"_max"]) -> typing.Optional[typing_extensions.Literal["max"]]: ... - @typing.overload - def WhichOneof(self, oneof_group: typing_extensions.Literal["_min",b"_min"]) -> typing.Optional[typing_extensions.Literal["min"]]: ... -global___ExponentialHistogramDataPoint = ExponentialHistogramDataPoint - -class SummaryDataPoint(google.protobuf.message.Message): - """SummaryDataPoint is a single data point in a timeseries that describes the - time-varying values of a Summary metric. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class ValueAtQuantile(google.protobuf.message.Message): - """Represents the value at a given quantile of a distribution. - - To record Min and Max values following conventions are used: - - The 1.0 quantile is equivalent to the maximum value observed. - - The 0.0 quantile is equivalent to the minimum value observed. - - See the following issue for more context: - https://github.com/open-telemetry/opentelemetry-proto/issues/125 - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - QUANTILE_FIELD_NUMBER: builtins.int - VALUE_FIELD_NUMBER: builtins.int - quantile: builtins.float = ... - """The quantile of a distribution. Must be in the interval - [0.0, 1.0]. - """ - - value: builtins.float = ... - """The value at the given quantile of a distribution. - - Quantile values must NOT be negative. - """ - - def __init__(self, - *, - quantile : builtins.float = ..., - value : builtins.float = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["quantile",b"quantile","value",b"value"]) -> None: ... - - ATTRIBUTES_FIELD_NUMBER: builtins.int - START_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - COUNT_FIELD_NUMBER: builtins.int - SUM_FIELD_NUMBER: builtins.int - QUANTILE_VALUES_FIELD_NUMBER: builtins.int - FLAGS_FIELD_NUMBER: builtins.int - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """The set of key/value pairs that uniquely identify the timeseries from - where this point belongs. The list may be empty (may contain 0 elements). - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - start_time_unix_nano: builtins.int = ... - """StartTimeUnixNano is optional but strongly encouraged, see the - the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - time_unix_nano: builtins.int = ... - """TimeUnixNano is required, see the detailed comments above Metric. - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - count: builtins.int = ... - """count is the number of values in the population. Must be non-negative.""" - - sum: builtins.float = ... - """sum of the values in the population. If count is zero then this field - must be zero. - - Note: Sum should only be filled out when measuring non-negative discrete - events, and is assumed to be monotonic over the values of these events. - Negative events *can* be recorded, but sum should not be filled out when - doing so. This is specifically to enforce compatibility w/ OpenMetrics, - see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#summary - """ - - @property - def quantile_values(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SummaryDataPoint.ValueAtQuantile]: - """(Optional) list of values at different quantiles of the distribution calculated - from the current snapshot. The quantiles must be strictly increasing. - """ - pass - flags: builtins.int = ... - """Flags that apply to this specific data point. See DataPointFlags - for the available flags and their meaning. - """ - - def __init__(self, - *, - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - start_time_unix_nano : builtins.int = ..., - time_unix_nano : builtins.int = ..., - count : builtins.int = ..., - sum : builtins.float = ..., - quantile_values : typing.Optional[typing.Iterable[global___SummaryDataPoint.ValueAtQuantile]] = ..., - flags : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","count",b"count","flags",b"flags","quantile_values",b"quantile_values","start_time_unix_nano",b"start_time_unix_nano","sum",b"sum","time_unix_nano",b"time_unix_nano"]) -> None: ... -global___SummaryDataPoint = SummaryDataPoint - -class Exemplar(google.protobuf.message.Message): - """A representation of an exemplar, which is a sample input measurement. - Exemplars also hold information about the environment when the measurement - was recorded, for example the span and trace ID of the active span when the - exemplar was recorded. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - FILTERED_ATTRIBUTES_FIELD_NUMBER: builtins.int - TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - AS_DOUBLE_FIELD_NUMBER: builtins.int - AS_INT_FIELD_NUMBER: builtins.int - SPAN_ID_FIELD_NUMBER: builtins.int - TRACE_ID_FIELD_NUMBER: builtins.int - @property - def filtered_attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """The set of key/value pairs that were filtered out by the aggregator, but - recorded alongside the original measurement. Only key/value pairs that were - filtered out by the aggregator should be included - """ - pass - time_unix_nano: builtins.int = ... - """time_unix_nano is the exact time when this exemplar was recorded - - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January - 1970. - """ - - as_double: builtins.float = ... - as_int: builtins.int = ... - span_id: builtins.bytes = ... - """(Optional) Span ID of the exemplar trace. - span_id may be missing if the measurement is not recorded inside a trace - or if the trace is not sampled. - """ - - trace_id: builtins.bytes = ... - """(Optional) Trace ID of the exemplar trace. - trace_id may be missing if the measurement is not recorded inside a trace - or if the trace is not sampled. - """ - - def __init__(self, - *, - filtered_attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - time_unix_nano : builtins.int = ..., - as_double : builtins.float = ..., - as_int : builtins.int = ..., - span_id : builtins.bytes = ..., - trace_id : builtins.bytes = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["as_double",b"as_double","as_int",b"as_int","value",b"value"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["as_double",b"as_double","as_int",b"as_int","filtered_attributes",b"filtered_attributes","span_id",b"span_id","time_unix_nano",b"time_unix_nano","trace_id",b"trace_id","value",b"value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["value",b"value"]) -> typing.Optional[typing_extensions.Literal["as_double","as_int"]]: ... -global___Exemplar = Exemplar diff --git a/opensafely/_vendor/opentelemetry/proto/resource/__init__.py b/opensafely/_vendor/opentelemetry/proto/resource/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/resource/v1/__init__.py b/opensafely/_vendor/opentelemetry/proto/resource/v1/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.py b/opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.py deleted file mode 100644 index 56a353cc..00000000 --- a/opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/resource/v1/resource.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.common.v1 import common_pb2 as opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/resource/v1/resource.proto', - package='opentelemetry.proto.resource.v1', - syntax='proto3', - serialized_options=b'\n\"io.opentelemetry.proto.resource.v1B\rResourceProtoP\001Z*go.opentelemetry.io/proto/otlp/resource/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n.opentelemetry/proto/resource/v1/resource.proto\x12\x1fopentelemetry.proto.resource.v1\x1a*opentelemetry/proto/common/v1/common.proto\"i\n\x08Resource\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x02 \x01(\rBa\n\"io.opentelemetry.proto.resource.v1B\rResourceProtoP\x01Z*go.opentelemetry.io/proto/otlp/resource/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,]) - - - - -_RESOURCE = _descriptor.Descriptor( - name='Resource', - full_name='opentelemetry.proto.resource.v1.Resource', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.resource.v1.Resource.attributes', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.resource.v1.Resource.dropped_attributes_count', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=127, - serialized_end=232, -) - -_RESOURCE.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -DESCRIPTOR.message_types_by_name['Resource'] = _RESOURCE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Resource = _reflection.GeneratedProtocolMessageType('Resource', (_message.Message,), { - 'DESCRIPTOR' : _RESOURCE, - '__module__' : 'opentelemetry.proto.resource.v1.resource_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.resource.v1.Resource) - }) -_sym_db.RegisterMessage(Resource) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.pyi deleted file mode 100644 index f660c7f2..00000000 --- a/opensafely/_vendor/opentelemetry/proto/resource/v1/resource_pb2.pyi +++ /dev/null @@ -1,38 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.message -import opentelemetry.proto.common.v1.common_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class Resource(google.protobuf.message.Message): - """Resource information.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - ATTRIBUTES_FIELD_NUMBER: builtins.int - DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """Set of attributes that describe the resource. - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - dropped_attributes_count: builtins.int = ... - """dropped_attributes_count is the number of dropped attributes. If the value is 0, then - no attributes were dropped. - """ - - def __init__(self, - *, - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - dropped_attributes_count : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count"]) -> None: ... -global___Resource = Resource diff --git a/opensafely/_vendor/opentelemetry/proto/trace/__init__.py b/opensafely/_vendor/opentelemetry/proto/trace/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/trace/v1/__init__.py b/opensafely/_vendor/opentelemetry/proto/trace/v1/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.py b/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.py deleted file mode 100644 index 9f1f47ae..00000000 --- a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.py +++ /dev/null @@ -1,290 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/trace/v1/trace_config.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/trace/v1/trace_config.proto', - package='opentelemetry.proto.trace.v1', - syntax='proto3', - serialized_options=b'\n\037io.opentelemetry.proto.trace.v1B\020TraceConfigProtoP\001Z1go.opentelemetry.io/proto/otlp/collector/trace/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n/opentelemetry/proto/trace/v1/trace_config.proto\x12\x1copentelemetry.proto.trace.v1\"\xc8\x03\n\x0bTraceConfig\x12I\n\x10\x63onstant_sampler\x18\x01 \x01(\x0b\x32-.opentelemetry.proto.trace.v1.ConstantSamplerH\x00\x12O\n\x14trace_id_ratio_based\x18\x02 \x01(\x0b\x32/.opentelemetry.proto.trace.v1.TraceIdRatioBasedH\x00\x12R\n\x15rate_limiting_sampler\x18\x03 \x01(\x0b\x32\x31.opentelemetry.proto.trace.v1.RateLimitingSamplerH\x00\x12 \n\x18max_number_of_attributes\x18\x04 \x01(\x03\x12\"\n\x1amax_number_of_timed_events\x18\x05 \x01(\x03\x12\x30\n(max_number_of_attributes_per_timed_event\x18\x06 \x01(\x03\x12\x1b\n\x13max_number_of_links\x18\x07 \x01(\x03\x12)\n!max_number_of_attributes_per_link\x18\x08 \x01(\x03\x42\t\n\x07sampler\"\xa9\x01\n\x0f\x43onstantSampler\x12P\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0e\x32>.opentelemetry.proto.trace.v1.ConstantSampler.ConstantDecision\"D\n\x10\x43onstantDecision\x12\x0e\n\nALWAYS_OFF\x10\x00\x12\r\n\tALWAYS_ON\x10\x01\x12\x11\n\rALWAYS_PARENT\x10\x02\"*\n\x11TraceIdRatioBased\x12\x15\n\rsamplingRatio\x18\x01 \x01(\x01\"\"\n\x13RateLimitingSampler\x12\x0b\n\x03qps\x18\x01 \x01(\x03\x42h\n\x1fio.opentelemetry.proto.trace.v1B\x10TraceConfigProtoP\x01Z1go.opentelemetry.io/proto/otlp/collector/trace/v1b\x06proto3' -) - - - -_CONSTANTSAMPLER_CONSTANTDECISION = _descriptor.EnumDescriptor( - name='ConstantDecision', - full_name='opentelemetry.proto.trace.v1.ConstantSampler.ConstantDecision', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='ALWAYS_OFF', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ALWAYS_ON', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ALWAYS_PARENT', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=642, - serialized_end=710, -) -_sym_db.RegisterEnumDescriptor(_CONSTANTSAMPLER_CONSTANTDECISION) - - -_TRACECONFIG = _descriptor.Descriptor( - name='TraceConfig', - full_name='opentelemetry.proto.trace.v1.TraceConfig', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='constant_sampler', full_name='opentelemetry.proto.trace.v1.TraceConfig.constant_sampler', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_id_ratio_based', full_name='opentelemetry.proto.trace.v1.TraceConfig.trace_id_ratio_based', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='rate_limiting_sampler', full_name='opentelemetry.proto.trace.v1.TraceConfig.rate_limiting_sampler', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_attributes', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_attributes', index=3, - number=4, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_timed_events', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_timed_events', index=4, - number=5, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_attributes_per_timed_event', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_attributes_per_timed_event', index=5, - number=6, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_links', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_links', index=6, - number=7, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_attributes_per_link', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_attributes_per_link', index=7, - number=8, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='sampler', full_name='opentelemetry.proto.trace.v1.TraceConfig.sampler', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=82, - serialized_end=538, -) - - -_CONSTANTSAMPLER = _descriptor.Descriptor( - name='ConstantSampler', - full_name='opentelemetry.proto.trace.v1.ConstantSampler', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='decision', full_name='opentelemetry.proto.trace.v1.ConstantSampler.decision', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _CONSTANTSAMPLER_CONSTANTDECISION, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=541, - serialized_end=710, -) - - -_TRACEIDRATIOBASED = _descriptor.Descriptor( - name='TraceIdRatioBased', - full_name='opentelemetry.proto.trace.v1.TraceIdRatioBased', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='samplingRatio', full_name='opentelemetry.proto.trace.v1.TraceIdRatioBased.samplingRatio', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=712, - serialized_end=754, -) - - -_RATELIMITINGSAMPLER = _descriptor.Descriptor( - name='RateLimitingSampler', - full_name='opentelemetry.proto.trace.v1.RateLimitingSampler', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='qps', full_name='opentelemetry.proto.trace.v1.RateLimitingSampler.qps', index=0, - number=1, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=756, - serialized_end=790, -) - -_TRACECONFIG.fields_by_name['constant_sampler'].message_type = _CONSTANTSAMPLER -_TRACECONFIG.fields_by_name['trace_id_ratio_based'].message_type = _TRACEIDRATIOBASED -_TRACECONFIG.fields_by_name['rate_limiting_sampler'].message_type = _RATELIMITINGSAMPLER -_TRACECONFIG.oneofs_by_name['sampler'].fields.append( - _TRACECONFIG.fields_by_name['constant_sampler']) -_TRACECONFIG.fields_by_name['constant_sampler'].containing_oneof = _TRACECONFIG.oneofs_by_name['sampler'] -_TRACECONFIG.oneofs_by_name['sampler'].fields.append( - _TRACECONFIG.fields_by_name['trace_id_ratio_based']) -_TRACECONFIG.fields_by_name['trace_id_ratio_based'].containing_oneof = _TRACECONFIG.oneofs_by_name['sampler'] -_TRACECONFIG.oneofs_by_name['sampler'].fields.append( - _TRACECONFIG.fields_by_name['rate_limiting_sampler']) -_TRACECONFIG.fields_by_name['rate_limiting_sampler'].containing_oneof = _TRACECONFIG.oneofs_by_name['sampler'] -_CONSTANTSAMPLER.fields_by_name['decision'].enum_type = _CONSTANTSAMPLER_CONSTANTDECISION -_CONSTANTSAMPLER_CONSTANTDECISION.containing_type = _CONSTANTSAMPLER -DESCRIPTOR.message_types_by_name['TraceConfig'] = _TRACECONFIG -DESCRIPTOR.message_types_by_name['ConstantSampler'] = _CONSTANTSAMPLER -DESCRIPTOR.message_types_by_name['TraceIdRatioBased'] = _TRACEIDRATIOBASED -DESCRIPTOR.message_types_by_name['RateLimitingSampler'] = _RATELIMITINGSAMPLER -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -TraceConfig = _reflection.GeneratedProtocolMessageType('TraceConfig', (_message.Message,), { - 'DESCRIPTOR' : _TRACECONFIG, - '__module__' : 'opentelemetry.proto.trace.v1.trace_config_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.TraceConfig) - }) -_sym_db.RegisterMessage(TraceConfig) - -ConstantSampler = _reflection.GeneratedProtocolMessageType('ConstantSampler', (_message.Message,), { - 'DESCRIPTOR' : _CONSTANTSAMPLER, - '__module__' : 'opentelemetry.proto.trace.v1.trace_config_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.ConstantSampler) - }) -_sym_db.RegisterMessage(ConstantSampler) - -TraceIdRatioBased = _reflection.GeneratedProtocolMessageType('TraceIdRatioBased', (_message.Message,), { - 'DESCRIPTOR' : _TRACEIDRATIOBASED, - '__module__' : 'opentelemetry.proto.trace.v1.trace_config_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.TraceIdRatioBased) - }) -_sym_db.RegisterMessage(TraceIdRatioBased) - -RateLimitingSampler = _reflection.GeneratedProtocolMessageType('RateLimitingSampler', (_message.Message,), { - 'DESCRIPTOR' : _RATELIMITINGSAMPLER, - '__module__' : 'opentelemetry.proto.trace.v1.trace_config_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.RateLimitingSampler) - }) -_sym_db.RegisterMessage(RateLimitingSampler) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.pyi deleted file mode 100644 index 8290baf5..00000000 --- a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_config_pb2.pyi +++ /dev/null @@ -1,123 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.enum_type_wrapper -import google.protobuf.message -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class TraceConfig(google.protobuf.message.Message): - """Global configuration of the trace service. All fields must be specified, or - the default (zero) values will be used for each type. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - CONSTANT_SAMPLER_FIELD_NUMBER: builtins.int - TRACE_ID_RATIO_BASED_FIELD_NUMBER: builtins.int - RATE_LIMITING_SAMPLER_FIELD_NUMBER: builtins.int - MAX_NUMBER_OF_ATTRIBUTES_FIELD_NUMBER: builtins.int - MAX_NUMBER_OF_TIMED_EVENTS_FIELD_NUMBER: builtins.int - MAX_NUMBER_OF_ATTRIBUTES_PER_TIMED_EVENT_FIELD_NUMBER: builtins.int - MAX_NUMBER_OF_LINKS_FIELD_NUMBER: builtins.int - MAX_NUMBER_OF_ATTRIBUTES_PER_LINK_FIELD_NUMBER: builtins.int - @property - def constant_sampler(self) -> global___ConstantSampler: ... - @property - def trace_id_ratio_based(self) -> global___TraceIdRatioBased: ... - @property - def rate_limiting_sampler(self) -> global___RateLimitingSampler: ... - max_number_of_attributes: builtins.int = ... - """The global default max number of attributes per span.""" - - max_number_of_timed_events: builtins.int = ... - """The global default max number of annotation events per span.""" - - max_number_of_attributes_per_timed_event: builtins.int = ... - """The global default max number of attributes per timed event.""" - - max_number_of_links: builtins.int = ... - """The global default max number of link entries per span.""" - - max_number_of_attributes_per_link: builtins.int = ... - """The global default max number of attributes per span.""" - - def __init__(self, - *, - constant_sampler : typing.Optional[global___ConstantSampler] = ..., - trace_id_ratio_based : typing.Optional[global___TraceIdRatioBased] = ..., - rate_limiting_sampler : typing.Optional[global___RateLimitingSampler] = ..., - max_number_of_attributes : builtins.int = ..., - max_number_of_timed_events : builtins.int = ..., - max_number_of_attributes_per_timed_event : builtins.int = ..., - max_number_of_links : builtins.int = ..., - max_number_of_attributes_per_link : builtins.int = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["constant_sampler",b"constant_sampler","rate_limiting_sampler",b"rate_limiting_sampler","sampler",b"sampler","trace_id_ratio_based",b"trace_id_ratio_based"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["constant_sampler",b"constant_sampler","max_number_of_attributes",b"max_number_of_attributes","max_number_of_attributes_per_link",b"max_number_of_attributes_per_link","max_number_of_attributes_per_timed_event",b"max_number_of_attributes_per_timed_event","max_number_of_links",b"max_number_of_links","max_number_of_timed_events",b"max_number_of_timed_events","rate_limiting_sampler",b"rate_limiting_sampler","sampler",b"sampler","trace_id_ratio_based",b"trace_id_ratio_based"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["sampler",b"sampler"]) -> typing.Optional[typing_extensions.Literal["constant_sampler","trace_id_ratio_based","rate_limiting_sampler"]]: ... -global___TraceConfig = TraceConfig - -class ConstantSampler(google.protobuf.message.Message): - """Sampler that always makes a constant decision on span sampling.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class ConstantDecision(_ConstantDecision, metaclass=_ConstantDecisionEnumTypeWrapper): - """How spans should be sampled: - - Always off - - Always on - - Always follow the parent Span's decision (off if no parent). - """ - pass - class _ConstantDecision: - V = typing.NewType('V', builtins.int) - class _ConstantDecisionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_ConstantDecision.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - ALWAYS_OFF = ConstantSampler.ConstantDecision.V(0) - ALWAYS_ON = ConstantSampler.ConstantDecision.V(1) - ALWAYS_PARENT = ConstantSampler.ConstantDecision.V(2) - - ALWAYS_OFF = ConstantSampler.ConstantDecision.V(0) - ALWAYS_ON = ConstantSampler.ConstantDecision.V(1) - ALWAYS_PARENT = ConstantSampler.ConstantDecision.V(2) - - DECISION_FIELD_NUMBER: builtins.int - decision: global___ConstantSampler.ConstantDecision.V = ... - def __init__(self, - *, - decision : global___ConstantSampler.ConstantDecision.V = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["decision",b"decision"]) -> None: ... -global___ConstantSampler = ConstantSampler - -class TraceIdRatioBased(google.protobuf.message.Message): - """Sampler that tries to uniformly sample traces with a given ratio. - The ratio of sampling a trace is equal to that of the specified ratio. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - SAMPLINGRATIO_FIELD_NUMBER: builtins.int - samplingRatio: builtins.float = ... - """The desired ratio of sampling. Must be within [0.0, 1.0].""" - - def __init__(self, - *, - samplingRatio : builtins.float = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["samplingRatio",b"samplingRatio"]) -> None: ... -global___TraceIdRatioBased = TraceIdRatioBased - -class RateLimitingSampler(google.protobuf.message.Message): - """Sampler that tries to sample with a rate per time window.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - QPS_FIELD_NUMBER: builtins.int - qps: builtins.int = ... - """Rate per second.""" - - def __init__(self, - *, - qps : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["qps",b"qps"]) -> None: ... -global___RateLimitingSampler = RateLimitingSampler diff --git a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.py b/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.py deleted file mode 100644 index 396c6ba0..00000000 --- a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.py +++ /dev/null @@ -1,654 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/trace/v1/trace.proto -"""Generated protocol buffer code.""" -from opensafely._vendor.google.protobuf import descriptor as _descriptor -from opensafely._vendor.google.protobuf import message as _message -from opensafely._vendor.google.protobuf import reflection as _reflection -from opensafely._vendor.google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opensafely._vendor.opentelemetry.proto.common.v1 import common_pb2 as opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2 -from opensafely._vendor.opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/trace/v1/trace.proto', - package='opentelemetry.proto.trace.v1', - syntax='proto3', - serialized_options=b'\n\037io.opentelemetry.proto.trace.v1B\nTraceProtoP\001Z\'go.opentelemetry.io/proto/otlp/trace/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n(opentelemetry/proto/trace/v1/trace.proto\x12\x1copentelemetry.proto.trace.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"Q\n\nTracesData\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\x86\x02\n\rResourceSpans\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12=\n\x0bscope_spans\x18\x02 \x03(\x0b\x32(.opentelemetry.proto.trace.v1.ScopeSpans\x12\x65\n\x1dinstrumentation_library_spans\x18\xe8\x07 \x03(\x0b\x32\x39.opentelemetry.proto.trace.v1.InstrumentationLibrarySpansB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x97\x01\n\nScopeSpans\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc0\x01\n\x1bInstrumentationLibrarySpans\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\xe6\x07\n\x04Span\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12\x16\n\x0eparent_span_id\x18\x04 \x01(\x0c\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x39\n\x04kind\x18\x06 \x01(\x0e\x32+.opentelemetry.proto.trace.v1.Span.SpanKind\x12\x1c\n\x14start_time_unix_nano\x18\x07 \x01(\x06\x12\x1a\n\x12\x65nd_time_unix_nano\x18\x08 \x01(\x06\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\n \x01(\r\x12\x38\n\x06\x65vents\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.trace.v1.Span.Event\x12\x1c\n\x14\x64ropped_events_count\x18\x0c \x01(\r\x12\x36\n\x05links\x18\r \x03(\x0b\x32\'.opentelemetry.proto.trace.v1.Span.Link\x12\x1b\n\x13\x64ropped_links_count\x18\x0e \x01(\r\x12\x34\n\x06status\x18\x0f \x01(\x0b\x32$.opentelemetry.proto.trace.v1.Status\x1a\x8c\x01\n\x05\x45vent\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x0c\n\x04name\x18\x02 \x01(\t\x12;\n\nattributes\x18\x03 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x04 \x01(\r\x1a\x9d\x01\n\x04Link\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12;\n\nattributes\x18\x04 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x05 \x01(\r\"\x99\x01\n\x08SpanKind\x12\x19\n\x15SPAN_KIND_UNSPECIFIED\x10\x00\x12\x16\n\x12SPAN_KIND_INTERNAL\x10\x01\x12\x14\n\x10SPAN_KIND_SERVER\x10\x02\x12\x14\n\x10SPAN_KIND_CLIENT\x10\x03\x12\x16\n\x12SPAN_KIND_PRODUCER\x10\x04\x12\x16\n\x12SPAN_KIND_CONSUMER\x10\x05\"\xae\x01\n\x06Status\x12\x0f\n\x07message\x18\x02 \x01(\t\x12=\n\x04\x63ode\x18\x03 \x01(\x0e\x32/.opentelemetry.proto.trace.v1.Status.StatusCode\"N\n\nStatusCode\x12\x15\n\x11STATUS_CODE_UNSET\x10\x00\x12\x12\n\x0eSTATUS_CODE_OK\x10\x01\x12\x15\n\x11STATUS_CODE_ERROR\x10\x02J\x04\x08\x01\x10\x02\x42X\n\x1fio.opentelemetry.proto.trace.v1B\nTraceProtoP\x01Z\'go.opentelemetry.io/proto/otlp/trace/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - - - -_SPAN_SPANKIND = _descriptor.EnumDescriptor( - name='SpanKind', - full_name='opentelemetry.proto.trace.v1.Span.SpanKind', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_INTERNAL', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_SERVER', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_CLIENT', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_PRODUCER', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_CONSUMER', index=5, number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1709, - serialized_end=1862, -) -_sym_db.RegisterEnumDescriptor(_SPAN_SPANKIND) - -_STATUS_STATUSCODE = _descriptor.EnumDescriptor( - name='StatusCode', - full_name='opentelemetry.proto.trace.v1.Status.StatusCode', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='STATUS_CODE_UNSET', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='STATUS_CODE_OK', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='STATUS_CODE_ERROR', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1955, - serialized_end=2033, -) -_sym_db.RegisterEnumDescriptor(_STATUS_STATUSCODE) - - -_TRACESDATA = _descriptor.Descriptor( - name='TracesData', - full_name='opentelemetry.proto.trace.v1.TracesData', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_spans', full_name='opentelemetry.proto.trace.v1.TracesData.resource_spans', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=166, - serialized_end=247, -) - - -_RESOURCESPANS = _descriptor.Descriptor( - name='ResourceSpans', - full_name='opentelemetry.proto.trace.v1.ResourceSpans', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.trace.v1.ResourceSpans.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scope_spans', full_name='opentelemetry.proto.trace.v1.ResourceSpans.scope_spans', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='instrumentation_library_spans', full_name='opentelemetry.proto.trace.v1.ResourceSpans.instrumentation_library_spans', index=2, - number=1000, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.trace.v1.ResourceSpans.schema_url', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=250, - serialized_end=512, -) - - -_SCOPESPANS = _descriptor.Descriptor( - name='ScopeSpans', - full_name='opentelemetry.proto.trace.v1.ScopeSpans', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='scope', full_name='opentelemetry.proto.trace.v1.ScopeSpans.scope', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='spans', full_name='opentelemetry.proto.trace.v1.ScopeSpans.spans', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.trace.v1.ScopeSpans.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=515, - serialized_end=666, -) - - -_INSTRUMENTATIONLIBRARYSPANS = _descriptor.Descriptor( - name='InstrumentationLibrarySpans', - full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='instrumentation_library', full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans.instrumentation_library', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='spans', full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans.spans', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=669, - serialized_end=861, -) - - -_SPAN_EVENT = _descriptor.Descriptor( - name='Event', - full_name='opentelemetry.proto.trace.v1.Span.Event', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.trace.v1.Span.Event.time_unix_nano', index=0, - number=1, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.trace.v1.Span.Event.name', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.trace.v1.Span.Event.attributes', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.trace.v1.Span.Event.dropped_attributes_count', index=3, - number=4, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1406, - serialized_end=1546, -) - -_SPAN_LINK = _descriptor.Descriptor( - name='Link', - full_name='opentelemetry.proto.trace.v1.Span.Link', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.trace.v1.Span.Link.trace_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.trace.v1.Span.Link.span_id', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_state', full_name='opentelemetry.proto.trace.v1.Span.Link.trace_state', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.trace.v1.Span.Link.attributes', index=3, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.trace.v1.Span.Link.dropped_attributes_count', index=4, - number=5, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1549, - serialized_end=1706, -) - -_SPAN = _descriptor.Descriptor( - name='Span', - full_name='opentelemetry.proto.trace.v1.Span', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.trace.v1.Span.trace_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.trace.v1.Span.span_id', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_state', full_name='opentelemetry.proto.trace.v1.Span.trace_state', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='parent_span_id', full_name='opentelemetry.proto.trace.v1.Span.parent_span_id', index=3, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.trace.v1.Span.name', index=4, - number=5, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='kind', full_name='opentelemetry.proto.trace.v1.Span.kind', index=5, - number=6, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.trace.v1.Span.start_time_unix_nano', index=6, - number=7, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='end_time_unix_nano', full_name='opentelemetry.proto.trace.v1.Span.end_time_unix_nano', index=7, - number=8, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.trace.v1.Span.attributes', index=8, - number=9, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.trace.v1.Span.dropped_attributes_count', index=9, - number=10, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='events', full_name='opentelemetry.proto.trace.v1.Span.events', index=10, - number=11, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_events_count', full_name='opentelemetry.proto.trace.v1.Span.dropped_events_count', index=11, - number=12, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='links', full_name='opentelemetry.proto.trace.v1.Span.links', index=12, - number=13, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_links_count', full_name='opentelemetry.proto.trace.v1.Span.dropped_links_count', index=13, - number=14, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='status', full_name='opentelemetry.proto.trace.v1.Span.status', index=14, - number=15, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_SPAN_EVENT, _SPAN_LINK, ], - enum_types=[ - _SPAN_SPANKIND, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=864, - serialized_end=1862, -) - - -_STATUS = _descriptor.Descriptor( - name='Status', - full_name='opentelemetry.proto.trace.v1.Status', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message', full_name='opentelemetry.proto.trace.v1.Status.message', index=0, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='code', full_name='opentelemetry.proto.trace.v1.Status.code', index=1, - number=3, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _STATUS_STATUSCODE, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1865, - serialized_end=2039, -) - -_TRACESDATA.fields_by_name['resource_spans'].message_type = _RESOURCESPANS -_RESOURCESPANS.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_RESOURCESPANS.fields_by_name['scope_spans'].message_type = _SCOPESPANS -_RESOURCESPANS.fields_by_name['instrumentation_library_spans'].message_type = _INSTRUMENTATIONLIBRARYSPANS -_SCOPESPANS.fields_by_name['scope'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONSCOPE -_SCOPESPANS.fields_by_name['spans'].message_type = _SPAN -_INSTRUMENTATIONLIBRARYSPANS.fields_by_name['instrumentation_library'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONLIBRARY -_INSTRUMENTATIONLIBRARYSPANS.fields_by_name['spans'].message_type = _SPAN -_SPAN_EVENT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SPAN_EVENT.containing_type = _SPAN -_SPAN_LINK.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SPAN_LINK.containing_type = _SPAN -_SPAN.fields_by_name['kind'].enum_type = _SPAN_SPANKIND -_SPAN.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SPAN.fields_by_name['events'].message_type = _SPAN_EVENT -_SPAN.fields_by_name['links'].message_type = _SPAN_LINK -_SPAN.fields_by_name['status'].message_type = _STATUS -_SPAN_SPANKIND.containing_type = _SPAN -_STATUS.fields_by_name['code'].enum_type = _STATUS_STATUSCODE -_STATUS_STATUSCODE.containing_type = _STATUS -DESCRIPTOR.message_types_by_name['TracesData'] = _TRACESDATA -DESCRIPTOR.message_types_by_name['ResourceSpans'] = _RESOURCESPANS -DESCRIPTOR.message_types_by_name['ScopeSpans'] = _SCOPESPANS -DESCRIPTOR.message_types_by_name['InstrumentationLibrarySpans'] = _INSTRUMENTATIONLIBRARYSPANS -DESCRIPTOR.message_types_by_name['Span'] = _SPAN -DESCRIPTOR.message_types_by_name['Status'] = _STATUS -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -TracesData = _reflection.GeneratedProtocolMessageType('TracesData', (_message.Message,), { - 'DESCRIPTOR' : _TRACESDATA, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.TracesData) - }) -_sym_db.RegisterMessage(TracesData) - -ResourceSpans = _reflection.GeneratedProtocolMessageType('ResourceSpans', (_message.Message,), { - 'DESCRIPTOR' : _RESOURCESPANS, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.ResourceSpans) - }) -_sym_db.RegisterMessage(ResourceSpans) - -ScopeSpans = _reflection.GeneratedProtocolMessageType('ScopeSpans', (_message.Message,), { - 'DESCRIPTOR' : _SCOPESPANS, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.ScopeSpans) - }) -_sym_db.RegisterMessage(ScopeSpans) - -InstrumentationLibrarySpans = _reflection.GeneratedProtocolMessageType('InstrumentationLibrarySpans', (_message.Message,), { - 'DESCRIPTOR' : _INSTRUMENTATIONLIBRARYSPANS, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.InstrumentationLibrarySpans) - }) -_sym_db.RegisterMessage(InstrumentationLibrarySpans) - -Span = _reflection.GeneratedProtocolMessageType('Span', (_message.Message,), { - - 'Event' : _reflection.GeneratedProtocolMessageType('Event', (_message.Message,), { - 'DESCRIPTOR' : _SPAN_EVENT, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.Span.Event) - }) - , - - 'Link' : _reflection.GeneratedProtocolMessageType('Link', (_message.Message,), { - 'DESCRIPTOR' : _SPAN_LINK, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.Span.Link) - }) - , - 'DESCRIPTOR' : _SPAN, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.Span) - }) -_sym_db.RegisterMessage(Span) -_sym_db.RegisterMessage(Span.Event) -_sym_db.RegisterMessage(Span.Link) - -Status = _reflection.GeneratedProtocolMessageType('Status', (_message.Message,), { - 'DESCRIPTOR' : _STATUS, - '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.trace.v1.Status) - }) -_sym_db.RegisterMessage(Status) - - -DESCRIPTOR._options = None -_RESOURCESPANS.fields_by_name['instrumentation_library_spans']._options = None -_INSTRUMENTATIONLIBRARYSPANS._options = None -# @@protoc_insertion_point(module_scope) diff --git a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.pyi b/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.pyi deleted file mode 100644 index 170d66e1..00000000 --- a/opensafely/_vendor/opentelemetry/proto/trace/v1/trace_pb2.pyi +++ /dev/null @@ -1,551 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.internal.enum_type_wrapper -import google.protobuf.message -import opentelemetry.proto.common.v1.common_pb2 -import opentelemetry.proto.resource.v1.resource_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class TracesData(google.protobuf.message.Message): - """TracesData represents the traces data that can be stored in a persistent storage, - OR can be embedded by other protocols that transfer OTLP traces data but do - not implement the OTLP protocol. - - The main difference between this message and collector protocol is that - in this message there will not be any "control" or "metadata" specific to - OTLP protocol. - - When new fields are added into this message, the OTLP request MUST be updated - as well. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_SPANS_FIELD_NUMBER: builtins.int - @property - def resource_spans(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ResourceSpans]: - """An array of ResourceSpans. - For data coming from a single resource this array will typically contain - one element. Intermediary nodes that receive data from multiple origins - typically batch the data before forwarding further and in that case this - array will contain multiple elements. - """ - pass - def __init__(self, - *, - resource_spans : typing.Optional[typing.Iterable[global___ResourceSpans]] = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["resource_spans",b"resource_spans"]) -> None: ... -global___TracesData = TracesData - -class ResourceSpans(google.protobuf.message.Message): - """A collection of ScopeSpans from a Resource.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_FIELD_NUMBER: builtins.int - SCOPE_SPANS_FIELD_NUMBER: builtins.int - INSTRUMENTATION_LIBRARY_SPANS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def resource(self) -> opentelemetry.proto.resource.v1.resource_pb2.Resource: - """The resource for the spans in this message. - If this field is not set then no resource info is known. - """ - pass - @property - def scope_spans(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ScopeSpans]: - """A list of ScopeSpans that originate from a resource.""" - pass - @property - def instrumentation_library_spans(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___InstrumentationLibrarySpans]: - """A list of InstrumentationLibrarySpans that originate from a resource. - This field is deprecated and will be removed after grace period expires on June 15, 2022. - - During the grace period the following rules SHOULD be followed: - - For Binary Protobufs - ==================== - Binary Protobuf senders SHOULD NOT set instrumentation_library_spans. Instead - scope_spans SHOULD be set. - - Binary Protobuf receivers SHOULD check if instrumentation_library_spans is set - and scope_spans is not set then the value in instrumentation_library_spans - SHOULD be used instead by converting InstrumentationLibrarySpans into ScopeSpans. - If scope_spans is set then instrumentation_library_spans SHOULD be ignored. - - For JSON - ======== - JSON senders that set instrumentation_library_spans field MAY also set - scope_spans to carry the same spans, essentially double-publishing the same data. - Such double-publishing MAY be controlled by a user-settable option. - If double-publishing is not used then the senders SHOULD set scope_spans and - SHOULD NOT set instrumentation_library_spans. - - JSON receivers SHOULD check if instrumentation_library_spans is set and - scope_spans is not set then the value in instrumentation_library_spans - SHOULD be used instead by converting InstrumentationLibrarySpans into ScopeSpans. - If scope_spans is set then instrumentation_library_spans field SHOULD be ignored. - """ - pass - schema_url: typing.Text = ... - """This schema_url applies to the data in the "resource" field. It does not apply - to the data in the "scope_spans" field which have their own schema_url field. - """ - - def __init__(self, - *, - resource : typing.Optional[opentelemetry.proto.resource.v1.resource_pb2.Resource] = ..., - scope_spans : typing.Optional[typing.Iterable[global___ScopeSpans]] = ..., - instrumentation_library_spans : typing.Optional[typing.Iterable[global___InstrumentationLibrarySpans]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["resource",b"resource"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["instrumentation_library_spans",b"instrumentation_library_spans","resource",b"resource","schema_url",b"schema_url","scope_spans",b"scope_spans"]) -> None: ... -global___ResourceSpans = ResourceSpans - -class ScopeSpans(google.protobuf.message.Message): - """A collection of Spans produced by an InstrumentationScope.""" - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - SCOPE_FIELD_NUMBER: builtins.int - SPANS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def scope(self) -> opentelemetry.proto.common.v1.common_pb2.InstrumentationScope: - """The instrumentation scope information for the spans in this message. - Semantically when InstrumentationScope isn't set, it is equivalent with - an empty instrumentation scope name (unknown). - """ - pass - @property - def spans(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Span]: - """A list of Spans that originate from an instrumentation scope.""" - pass - schema_url: typing.Text = ... - """This schema_url applies to all spans and span events in the "spans" field.""" - - def __init__(self, - *, - scope : typing.Optional[opentelemetry.proto.common.v1.common_pb2.InstrumentationScope] = ..., - spans : typing.Optional[typing.Iterable[global___Span]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["scope",b"scope"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["schema_url",b"schema_url","scope",b"scope","spans",b"spans"]) -> None: ... -global___ScopeSpans = ScopeSpans - -class InstrumentationLibrarySpans(google.protobuf.message.Message): - """A collection of Spans produced by an InstrumentationLibrary. - InstrumentationLibrarySpans is wire-compatible with ScopeSpans for binary - Protobuf format. - This message is deprecated and will be removed on June 15, 2022. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - INSTRUMENTATION_LIBRARY_FIELD_NUMBER: builtins.int - SPANS_FIELD_NUMBER: builtins.int - SCHEMA_URL_FIELD_NUMBER: builtins.int - @property - def instrumentation_library(self) -> opentelemetry.proto.common.v1.common_pb2.InstrumentationLibrary: - """The instrumentation library information for the spans in this message. - Semantically when InstrumentationLibrary isn't set, it is equivalent with - an empty instrumentation library name (unknown). - """ - pass - @property - def spans(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Span]: - """A list of Spans that originate from an instrumentation library.""" - pass - schema_url: typing.Text = ... - """This schema_url applies to all spans and span events in the "spans" field.""" - - def __init__(self, - *, - instrumentation_library : typing.Optional[opentelemetry.proto.common.v1.common_pb2.InstrumentationLibrary] = ..., - spans : typing.Optional[typing.Iterable[global___Span]] = ..., - schema_url : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["instrumentation_library",b"instrumentation_library"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["instrumentation_library",b"instrumentation_library","schema_url",b"schema_url","spans",b"spans"]) -> None: ... -global___InstrumentationLibrarySpans = InstrumentationLibrarySpans - -class Span(google.protobuf.message.Message): - """Span represents a single operation within a trace. Spans can be - nested to form a trace tree. Spans may also be linked to other spans - from the same or different trace and form graphs. Often, a trace - contains a root span that describes the end-to-end latency, and one - or more subspans for its sub-operations. A trace can also contain - multiple root spans, or none at all. Spans do not need to be - contiguous - there may be gaps or overlaps between spans in a trace. - - The next available field id is 17. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class SpanKind(_SpanKind, metaclass=_SpanKindEnumTypeWrapper): - """SpanKind is the type of span. Can be used to specify additional relationships between spans - in addition to a parent/child relationship. - """ - pass - class _SpanKind: - V = typing.NewType('V', builtins.int) - class _SpanKindEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_SpanKind.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - SPAN_KIND_UNSPECIFIED = Span.SpanKind.V(0) - """Unspecified. Do NOT use as default. - Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. - """ - - SPAN_KIND_INTERNAL = Span.SpanKind.V(1) - """Indicates that the span represents an internal operation within an application, - as opposed to an operation happening at the boundaries. Default value. - """ - - SPAN_KIND_SERVER = Span.SpanKind.V(2) - """Indicates that the span covers server-side handling of an RPC or other - remote network request. - """ - - SPAN_KIND_CLIENT = Span.SpanKind.V(3) - """Indicates that the span describes a request to some remote service.""" - - SPAN_KIND_PRODUCER = Span.SpanKind.V(4) - """Indicates that the span describes a producer sending a message to a broker. - Unlike CLIENT and SERVER, there is often no direct critical path latency relationship - between producer and consumer spans. A PRODUCER span ends when the message was accepted - by the broker while the logical processing of the message might span a much longer time. - """ - - SPAN_KIND_CONSUMER = Span.SpanKind.V(5) - """Indicates that the span describes consumer receiving a message from a broker. - Like the PRODUCER kind, there is often no direct critical path latency relationship - between producer and consumer spans. - """ - - - SPAN_KIND_UNSPECIFIED = Span.SpanKind.V(0) - """Unspecified. Do NOT use as default. - Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. - """ - - SPAN_KIND_INTERNAL = Span.SpanKind.V(1) - """Indicates that the span represents an internal operation within an application, - as opposed to an operation happening at the boundaries. Default value. - """ - - SPAN_KIND_SERVER = Span.SpanKind.V(2) - """Indicates that the span covers server-side handling of an RPC or other - remote network request. - """ - - SPAN_KIND_CLIENT = Span.SpanKind.V(3) - """Indicates that the span describes a request to some remote service.""" - - SPAN_KIND_PRODUCER = Span.SpanKind.V(4) - """Indicates that the span describes a producer sending a message to a broker. - Unlike CLIENT and SERVER, there is often no direct critical path latency relationship - between producer and consumer spans. A PRODUCER span ends when the message was accepted - by the broker while the logical processing of the message might span a much longer time. - """ - - SPAN_KIND_CONSUMER = Span.SpanKind.V(5) - """Indicates that the span describes consumer receiving a message from a broker. - Like the PRODUCER kind, there is often no direct critical path latency relationship - between producer and consumer spans. - """ - - - class Event(google.protobuf.message.Message): - """Event is a time-stamped annotation of the span, consisting of user-supplied - text description and key-value pairs. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - NAME_FIELD_NUMBER: builtins.int - ATTRIBUTES_FIELD_NUMBER: builtins.int - DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int - time_unix_nano: builtins.int = ... - """time_unix_nano is the time the event occurred.""" - - name: typing.Text = ... - """name of the event. - This field is semantically required to be set to non-empty string. - """ - - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """attributes is a collection of attribute key/value pairs on the event. - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - dropped_attributes_count: builtins.int = ... - """dropped_attributes_count is the number of dropped attributes. If the value is 0, - then no attributes were dropped. - """ - - def __init__(self, - *, - time_unix_nano : builtins.int = ..., - name : typing.Text = ..., - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - dropped_attributes_count : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count","name",b"name","time_unix_nano",b"time_unix_nano"]) -> None: ... - - class Link(google.protobuf.message.Message): - """A pointer from the current span to another span in the same trace or in a - different trace. For example, this can be used in batching operations, - where a single batch handler processes multiple requests from different - traces or when the handler receives a request from a different project. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - TRACE_ID_FIELD_NUMBER: builtins.int - SPAN_ID_FIELD_NUMBER: builtins.int - TRACE_STATE_FIELD_NUMBER: builtins.int - ATTRIBUTES_FIELD_NUMBER: builtins.int - DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int - trace_id: builtins.bytes = ... - """A unique identifier of a trace that this linked span is part of. The ID is a - 16-byte array. - """ - - span_id: builtins.bytes = ... - """A unique identifier for the linked span. The ID is an 8-byte array.""" - - trace_state: typing.Text = ... - """The trace_state associated with the link.""" - - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """attributes is a collection of attribute key/value pairs on the link. - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - dropped_attributes_count: builtins.int = ... - """dropped_attributes_count is the number of dropped attributes. If the value is 0, - then no attributes were dropped. - """ - - def __init__(self, - *, - trace_id : builtins.bytes = ..., - span_id : builtins.bytes = ..., - trace_state : typing.Text = ..., - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - dropped_attributes_count : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count","span_id",b"span_id","trace_id",b"trace_id","trace_state",b"trace_state"]) -> None: ... - - TRACE_ID_FIELD_NUMBER: builtins.int - SPAN_ID_FIELD_NUMBER: builtins.int - TRACE_STATE_FIELD_NUMBER: builtins.int - PARENT_SPAN_ID_FIELD_NUMBER: builtins.int - NAME_FIELD_NUMBER: builtins.int - KIND_FIELD_NUMBER: builtins.int - START_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - END_TIME_UNIX_NANO_FIELD_NUMBER: builtins.int - ATTRIBUTES_FIELD_NUMBER: builtins.int - DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int - EVENTS_FIELD_NUMBER: builtins.int - DROPPED_EVENTS_COUNT_FIELD_NUMBER: builtins.int - LINKS_FIELD_NUMBER: builtins.int - DROPPED_LINKS_COUNT_FIELD_NUMBER: builtins.int - STATUS_FIELD_NUMBER: builtins.int - trace_id: builtins.bytes = ... - """A unique identifier for a trace. All spans from the same trace share - the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes - is considered invalid. - - This field is semantically required. Receiver should generate new - random trace_id if empty or invalid trace_id was received. - - This field is required. - """ - - span_id: builtins.bytes = ... - """A unique identifier for a span within a trace, assigned when the span - is created. The ID is an 8-byte array. An ID with all zeroes is considered - invalid. - - This field is semantically required. Receiver should generate new - random span_id if empty or invalid span_id was received. - - This field is required. - """ - - trace_state: typing.Text = ... - """trace_state conveys information about request position in multiple distributed tracing graphs. - It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header - See also https://github.com/w3c/distributed-tracing for more details about this field. - """ - - parent_span_id: builtins.bytes = ... - """The `span_id` of this span's parent span. If this is a root span, then this - field must be empty. The ID is an 8-byte array. - """ - - name: typing.Text = ... - """A description of the span's operation. - - For example, the name can be a qualified method name or a file name - and a line number where the operation is called. A best practice is to use - the same display name at the same call point in an application. - This makes it easier to correlate spans in different traces. - - This field is semantically required to be set to non-empty string. - Empty value is equivalent to an unknown span name. - - This field is required. - """ - - kind: global___Span.SpanKind.V = ... - """Distinguishes between spans generated in a particular context. For example, - two spans with the same name may be distinguished using `CLIENT` (caller) - and `SERVER` (callee) to identify queueing latency associated with the span. - """ - - start_time_unix_nano: builtins.int = ... - """start_time_unix_nano is the start time of the span. On the client side, this is the time - kept by the local machine where the span execution starts. On the server side, this - is the time when the server's application handler starts running. - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - - This field is semantically required and it is expected that end_time >= start_time. - """ - - end_time_unix_nano: builtins.int = ... - """end_time_unix_nano is the end time of the span. On the client side, this is the time - kept by the local machine where the span execution ends. On the server side, this - is the time when the server application handler stops running. - Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - - This field is semantically required and it is expected that end_time >= start_time. - """ - - @property - def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """attributes is a collection of key/value pairs. Note, global attributes - like server name can be set using the resource API. Examples of attributes: - - "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" - "/http/server_latency": 300 - "abc.com/myattribute": true - "abc.com/score": 10.239 - - The OpenTelemetry API specification further restricts the allowed value types: - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/common.md#attributes - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ - pass - dropped_attributes_count: builtins.int = ... - """dropped_attributes_count is the number of attributes that were discarded. Attributes - can be discarded because their keys are too long or because there are too many - attributes. If this value is 0, then no attributes were dropped. - """ - - @property - def events(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Span.Event]: - """events is a collection of Event items.""" - pass - dropped_events_count: builtins.int = ... - """dropped_events_count is the number of dropped events. If the value is 0, then no - events were dropped. - """ - - @property - def links(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Span.Link]: - """links is a collection of Links, which are references from this span to a span - in the same or different trace. - """ - pass - dropped_links_count: builtins.int = ... - """dropped_links_count is the number of dropped links after the maximum size was - enforced. If this value is 0, then no links were dropped. - """ - - @property - def status(self) -> global___Status: - """An optional final status for this span. Semantically when Status isn't set, it means - span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0). - """ - pass - def __init__(self, - *, - trace_id : builtins.bytes = ..., - span_id : builtins.bytes = ..., - trace_state : typing.Text = ..., - parent_span_id : builtins.bytes = ..., - name : typing.Text = ..., - kind : global___Span.SpanKind.V = ..., - start_time_unix_nano : builtins.int = ..., - end_time_unix_nano : builtins.int = ..., - attributes : typing.Optional[typing.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue]] = ..., - dropped_attributes_count : builtins.int = ..., - events : typing.Optional[typing.Iterable[global___Span.Event]] = ..., - dropped_events_count : builtins.int = ..., - links : typing.Optional[typing.Iterable[global___Span.Link]] = ..., - dropped_links_count : builtins.int = ..., - status : typing.Optional[global___Status] = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["status",b"status"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["attributes",b"attributes","dropped_attributes_count",b"dropped_attributes_count","dropped_events_count",b"dropped_events_count","dropped_links_count",b"dropped_links_count","end_time_unix_nano",b"end_time_unix_nano","events",b"events","kind",b"kind","links",b"links","name",b"name","parent_span_id",b"parent_span_id","span_id",b"span_id","start_time_unix_nano",b"start_time_unix_nano","status",b"status","trace_id",b"trace_id","trace_state",b"trace_state"]) -> None: ... -global___Span = Span - -class Status(google.protobuf.message.Message): - """The Status type defines a logical error model that is suitable for different - programming environments, including REST APIs and RPC APIs. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class StatusCode(_StatusCode, metaclass=_StatusCodeEnumTypeWrapper): - """For the semantics of status codes see - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status - """ - pass - class _StatusCode: - V = typing.NewType('V', builtins.int) - class _StatusCodeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_StatusCode.V], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ... - STATUS_CODE_UNSET = Status.StatusCode.V(0) - """The default status.""" - - STATUS_CODE_OK = Status.StatusCode.V(1) - """The Span has been validated by an Application developers or Operator to have - completed successfully. - """ - - STATUS_CODE_ERROR = Status.StatusCode.V(2) - """The Span contains an error.""" - - - STATUS_CODE_UNSET = Status.StatusCode.V(0) - """The default status.""" - - STATUS_CODE_OK = Status.StatusCode.V(1) - """The Span has been validated by an Application developers or Operator to have - completed successfully. - """ - - STATUS_CODE_ERROR = Status.StatusCode.V(2) - """The Span contains an error.""" - - - MESSAGE_FIELD_NUMBER: builtins.int - CODE_FIELD_NUMBER: builtins.int - message: typing.Text = ... - """A developer-facing human readable error message.""" - - code: global___Status.StatusCode.V = ... - """The status code.""" - - def __init__(self, - *, - message : typing.Text = ..., - code : global___Status.StatusCode.V = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["code",b"code","message",b"message"]) -> None: ... -global___Status = Status diff --git a/opensafely/_vendor/opentelemetry/proto/version.py b/opensafely/_vendor/opentelemetry/proto/version.py deleted file mode 100644 index 797af7e4..00000000 --- a/opensafely/_vendor/opentelemetry/proto/version.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -__version__ = "1.12.0" diff --git a/opensafely/_vendor/opentelemetry/sdk/__init__.pyi b/opensafely/_vendor/opentelemetry/sdk/__init__.pyi deleted file mode 100644 index e57edc0f..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/__init__.pyi +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -""" -The OpenTelemetry SDK package is an implementation of the OpenTelemetry -API -""" diff --git a/opensafely/_vendor/opentelemetry/sdk/_configuration/__init__.py b/opensafely/_vendor/opentelemetry/sdk/_configuration/__init__.py deleted file mode 100644 index 0b867d9f..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/_configuration/__init__.py +++ /dev/null @@ -1,289 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. -# - -""" -OpenTelemetry SDK Configurator for Easy Instrumentation with Distros -""" - -import logging -import os -from abc import ABC, abstractmethod -from os import environ -from typing import Dict, Optional, Sequence, Tuple, Type - -from pkg_resources import iter_entry_points - -from opensafely._vendor.opentelemetry.environment_variables import ( - OTEL_LOGS_EXPORTER, - OTEL_METRICS_EXPORTER, - OTEL_PYTHON_ID_GENERATOR, - OTEL_TRACES_EXPORTER, -) -from opensafely._vendor.opentelemetry.metrics import set_meter_provider -from opensafely._vendor.opentelemetry.sdk._logs import ( - LogEmitterProvider, - LoggingHandler, - set_log_emitter_provider, -) -from opensafely._vendor.opentelemetry.sdk._logs.export import BatchLogProcessor, LogExporter -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - _OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED, -) -from opensafely._vendor.opentelemetry.sdk.metrics import MeterProvider -from opensafely._vendor.opentelemetry.sdk.metrics.export import ( - MetricExporter, - PeriodicExportingMetricReader, -) -from opensafely._vendor.opentelemetry.sdk.resources import Resource -from opensafely._vendor.opentelemetry.sdk.trace import TracerProvider -from opensafely._vendor.opentelemetry.sdk.trace.export import BatchSpanProcessor, SpanExporter -from opensafely._vendor.opentelemetry.sdk.trace.id_generator import IdGenerator -from opensafely._vendor.opentelemetry.semconv.resource import ResourceAttributes -from opensafely._vendor.opentelemetry.trace import set_tracer_provider - -_EXPORTER_OTLP = "otlp" -_EXPORTER_OTLP_PROTO_GRPC = "otlp_proto_grpc" - -_RANDOM_ID_GENERATOR = "random" -_DEFAULT_ID_GENERATOR = _RANDOM_ID_GENERATOR - - -def _get_id_generator() -> str: - return environ.get(OTEL_PYTHON_ID_GENERATOR, _DEFAULT_ID_GENERATOR) - - -def _get_exporter_names(names: str) -> Sequence[str]: - exporters = set() - - if names and names.lower().strip() != "none": - exporters.update({_exporter.strip() for _exporter in names.split(",")}) - - if _EXPORTER_OTLP in exporters: - exporters.remove(_EXPORTER_OTLP) - exporters.add(_EXPORTER_OTLP_PROTO_GRPC) - - return list(exporters) - - -def _init_tracing( - exporters: Dict[str, Type[SpanExporter]], - id_generator: IdGenerator, - auto_instrumentation_version: Optional[str] = None, -): - # if env var OTEL_RESOURCE_ATTRIBUTES is given, it will read the service_name - # from the env variable else defaults to "unknown_service" - auto_resource = {} - # populate version if using auto-instrumentation - if auto_instrumentation_version: - auto_resource[ - ResourceAttributes.TELEMETRY_AUTO_VERSION - ] = auto_instrumentation_version - provider = TracerProvider( - id_generator=id_generator(), - resource=Resource.create(auto_resource), - ) - set_tracer_provider(provider) - - for _, exporter_class in exporters.items(): - exporter_args = {} - provider.add_span_processor( - BatchSpanProcessor(exporter_class(**exporter_args)) - ) - - -def _init_metrics( - exporters: Dict[str, Type[MetricExporter]], - auto_instrumentation_version: Optional[str] = None, -): - # if env var OTEL_RESOURCE_ATTRIBUTES is given, it will read the service_name - # from the env variable else defaults to "unknown_service" - auto_resource = {} - # populate version if using auto-instrumentation - if auto_instrumentation_version: - auto_resource[ - ResourceAttributes.TELEMETRY_AUTO_VERSION - ] = auto_instrumentation_version - - metric_readers = [] - - for _, exporter_class in exporters.items(): - exporter_args = {} - metric_readers.append( - PeriodicExportingMetricReader(exporter_class(**exporter_args)) - ) - - provider = MeterProvider( - resource=Resource.create(auto_resource), metric_readers=metric_readers - ) - set_meter_provider(provider) - - -def _init_logging( - exporters: Dict[str, Type[LogExporter]], - auto_instrumentation_version: Optional[str] = None, -): - # if env var OTEL_RESOURCE_ATTRIBUTES is given, it will read the service_name - # from the env variable else defaults to "unknown_service" - auto_resource = {} - # populate version if using auto-instrumentation - if auto_instrumentation_version: - auto_resource[ - ResourceAttributes.TELEMETRY_AUTO_VERSION - ] = auto_instrumentation_version - provider = LogEmitterProvider(resource=Resource.create(auto_resource)) - set_log_emitter_provider(provider) - - for _, exporter_class in exporters.items(): - exporter_args = {} - provider.add_log_processor( - BatchLogProcessor(exporter_class(**exporter_args)) - ) - - log_emitter = provider.get_log_emitter(__name__) - handler = LoggingHandler(level=logging.NOTSET, log_emitter=log_emitter) - - logging.getLogger().addHandler(handler) - - -def _import_config_components( - selected_components, entry_point_name -) -> Sequence[Tuple[str, object]]: - component_entry_points = { - ep.name: ep for ep in iter_entry_points(entry_point_name) - } - component_impls = [] - for selected_component in selected_components: - entry_point = component_entry_points.get(selected_component, None) - if not entry_point: - raise RuntimeError( - f"Requested component '{selected_component}' not found in entry points for '{entry_point_name}'" - ) - - component_impl = entry_point.load() - component_impls.append((selected_component, component_impl)) - - return component_impls - - -def _import_exporters( - trace_exporter_names: Sequence[str], - metric_exporter_names: Sequence[str], - log_exporter_names: Sequence[str], -) -> Tuple[ - Dict[str, Type[SpanExporter]], - Dict[str, Type[MetricExporter]], - Dict[str, Type[LogExporter]], -]: - trace_exporters = {} - metric_exporters = {} - log_exporters = {} - - for (exporter_name, exporter_impl,) in _import_config_components( - trace_exporter_names, "opentelemetry_traces_exporter" - ): - if issubclass(exporter_impl, SpanExporter): - trace_exporters[exporter_name] = exporter_impl - else: - raise RuntimeError(f"{exporter_name} is not a trace exporter") - - for (exporter_name, exporter_impl,) in _import_config_components( - metric_exporter_names, "opentelemetry_metrics_exporter" - ): - if issubclass(exporter_impl, MetricExporter): - metric_exporters[exporter_name] = exporter_impl - else: - raise RuntimeError(f"{exporter_name} is not a metric exporter") - - for (exporter_name, exporter_impl,) in _import_config_components( - log_exporter_names, "opentelemetry_logs_exporter" - ): - if issubclass(exporter_impl, LogExporter): - log_exporters[exporter_name] = exporter_impl - else: - raise RuntimeError(f"{exporter_name} is not a log exporter") - - return trace_exporters, metric_exporters, log_exporters - - -def _import_id_generator(id_generator_name: str) -> IdGenerator: - # pylint: disable=unbalanced-tuple-unpacking - [(id_generator_name, id_generator_impl)] = _import_config_components( - [id_generator_name.strip()], "opentelemetry_id_generator" - ) - - if issubclass(id_generator_impl, IdGenerator): - return id_generator_impl - - raise RuntimeError(f"{id_generator_name} is not an IdGenerator") - - -def _initialize_components(auto_instrumentation_version): - trace_exporters, metric_exporters, log_exporters = _import_exporters( - _get_exporter_names(environ.get(OTEL_TRACES_EXPORTER)), - _get_exporter_names(environ.get(OTEL_METRICS_EXPORTER)), - _get_exporter_names(environ.get(OTEL_LOGS_EXPORTER)), - ) - id_generator_name = _get_id_generator() - id_generator = _import_id_generator(id_generator_name) - _init_tracing(trace_exporters, id_generator, auto_instrumentation_version) - _init_metrics(metric_exporters, auto_instrumentation_version) - logging_enabled = os.getenv( - _OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED, "false" - ) - if logging_enabled.strip().lower() == "true": - _init_logging(log_exporters, auto_instrumentation_version) - - -class _BaseConfigurator(ABC): - """An ABC for configurators - - Configurators are used to configure - SDKs (i.e. TracerProvider, MeterProvider, Processors...) - to reduce the amount of manual configuration required. - """ - - _instance = None - _is_instrumented = False - - def __new__(cls, *args, **kwargs): - - if cls._instance is None: - cls._instance = object.__new__(cls, *args, **kwargs) - - return cls._instance - - @abstractmethod - def _configure(self, **kwargs): - """Configure the SDK""" - - def configure(self, **kwargs): - """Configure the SDK""" - self._configure(**kwargs) - - -class _OTelSDKConfigurator(_BaseConfigurator): - """A basic Configurator by OTel Python for initalizing OTel SDK components - - Initializes several crucial OTel SDK components (i.e. TracerProvider, - MeterProvider, Processors...) according to a default implementation. Other - Configurators can subclass and slightly alter this initialization. - - NOTE: This class should not be instantiated nor should it become an entry - point on the `opentelemetry-sdk` package. Instead, distros should subclass - this Configurator and enchance it as needed. - """ - - def _configure(self, **kwargs): - _initialize_components(kwargs.get("auto_instrumentation_version")) diff --git a/opensafely/_vendor/opentelemetry/sdk/_logs/__init__.py b/opensafely/_vendor/opentelemetry/sdk/_logs/__init__.py deleted file mode 100644 index da87cbd2..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/_logs/__init__.py +++ /dev/null @@ -1,522 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 abc -import atexit -import concurrent.futures -import json -import logging -import os -import threading -import traceback -from typing import Any, Callable, Optional, Tuple, Union, cast - -from opensafely._vendor.opentelemetry.sdk._logs.severity import SeverityNumber, std_to_otlp -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - _OTEL_PYTHON_LOG_EMITTER_PROVIDER, -) -from opensafely._vendor.opentelemetry.sdk.resources import Resource -from opensafely._vendor.opentelemetry.sdk.util import ns_to_iso_str -from opensafely._vendor.opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opensafely._vendor.opentelemetry.semconv.trace import SpanAttributes -from opensafely._vendor.opentelemetry.trace import ( - format_span_id, - format_trace_id, - get_current_span, -) -from opensafely._vendor.opentelemetry.trace.span import TraceFlags -from opensafely._vendor.opentelemetry.util._providers import _load_provider -from opensafely._vendor.opentelemetry.util._time import _time_ns -from opensafely._vendor.opentelemetry.util.types import Attributes - -_logger = logging.getLogger(__name__) - - -class LogRecord: - """A LogRecord instance represents an event being logged. - - LogRecord instances are created and emitted via `LogEmitter` - every time something is logged. They contain all the information - pertinent to the event being logged. - """ - - def __init__( - self, - timestamp: Optional[int] = None, - trace_id: Optional[int] = None, - span_id: Optional[int] = None, - trace_flags: Optional[TraceFlags] = None, - severity_text: Optional[str] = None, - severity_number: Optional[SeverityNumber] = None, - body: Optional[Any] = None, - resource: Optional[Resource] = None, - attributes: Optional[Attributes] = None, - ): - self.timestamp = timestamp - self.trace_id = trace_id - self.span_id = span_id - self.trace_flags = trace_flags - self.severity_text = severity_text - self.severity_number = severity_number - self.body = body - self.resource = resource - self.attributes = attributes - - def __eq__(self, other: object) -> bool: - if not isinstance(other, LogRecord): - return NotImplemented - return self.__dict__ == other.__dict__ - - def to_json(self) -> str: - return json.dumps( - { - "body": self.body, - "severity_number": repr(self.severity_number), - "severity_text": self.severity_text, - "attributes": self.attributes, - "timestamp": ns_to_iso_str(self.timestamp), - "trace_id": f"0x{format_trace_id(self.trace_id)}" - if self.trace_id is not None - else "", - "span_id": f"0x{format_span_id(self.span_id)}" - if self.span_id is not None - else "", - "trace_flags": self.trace_flags, - "resource": repr(self.resource.attributes) - if self.resource - else "", - }, - indent=4, - ) - - -class LogData: - """Readable LogRecord data plus associated InstrumentationLibrary.""" - - def __init__( - self, - log_record: LogRecord, - instrumentation_scope: InstrumentationScope, - ): - self.log_record = log_record - self.instrumentation_scope = instrumentation_scope - - -class LogProcessor(abc.ABC): - """Interface to hook the log record emitting action. - - Log processors can be registered directly using - :func:`LogEmitterProvider.add_log_processor` and they are invoked - in the same order as they were registered. - """ - - @abc.abstractmethod - def emit(self, log_data: LogData): - """Emits the `LogData`""" - - @abc.abstractmethod - def shutdown(self): - """Called when a :class:`opentelemetry.sdk._logs.LogEmitter` is shutdown""" - - @abc.abstractmethod - def force_flush(self, timeout_millis: int = 30000): - """Export all the received logs to the configured Exporter that have not yet - been exported. - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. - - Returns: - False if the timeout is exceeded, True otherwise. - """ - - -# Temporary fix until https://github.com/PyCQA/pylint/issues/4098 is resolved -# pylint:disable=no-member -class SynchronousMultiLogProcessor(LogProcessor): - """Implementation of class:`LogProcessor` that forwards all received - events to a list of log processors sequentially. - - The underlying log processors are called in sequential order as they were - added. - """ - - def __init__(self): - # use a tuple to avoid race conditions when adding a new log and - # iterating through it on "emit". - self._log_processors = () # type: Tuple[LogProcessor, ...] - self._lock = threading.Lock() - - def add_log_processor(self, log_processor: LogProcessor) -> None: - """Adds a Logprocessor to the list of log processors handled by this instance""" - with self._lock: - self._log_processors += (log_processor,) - - def emit(self, log_data: LogData) -> None: - for lp in self._log_processors: - lp.emit(log_data) - - def shutdown(self) -> None: - """Shutdown the log processors one by one""" - for lp in self._log_processors: - lp.shutdown() - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Force flush the log processors one by one - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. If the first n log processors exceeded the timeout - then remaining log processors will not be flushed. - - Returns: - True if all the log processors flushes the logs within timeout, - False otherwise. - """ - deadline_ns = _time_ns() + timeout_millis * 1000000 - for lp in self._log_processors: - current_ts = _time_ns() - if current_ts >= deadline_ns: - return False - - if not lp.force_flush((deadline_ns - current_ts) // 1000000): - return False - - return True - - -class ConcurrentMultiLogProcessor(LogProcessor): - """Implementation of :class:`LogProcessor` that forwards all received - events to a list of log processors in parallel. - - Calls to the underlying log processors are forwarded in parallel by - submitting them to a thread pool executor and waiting until each log - processor finished its work. - - Args: - max_workers: The number of threads managed by the thread pool executor - and thus defining how many log processors can work in parallel. - """ - - def __init__(self, max_workers: int = 2): - # use a tuple to avoid race conditions when adding a new log and - # iterating through it on "emit". - self._log_processors = () # type: Tuple[LogProcessor, ...] - self._lock = threading.Lock() - self._executor = concurrent.futures.ThreadPoolExecutor( - max_workers=max_workers - ) - - def add_log_processor(self, log_processor: LogProcessor): - with self._lock: - self._log_processors += (log_processor,) - - def _submit_and_wait( - self, - func: Callable[[LogProcessor], Callable[..., None]], - *args: Any, - **kwargs: Any, - ): - futures = [] - for lp in self._log_processors: - future = self._executor.submit(func(lp), *args, **kwargs) - futures.append(future) - for future in futures: - future.result() - - def emit(self, log_data: LogData): - self._submit_and_wait(lambda lp: lp.emit, log_data) - - def shutdown(self): - self._submit_and_wait(lambda lp: lp.shutdown) - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Force flush the log processors in parallel. - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. - - Returns: - True if all the log processors flushes the logs within timeout, - False otherwise. - """ - futures = [] - for lp in self._log_processors: - future = self._executor.submit(lp.force_flush, timeout_millis) - futures.append(future) - - done_futures, not_done_futures = concurrent.futures.wait( - futures, timeout_millis / 1e3 - ) - - if not_done_futures: - return False - - for future in done_futures: - if not future.result(): - return False - - return True - - -# skip natural LogRecord attributes -# http://docs.python.org/library/logging.html#logrecord-attributes -_RESERVED_ATTRS = frozenset( - ( - "asctime", - "args", - "created", - "exc_info", - "exc_text", - "filename", - "funcName", - "getMessage", - "levelname", - "levelno", - "lineno", - "module", - "msecs", - "msg", - "name", - "pathname", - "process", - "processName", - "relativeCreated", - "stack_info", - "thread", - "threadName", - ) -) - - -class LoggingHandler(logging.Handler): - """A handler class which writes logging records, in OTLP format, to - a network destination or file. Supports signals from the `logging` module. - https://docs.python.org/3/library/logging.html - """ - - def __init__( - self, - level=logging.NOTSET, - log_emitter=None, - ) -> None: - super().__init__(level=level) - self._log_emitter = log_emitter or get_log_emitter(__name__) - - @staticmethod - def _get_attributes(record: logging.LogRecord) -> Attributes: - attributes = { - k: v for k, v in vars(record).items() if k not in _RESERVED_ATTRS - } - if record.exc_info: - exc_type = "" - message = "" - stack_trace = "" - exctype, value, tb = record.exc_info - if exctype is not None: - exc_type = exctype.__name__ - if value is not None and value.args: - message = value.args[0] - if tb is not None: - # https://github.com/open-telemetry/opentelemetry-specification/blob/9fa7c656b26647b27e485a6af7e38dc716eba98a/specification/trace/semantic_conventions/exceptions.md#stacktrace-representation - stack_trace = "".join( - traceback.format_exception(*record.exc_info) - ) - attributes[SpanAttributes.EXCEPTION_TYPE] = exc_type - attributes[SpanAttributes.EXCEPTION_MESSAGE] = message - attributes[SpanAttributes.EXCEPTION_STACKTRACE] = stack_trace - return attributes - - def _translate(self, record: logging.LogRecord) -> LogRecord: - timestamp = int(record.created * 1e9) - span_context = get_current_span().get_span_context() - attributes = self._get_attributes(record) - severity_number = std_to_otlp(record.levelno) - return LogRecord( - timestamp=timestamp, - trace_id=span_context.trace_id, - span_id=span_context.span_id, - trace_flags=span_context.trace_flags, - severity_text=record.levelname, - severity_number=severity_number, - body=record.getMessage(), - resource=self._log_emitter.resource, - attributes=attributes, - ) - - def emit(self, record: logging.LogRecord) -> None: - """ - Emit a record. - - The record is translated to OTLP format, and then sent across the pipeline. - """ - self._log_emitter.emit(self._translate(record)) - - def flush(self) -> None: - """ - Flushes the logging output. - """ - self._log_emitter.flush() - - -class LogEmitter: - def __init__( - self, - resource: Resource, - multi_log_processor: Union[ - SynchronousMultiLogProcessor, ConcurrentMultiLogProcessor - ], - instrumentation_scope: InstrumentationScope, - ): - self._resource = resource - self._multi_log_processor = multi_log_processor - self._instrumentation_scope = instrumentation_scope - - @property - def resource(self): - return self._resource - - def emit(self, record: LogRecord): - """Emits the :class:`LogData` by associating :class:`LogRecord` - and instrumentation info. - """ - log_data = LogData(record, self._instrumentation_scope) - self._multi_log_processor.emit(log_data) - - # TODO: Should this flush everything in pipeline? - # Prior discussion https://github.com/open-telemetry/opentelemetry-python/pull/1916#discussion_r659945290 - def flush(self): - """Ensure all logging output has been flushed.""" - self._multi_log_processor.force_flush() - - -class LogEmitterProvider: - def __init__( - self, - resource: Resource = Resource.create(), - shutdown_on_exit: bool = True, - multi_log_processor: Union[ - SynchronousMultiLogProcessor, ConcurrentMultiLogProcessor - ] = None, - ): - self._resource = resource - self._multi_log_processor = ( - multi_log_processor or SynchronousMultiLogProcessor() - ) - self._at_exit_handler = None - if shutdown_on_exit: - self._at_exit_handler = atexit.register(self.shutdown) - - @property - def resource(self): - return self._resource - - def get_log_emitter( - self, - instrumenting_module_name: str, - instrumenting_module_version: str = "", - ) -> LogEmitter: - return LogEmitter( - self._resource, - self._multi_log_processor, - InstrumentationScope( - instrumenting_module_name, instrumenting_module_version - ), - ) - - def add_log_processor(self, log_processor: LogProcessor): - """Registers a new :class:`LogProcessor` for this `LogEmitterProvider` instance. - - The log processors are invoked in the same order they are registered. - """ - self._multi_log_processor.add_log_processor(log_processor) - - def shutdown(self): - """Shuts down the log processors.""" - self._multi_log_processor.shutdown() - if self._at_exit_handler is not None: - atexit.unregister(self._at_exit_handler) - self._at_exit_handler = None - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Force flush the log processors. - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. - - Returns: - True if all the log processors flushes the logs within timeout, - False otherwise. - """ - return self._multi_log_processor.force_flush(timeout_millis) - - -_LOG_EMITTER_PROVIDER = None - - -def get_log_emitter_provider() -> LogEmitterProvider: - """Gets the current global :class:`~.LogEmitterProvider` object.""" - global _LOG_EMITTER_PROVIDER # pylint: disable=global-statement - if _LOG_EMITTER_PROVIDER is None: - if _OTEL_PYTHON_LOG_EMITTER_PROVIDER not in os.environ: - _LOG_EMITTER_PROVIDER = LogEmitterProvider() - return _LOG_EMITTER_PROVIDER - - _LOG_EMITTER_PROVIDER = cast( - "LogEmitterProvider", - _load_provider( - _OTEL_PYTHON_LOG_EMITTER_PROVIDER, "log_emitter_provider" - ), - ) - - return _LOG_EMITTER_PROVIDER - - -def set_log_emitter_provider(log_emitter_provider: LogEmitterProvider) -> None: - """Sets the current global :class:`~.LogEmitterProvider` object. - - This can only be done once, a warning will be logged if any furter attempt - is made. - """ - global _LOG_EMITTER_PROVIDER # pylint: disable=global-statement - - if _LOG_EMITTER_PROVIDER is not None: - _logger.warning( - "Overriding of current LogEmitterProvider is not allowed" - ) - return - - _LOG_EMITTER_PROVIDER = log_emitter_provider - - -def get_log_emitter( - instrumenting_module_name: str, - instrumenting_library_version: str = "", - log_emitter_provider: Optional[LogEmitterProvider] = None, -) -> LogEmitter: - """Returns a `LogEmitter` for use within a python process. - - This function is a convenience wrapper for - opentelemetry.sdk._logs.LogEmitterProvider.get_log_emitter. - - If log_emitter_provider param is omitted the current configured one is used. - """ - if log_emitter_provider is None: - log_emitter_provider = get_log_emitter_provider() - return log_emitter_provider.get_log_emitter( - instrumenting_module_name, instrumenting_library_version - ) diff --git a/opensafely/_vendor/opentelemetry/sdk/_logs/export/__init__.py b/opensafely/_vendor/opentelemetry/sdk/_logs/export/__init__.py deleted file mode 100644 index 8713a2e5..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/_logs/export/__init__.py +++ /dev/null @@ -1,330 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 abc -import collections -import enum -import logging -import os -import sys -import threading -from os import linesep -from typing import IO, Callable, Deque, List, Optional, Sequence - -from opensafely._vendor.opentelemetry.context import attach, detach, set_value -from opensafely._vendor.opentelemetry.sdk._logs import LogData, LogProcessor, LogRecord -from opensafely._vendor.opentelemetry.util._once import Once -from opensafely._vendor.opentelemetry.util._time import _time_ns - -_logger = logging.getLogger(__name__) - - -class LogExportResult(enum.Enum): - SUCCESS = 0 - FAILURE = 1 - - -class LogExporter(abc.ABC): - """Interface for exporting logs. - - Interface to be implemented by services that want to export logs received - in their own format. - - To export data this MUST be registered to the :class`opentelemetry.sdk._logs.LogEmitter` using a - log processor. - """ - - @abc.abstractmethod - def export(self, batch: Sequence[LogData]): - """Exports a batch of logs. - - Args: - batch: The list of `LogData` objects to be exported - - Returns: - The result of the export - """ - - @abc.abstractmethod - def shutdown(self): - """Shuts down the exporter. - - Called when the SDK is shut down. - """ - - -class ConsoleLogExporter(LogExporter): - """Implementation of :class:`LogExporter` that prints log records to the - console. - - This class can be used for diagnostic purposes. It prints the exported - log records to the console STDOUT. - """ - - def __init__( - self, - out: IO = sys.stdout, - formatter: Callable[[LogRecord], str] = lambda record: record.to_json() - + linesep, - ): - self.out = out - self.formatter = formatter - - def export(self, batch: Sequence[LogData]): - for data in batch: - self.out.write(self.formatter(data.log_record)) - self.out.flush() - return LogExportResult.SUCCESS - - def shutdown(self): - pass - - -class SimpleLogProcessor(LogProcessor): - """This is an implementation of LogProcessor which passes - received logs in the export-friendly LogData representation to the - configured LogExporter, as soon as they are emitted. - """ - - def __init__(self, exporter: LogExporter): - self._exporter = exporter - self._shutdown = False - - def emit(self, log_data: LogData): - if self._shutdown: - _logger.warning("Processor is already shutdown, ignoring call") - return - token = attach(set_value("suppress_instrumentation", True)) - try: - self._exporter.export((log_data,)) - except Exception: # pylint: disable=broad-except - _logger.exception("Exception while exporting logs.") - detach(token) - - def shutdown(self): - self._shutdown = True - self._exporter.shutdown() - - def force_flush( - self, timeout_millis: int = 30000 - ) -> bool: # pylint: disable=no-self-use - return True - - -class _FlushRequest: - __slots__ = ["event", "num_log_records"] - - def __init__(self): - self.event = threading.Event() - self.num_log_records = 0 - - -_BSP_RESET_ONCE = Once() - - -class BatchLogProcessor(LogProcessor): - """This is an implementation of LogProcessor which creates batches of - received logs in the export-friendly LogData representation and - send to the configured LogExporter, as soon as they are emitted. - """ - - def __init__( - self, - exporter: LogExporter, - schedule_delay_millis: int = 5000, - max_export_batch_size: int = 512, - export_timeout_millis: int = 30000, - ): - self._exporter = exporter - self._schedule_delay_millis = schedule_delay_millis - self._max_export_batch_size = max_export_batch_size - self._export_timeout_millis = export_timeout_millis - self._queue = collections.deque() # type: Deque[LogData] - self._worker_thread = threading.Thread( - name="OtelBatchLogProcessor", - target=self.worker, - daemon=True, - ) - self._condition = threading.Condition(threading.Lock()) - self._shutdown = False - self._flush_request = None # type: Optional[_FlushRequest] - self._log_records = [ - None - ] * self._max_export_batch_size # type: List[Optional[LogData]] - self._worker_thread.start() - # Only available in *nix since py37. - if hasattr(os, "register_at_fork"): - os.register_at_fork( - after_in_child=self._at_fork_reinit - ) # pylint: disable=protected-access - self._pid = os.getpid() - - def _at_fork_reinit(self): - self._condition = threading.Condition(threading.Lock()) - self._queue.clear() - self._worker_thread = threading.Thread( - name="OtelBatchLogProcessor", - target=self.worker, - daemon=True, - ) - self._worker_thread.start() - self._pid = os.getpid() - - def worker(self): - timeout = self._schedule_delay_millis / 1e3 - flush_request = None # type: Optional[_FlushRequest] - while not self._shutdown: - with self._condition: - if self._shutdown: - # shutdown may have been called, avoid further processing - break - flush_request = self._get_and_unset_flush_request() - if ( - len(self._queue) < self._max_export_batch_size - and flush_request is None - ): - self._condition.wait(timeout) - - flush_request = self._get_and_unset_flush_request() - if not self._queue: - timeout = self._schedule_delay_millis / 1e3 - self._notify_flush_request_finished(flush_request) - flush_request = None - continue - if self._shutdown: - break - - start_ns = _time_ns() - self._export(flush_request) - end_ns = _time_ns() - # subtract the duration of this export call to the next timeout - timeout = self._schedule_delay_millis / 1e3 - ( - (end_ns - start_ns) / 1e9 - ) - - self._notify_flush_request_finished(flush_request) - flush_request = None - - # there might have been a new flush request while export was running - # and before the done flag switched to true - with self._condition: - shutdown_flush_request = self._get_and_unset_flush_request() - - # flush the remaining logs - self._drain_queue() - self._notify_flush_request_finished(flush_request) - self._notify_flush_request_finished(shutdown_flush_request) - - def _export(self, flush_request: Optional[_FlushRequest] = None): - """Exports logs considering the given flush_request. - - If flush_request is not None then logs are exported in batches - until the number of exported logs reached or exceeded the num of logs in - flush_request, otherwise exports at max max_export_batch_size logs. - """ - if flush_request is None: - self._export_batch() - return - - num_log_records = flush_request.num_log_records - while self._queue: - exported = self._export_batch() - num_log_records -= exported - - if num_log_records <= 0: - break - - def _export_batch(self) -> int: - """Exports at most max_export_batch_size logs and returns the number of - exported logs. - """ - idx = 0 - while idx < self._max_export_batch_size and self._queue: - record = self._queue.pop() - self._log_records[idx] = record - idx += 1 - token = attach(set_value("suppress_instrumentation", True)) - try: - self._exporter.export(self._log_records[:idx]) # type: ignore - except Exception: # pylint: disable=broad-except - _logger.exception("Exception while exporting logs.") - detach(token) - - for index in range(idx): - self._log_records[index] = None - return idx - - def _drain_queue(self): - """Export all elements until queue is empty. - - Can only be called from the worker thread context because it invokes - `export` that is not thread safe. - """ - while self._queue: - self._export_batch() - - def _get_and_unset_flush_request(self) -> Optional[_FlushRequest]: - flush_request = self._flush_request - self._flush_request = None - if flush_request is not None: - flush_request.num_log_records = len(self._queue) - return flush_request - - @staticmethod - def _notify_flush_request_finished( - flush_request: Optional[_FlushRequest] = None, - ): - if flush_request is not None: - flush_request.event.set() - - def _get_or_create_flush_request(self) -> _FlushRequest: - if self._flush_request is None: - self._flush_request = _FlushRequest() - return self._flush_request - - def emit(self, log_data: LogData) -> None: - """Adds the `LogData` to queue and notifies the waiting threads - when size of queue reaches max_export_batch_size. - """ - if self._shutdown: - return - if self._pid != os.getpid(): - _BSP_RESET_ONCE.do_once(self._at_fork_reinit) - - self._queue.appendleft(log_data) - if len(self._queue) >= self._max_export_batch_size: - with self._condition: - self._condition.notify() - - def shutdown(self): - self._shutdown = True - with self._condition: - self._condition.notify_all() - self._worker_thread.join() - self._exporter.shutdown() - - def force_flush(self, timeout_millis: Optional[int] = None) -> bool: - if timeout_millis is None: - timeout_millis = self._export_timeout_millis - if self._shutdown: - return True - - with self._condition: - flush_request = self._get_or_create_flush_request() - self._condition.notify_all() - - ret = flush_request.event.wait(timeout_millis / 1e3) - if not ret: - _logger.warning("Timeout was exceeded in force_flush().") - return ret diff --git a/opensafely/_vendor/opentelemetry/sdk/_logs/export/in_memory_log_exporter.py b/opensafely/_vendor/opentelemetry/sdk/_logs/export/in_memory_log_exporter.py deleted file mode 100644 index e6382bfc..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/_logs/export/in_memory_log_exporter.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 threading -import typing - -from opensafely._vendor.opentelemetry.sdk._logs import LogData -from opensafely._vendor.opentelemetry.sdk._logs.export import LogExporter, LogExportResult - - -class InMemoryLogExporter(LogExporter): - """Implementation of :class:`.LogExporter` that stores logs in memory. - - This class can be used for testing purposes. It stores the exported logs - in a list in memory that can be retrieved using the - :func:`.get_finished_logs` method. - """ - - def __init__(self): - self._logs = [] - self._lock = threading.Lock() - self._stopped = False - - def clear(self) -> None: - with self._lock: - self._logs.clear() - - def get_finished_logs(self) -> typing.Tuple[LogData, ...]: - with self._lock: - return tuple(self._logs) - - def export(self, batch: typing.Sequence[LogData]) -> LogExportResult: - if self._stopped: - return LogExportResult.FAILURE - with self._lock: - self._logs.extend(batch) - return LogExportResult.SUCCESS - - def shutdown(self) -> None: - self._stopped = True diff --git a/opensafely/_vendor/opentelemetry/sdk/_logs/severity.py b/opensafely/_vendor/opentelemetry/sdk/_logs/severity.py deleted file mode 100644 index 25703759..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/_logs/severity.py +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 enum - - -class SeverityNumber(enum.Enum): - """Numerical value of severity. - - Smaller numerical values correspond to less severe events - (such as debug events), larger numerical values correspond - to more severe events (such as errors and critical events). - - See the `Log Data Model`_ spec for more info and how to map the - severity from source format to OTLP Model. - - .. _Log Data Model: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-severitynumber - """ - - UNSPECIFIED = 0 - TRACE = 1 - TRACE2 = 2 - TRACE3 = 3 - TRACE4 = 4 - DEBUG = 5 - DEBUG2 = 6 - DEBUG3 = 7 - DEBUG4 = 8 - INFO = 9 - INFO2 = 10 - INFO3 = 11 - INFO4 = 12 - WARN = 13 - WARN2 = 14 - WARN3 = 15 - WARN4 = 16 - ERROR = 17 - ERROR2 = 18 - ERROR3 = 19 - ERROR4 = 20 - FATAL = 21 - FATAL2 = 22 - FATAL3 = 23 - FATAL4 = 24 - - -_STD_TO_OTLP = { - 10: SeverityNumber.DEBUG, - 11: SeverityNumber.DEBUG2, - 12: SeverityNumber.DEBUG3, - 13: SeverityNumber.DEBUG4, - 14: SeverityNumber.DEBUG4, - 15: SeverityNumber.DEBUG4, - 16: SeverityNumber.DEBUG4, - 17: SeverityNumber.DEBUG4, - 18: SeverityNumber.DEBUG4, - 19: SeverityNumber.DEBUG4, - 20: SeverityNumber.INFO, - 21: SeverityNumber.INFO2, - 22: SeverityNumber.INFO3, - 23: SeverityNumber.INFO4, - 24: SeverityNumber.INFO4, - 25: SeverityNumber.INFO4, - 26: SeverityNumber.INFO4, - 27: SeverityNumber.INFO4, - 28: SeverityNumber.INFO4, - 29: SeverityNumber.INFO4, - 30: SeverityNumber.WARN, - 31: SeverityNumber.WARN2, - 32: SeverityNumber.WARN3, - 33: SeverityNumber.WARN4, - 34: SeverityNumber.WARN4, - 35: SeverityNumber.WARN4, - 36: SeverityNumber.WARN4, - 37: SeverityNumber.WARN4, - 38: SeverityNumber.WARN4, - 39: SeverityNumber.WARN4, - 40: SeverityNumber.ERROR, - 41: SeverityNumber.ERROR2, - 42: SeverityNumber.ERROR3, - 43: SeverityNumber.ERROR4, - 44: SeverityNumber.ERROR4, - 45: SeverityNumber.ERROR4, - 46: SeverityNumber.ERROR4, - 47: SeverityNumber.ERROR4, - 48: SeverityNumber.ERROR4, - 49: SeverityNumber.ERROR4, - 50: SeverityNumber.FATAL, - 51: SeverityNumber.FATAL2, - 52: SeverityNumber.FATAL3, - 53: SeverityNumber.FATAL4, -} - - -def std_to_otlp(levelno: int) -> SeverityNumber: - """ - Map python log levelno as defined in https://docs.python.org/3/library/logging.html#logging-levels - to OTLP log severity number. - """ - if levelno < 10: - return SeverityNumber.UNSPECIFIED - if levelno > 53: - return SeverityNumber.FATAL4 - return _STD_TO_OTLP[levelno] diff --git a/opensafely/_vendor/opentelemetry/sdk/environment_variables.py b/opensafely/_vendor/opentelemetry/sdk/environment_variables.py deleted file mode 100644 index eb277779..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/environment_variables.py +++ /dev/null @@ -1,444 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -OTEL_RESOURCE_ATTRIBUTES = "OTEL_RESOURCE_ATTRIBUTES" -""" -.. envvar:: OTEL_RESOURCE_ATTRIBUTES - -The :envvar:`OTEL_RESOURCE_ATTRIBUTES` environment variable allows resource -attributes to be passed to the SDK at process invocation. The attributes from -:envvar:`OTEL_RESOURCE_ATTRIBUTES` are merged with those passed to -`Resource.create`, meaning :envvar:`OTEL_RESOURCE_ATTRIBUTES` takes *lower* -priority. Attributes should be in the format ``key1=value1,key2=value2``. -Additional details are available `in the specification -`__. - -.. code-block:: console - - $ OTEL_RESOURCE_ATTRIBUTES="service.name=shoppingcard,will_be_overridden=foo" python - <`__. -""" - -OTEL_EXPORTER_OTLP_TIMEOUT = "OTEL_EXPORTER_OTLP_TIMEOUT" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TIMEOUT - -The :envvar:`OTEL_EXPORTER_OTLP_TIMEOUT` is the maximum time the OTLP exporter will wait for each batch export. -Default: 10 -""" - -OTEL_EXPORTER_OTLP_ENDPOINT = "OTEL_EXPORTER_OTLP_ENDPOINT" -""" -.. envvar:: OTEL_EXPORTER_OTLP_ENDPOINT - -The :envvar:`OTEL_EXPORTER_OTLP_ENDPOINT` target to which the exporter is going to send spans or metrics. -The endpoint MUST be a valid URL host, and MAY contain a scheme (http or https), port and path. -A scheme of https indicates a secure connection and takes precedence over the insecure configuration setting. -Default: "http://localhost:4317" -""" - -OTEL_EXPORTER_OTLP_INSECURE = "OTEL_EXPORTER_OTLP_INSECURE" -""" -.. envvar:: OTEL_EXPORTER_OTLP_INSECURE - -The :envvar:`OTEL_EXPORTER_OTLP_INSECURE` represents whether to enable client transport security for gRPC requests. -A scheme of https takes precedence over this configuration setting. -Default: False -""" - -OTEL_EXPORTER_OTLP_TRACES_INSECURE = "OTEL_EXPORTER_OTLP_TRACES_INSECURE" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TRACES_INSECURE - -The :envvar:`OTEL_EXPORTER_OTLP_TRACES_INSECURE` represents whether to enable client transport security -for gRPC requests for spans. A scheme of https takes precedence over the this configuration setting. -Default: False -""" - - -OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - -The :envvar:`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` target to which the span exporter is going to send spans. -The endpoint MUST be a valid URL host, and MAY contain a scheme (http or https), port and path. -A scheme of https indicates a secure connection and takes precedence over this configuration setting. -""" - -OTEL_EXPORTER_OTLP_TRACES_PROTOCOL = "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL - -The :envvar:`OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` represents the the transport protocol for spans. -""" - -OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE = "OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE - -The :envvar:`OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` stores the path to the certificate file for -TLS credentials of gRPC client for traces. Should only be used for a secure connection for tracing. -""" - -OTEL_EXPORTER_OTLP_TRACES_HEADERS = "OTEL_EXPORTER_OTLP_TRACES_HEADERS" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TRACES_HEADERS - -The :envvar:`OTEL_EXPORTER_OTLP_TRACES_HEADERS` contains the key-value pairs to be used as headers for spans -associated with gRPC or HTTP requests. -""" - - -OTEL_EXPORTER_OTLP_TRACES_COMPRESSION = "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TRACES_COMPRESSION - -Same as :envvar:`OTEL_EXPORTER_OTLP_COMPRESSION` but only for the span -exporter. If both are present, this takes higher precendence. -""" - -OTEL_EXPORTER_OTLP_TRACES_TIMEOUT = "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT" -""" -.. envvar:: OTEL_EXPORTER_OTLP_TRACES_TIMEOUT - -The :envvar:`OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` is the maximum time the OTLP exporter will -wait for each batch export for spans. -""" - -OTEL_EXPORTER_OTLP_METRICS_INSECURE = "OTEL_EXPORTER_OTLP_METRICS_INSECURE" -""" -.. envvar:: OTEL_EXPORTER_OTLP_METRICS_INSECURE - -The :envvar:`OTEL_EXPORTER_OTLP_METRICS_INSECURE` represents whether to enable client transport security -for gRPC requests for metrics. A scheme of https takes precedence over the this configuration setting. -Default: False -""" - -OTEL_EXPORTER_JAEGER_CERTIFICATE = "OTEL_EXPORTER_JAEGER_CERTIFICATE" -""" -.. envvar:: OTEL_EXPORTER_JAEGER_CERTIFICATE - -The :envvar:`OTEL_EXPORTER_JAEGER_CERTIFICATE` stores the path to the certificate file for -TLS credentials of gRPC client for Jaeger. Should only be used for a secure connection with Jaeger. -""" - -OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES = ( - "OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES" -) -""" -.. envvar:: OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES - -The :envvar:`OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES` is a boolean flag to determine whether -to split a large span batch to admire the udp packet size limit. -""" - -OTEL_SERVICE_NAME = "OTEL_SERVICE_NAME" -""" -.. envvar:: OTEL_SERVICE_NAME - -Convenience environment variable for setting the service name resource attribute. -The following two environment variables have the same effect - -.. code-block:: console - - OTEL_SERVICE_NAME=my-python-service - - OTEL_RESOURCE_ATTRIBUTES=service.name=my-python-service - - -If both are set, :envvar:`OTEL_SERVICE_NAME` takes precedence. -""" - -_OTEL_PYTHON_LOG_EMITTER_PROVIDER = "OTEL_PYTHON_LOG_EMITTER_PROVIDER" -""" -.. envvar:: OTEL_PYTHON_LOG_EMITTER_PROVIDER - -The :envvar:`OTEL_PYTHON_LOG_EMITTER_PROVIDER` environment variable allows users to -provide the entry point for loading the log emitter provider. If not specified, SDK -LogEmitterProvider is used. -""" - -_OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED = ( - "OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED" -) -""" -.. envvar:: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED - -The :envvar:`OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED` environment variable allows users to -enable/disabe the logging SDK auto instrumentation. -Default: False - -Note: Logs SDK and its related settings are experimental. -""" - - -OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = ( - "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE" -) -""" -.. envvar:: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - -The :envvar:`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment -variable allows users to set the default aggregation temporality policy to use -on the basis of instrument kind. The valid (case-insensitive) values are: - -``CUMULATIVE``: Choose ``CUMULATIVE`` aggregation temporality for all instrument kinds. -``DELTA``: Choose ``DELTA`` aggregation temporality for ``Counter``, ``Asynchronous Counter`` and ``Histogram``. -Choose ``CUMULATIVE`` aggregation temporality for ``UpDownCounter`` and ``Asynchronous UpDownCounter``. -""" - -OTEL_EXPORTER_JAEGER_GRPC_INSECURE = "OTEL_EXPORTER_JAEGER_GRPC_INSECURE" -""" -.. envvar:: OTEL_EXPORTER_JAEGER_GRPC_INSECURE - -The :envvar:`OTEL_EXPORTER_JAEGER_GRPC_INSECURE` is a boolean flag to True if collector has no encryption or authentication. -""" diff --git a/opensafely/_vendor/opentelemetry/sdk/error_handler/__init__.py b/opensafely/_vendor/opentelemetry/sdk/error_handler/__init__.py deleted file mode 100644 index 44f06d01..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/error_handler/__init__.py +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -""" -Global Error Handler - -This module provides a global error handler and an interface that allows -error handlers to be registered with the global error handler via entry points. -A default error handler is also provided. - -To use this feature, users can create an error handler that is registered -using the ``opentelemetry_error_handler`` entry point. A class is to be -registered in this entry point, this class must inherit from the -``opentelemetry.sdk.error_handler.ErrorHandler`` class and implement the -corresponding ``handle`` method. This method will receive the exception object -that is to be handled. The error handler class should also inherit from the -exception classes it wants to handle. For example, this would be an error -handler that handles ``ZeroDivisionError``: - -.. code:: python - - from opensafely._vendor.opentelemetry.sdk.error_handler import ErrorHandler - from logging import getLogger - - logger = getLogger(__name__) - - - class ErrorHandler0(ErrorHandler, ZeroDivisionError): - - def _handle(self, error: Exception, *args, **kwargs): - - logger.exception("ErrorHandler0 handling a ZeroDivisionError") - -To use the global error handler, just instantiate it as a context manager where -you want exceptions to be handled: - - -.. code:: python - - from opensafely._vendor.opentelemetry.sdk.error_handler import GlobalErrorHandler - - with GlobalErrorHandler(): - 1 / 0 - -If the class of the exception raised in the scope of the ``GlobalErrorHandler`` -object is not parent of any registered error handler, then the default error -handler will handle the exception. This default error handler will only log the -exception to standard logging, the exception won't be raised any further. -""" - -from abc import ABC, abstractmethod -from logging import getLogger - -from pkg_resources import iter_entry_points - -logger = getLogger(__name__) - - -class ErrorHandler(ABC): - @abstractmethod - def _handle(self, error: Exception, *args, **kwargs): - """ - Handle an exception - """ - - -class _DefaultErrorHandler(ErrorHandler): - """ - Default error handler - - This error handler just logs the exception using standard logging. - """ - - # pylint: disable=useless-return - def _handle(self, error: Exception, *args, **kwargs): - - logger.exception("Error handled by default error handler: ") - return None - - -class GlobalErrorHandler: - """ - Global error handler - - This is a singleton class that can be instantiated anywhere to get the - global error handler. This object provides a handle method that receives - an exception object that will be handled by the registered error handlers. - """ - - _instance = None - - def __new__(cls) -> "GlobalErrorHandler": - if cls._instance is None: - cls._instance = super().__new__(cls) - - return cls._instance - - def __enter__(self): - pass - - # pylint: disable=no-self-use - def __exit__(self, exc_type, exc_value, traceback): - - if exc_value is None: - - return None - - plugin_handled = False - - for error_handler_entry_point in iter_entry_points( - "opentelemetry_error_handler" - ): - - error_handler_class = error_handler_entry_point.load() - - if issubclass(error_handler_class, exc_value.__class__): - - try: - - error_handler_class()._handle(exc_value) - plugin_handled = True - - # pylint: disable=broad-except - except Exception as error_handling_error: - - logger.exception( - "%s error while handling error" - " %s by error handler %s", - error_handling_error.__class__.__name__, - exc_value.__class__.__name__, - error_handler_class.__name__, - ) - - if not plugin_handled: - - _DefaultErrorHandler()._handle(exc_value) - - return True diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/__init__.py b/opensafely/_vendor/opentelemetry/sdk/metrics/__init__.py deleted file mode 100644 index 8cd24935..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/__init__.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=unused-import - -from opensafely._vendor.opentelemetry.sdk.metrics._internal import ( # noqa: F401 - Meter, - MeterProvider, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.exceptions import ( # noqa: F401 - MetricsTimeoutError, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.instrument import ( # noqa: F401 - Counter, - Histogram, - ObservableCounter, - ObservableGauge, - ObservableUpDownCounter, - UpDownCounter, -) - -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - value.__module__ = __name__ - __all__.append(key) diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/__init__.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/__init__.py deleted file mode 100644 index 4446c1ec..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/__init__.py +++ /dev/null @@ -1,493 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 atexit import register, unregister -from logging import getLogger -from threading import Lock -from typing import Optional, Sequence - -# This kind of import is needed to avoid Sphinx errors. -import opensafely._vendor.opentelemetry.sdk.metrics -from opensafely._vendor.opentelemetry.metrics import Counter as APICounter -from opensafely._vendor.opentelemetry.metrics import Histogram as APIHistogram -from opensafely._vendor.opentelemetry.metrics import Meter as APIMeter -from opensafely._vendor.opentelemetry.metrics import MeterProvider as APIMeterProvider -from opensafely._vendor.opentelemetry.metrics import NoOpMeter -from opensafely._vendor.opentelemetry.metrics import ObservableCounter as APIObservableCounter -from opensafely._vendor.opentelemetry.metrics import ObservableGauge as APIObservableGauge -from opensafely._vendor.opentelemetry.metrics import ( - ObservableUpDownCounter as APIObservableUpDownCounter, -) -from opensafely._vendor.opentelemetry.metrics import UpDownCounter as APIUpDownCounter -from opensafely._vendor.opentelemetry.sdk.metrics._internal.exceptions import MetricsTimeoutError -from opensafely._vendor.opentelemetry.sdk.metrics._internal.instrument import ( - _Counter, - _Histogram, - _ObservableCounter, - _ObservableGauge, - _ObservableUpDownCounter, - _UpDownCounter, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.measurement_consumer import ( - MeasurementConsumer, - SynchronousMeasurementConsumer, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.sdk_configuration import ( - SdkConfiguration, -) -from opensafely._vendor.opentelemetry.sdk.resources import Resource -from opensafely._vendor.opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opensafely._vendor.opentelemetry.util._once import Once -from opensafely._vendor.opentelemetry.util._time import _time_ns - -_logger = getLogger(__name__) - - -class Meter(APIMeter): - """See `opentelemetry.metrics.Meter`.""" - - def __init__( - self, - instrumentation_scope: InstrumentationScope, - measurement_consumer: MeasurementConsumer, - ): - super().__init__(instrumentation_scope) - self._instrumentation_scope = instrumentation_scope - self._measurement_consumer = measurement_consumer - self._instrument_id_instrument = {} - self._instrument_id_instrument_lock = Lock() - - def create_counter(self, name, unit="", description="") -> APICounter: - - ( - is_instrument_registered, - instrument_id, - ) = self._is_instrument_registered(name, _Counter, unit, description) - - if is_instrument_registered: - # FIXME #2558 go through all views here and check if this - # instrument registration conflict can be fixed. If it can be, do - # not log the following warning. - _logger.warning( - "An instrument with name %s, type %s, unit %s and " - "description %s has been created already.", - name, - APICounter.__name__, - unit, - description, - ) - with self._instrument_id_instrument_lock: - return self._instrument_id_instrument[instrument_id] - - instrument = _Counter( - name, - self._instrumentation_scope, - self._measurement_consumer, - unit, - description, - ) - - with self._instrument_id_instrument_lock: - self._instrument_id_instrument[instrument_id] = instrument - return instrument - - def create_up_down_counter( - self, name, unit="", description="" - ) -> APIUpDownCounter: - - ( - is_instrument_registered, - instrument_id, - ) = self._is_instrument_registered( - name, _UpDownCounter, unit, description - ) - - if is_instrument_registered: - # FIXME #2558 go through all views here and check if this - # instrument registration conflict can be fixed. If it can be, do - # not log the following warning. - _logger.warning( - "An instrument with name %s, type %s, unit %s and " - "description %s has been created already.", - name, - APIUpDownCounter.__name__, - unit, - description, - ) - with self._instrument_id_instrument_lock: - return self._instrument_id_instrument[instrument_id] - - instrument = _UpDownCounter( - name, - self._instrumentation_scope, - self._measurement_consumer, - unit, - description, - ) - - with self._instrument_id_instrument_lock: - self._instrument_id_instrument[instrument_id] = instrument - return instrument - - def create_observable_counter( - self, name, callbacks=None, unit="", description="" - ) -> APIObservableCounter: - - ( - is_instrument_registered, - instrument_id, - ) = self._is_instrument_registered( - name, _ObservableCounter, unit, description - ) - - if is_instrument_registered: - # FIXME #2558 go through all views here and check if this - # instrument registration conflict can be fixed. If it can be, do - # not log the following warning. - _logger.warning( - "An instrument with name %s, type %s, unit %s and " - "description %s has been created already.", - name, - APIObservableCounter.__name__, - unit, - description, - ) - with self._instrument_id_instrument_lock: - return self._instrument_id_instrument[instrument_id] - - instrument = _ObservableCounter( - name, - self._instrumentation_scope, - self._measurement_consumer, - callbacks, - unit, - description, - ) - - self._measurement_consumer.register_asynchronous_instrument(instrument) - - with self._instrument_id_instrument_lock: - self._instrument_id_instrument[instrument_id] = instrument - return instrument - - def create_histogram(self, name, unit="", description="") -> APIHistogram: - - ( - is_instrument_registered, - instrument_id, - ) = self._is_instrument_registered(name, _Histogram, unit, description) - - if is_instrument_registered: - # FIXME #2558 go through all views here and check if this - # instrument registration conflict can be fixed. If it can be, do - # not log the following warning. - _logger.warning( - "An instrument with name %s, type %s, unit %s and " - "description %s has been created already.", - name, - APIHistogram.__name__, - unit, - description, - ) - with self._instrument_id_instrument_lock: - return self._instrument_id_instrument[instrument_id] - - instrument = _Histogram( - name, - self._instrumentation_scope, - self._measurement_consumer, - unit, - description, - ) - with self._instrument_id_instrument_lock: - self._instrument_id_instrument[instrument_id] = instrument - return instrument - - def create_observable_gauge( - self, name, callbacks=None, unit="", description="" - ) -> APIObservableGauge: - - ( - is_instrument_registered, - instrument_id, - ) = self._is_instrument_registered( - name, _ObservableGauge, unit, description - ) - - if is_instrument_registered: - # FIXME #2558 go through all views here and check if this - # instrument registration conflict can be fixed. If it can be, do - # not log the following warning. - _logger.warning( - "An instrument with name %s, type %s, unit %s and " - "description %s has been created already.", - name, - APIObservableGauge.__name__, - unit, - description, - ) - with self._instrument_id_instrument_lock: - return self._instrument_id_instrument[instrument_id] - - instrument = _ObservableGauge( - name, - self._instrumentation_scope, - self._measurement_consumer, - callbacks, - unit, - description, - ) - - self._measurement_consumer.register_asynchronous_instrument(instrument) - - with self._instrument_id_instrument_lock: - self._instrument_id_instrument[instrument_id] = instrument - return instrument - - def create_observable_up_down_counter( - self, name, callbacks=None, unit="", description="" - ) -> APIObservableUpDownCounter: - - ( - is_instrument_registered, - instrument_id, - ) = self._is_instrument_registered( - name, _ObservableUpDownCounter, unit, description - ) - - if is_instrument_registered: - # FIXME #2558 go through all views here and check if this - # instrument registration conflict can be fixed. If it can be, do - # not log the following warning. - _logger.warning( - "An instrument with name %s, type %s, unit %s and " - "description %s has been created already.", - name, - APIObservableUpDownCounter.__name__, - unit, - description, - ) - with self._instrument_id_instrument_lock: - return self._instrument_id_instrument[instrument_id] - - instrument = _ObservableUpDownCounter( - name, - self._instrumentation_scope, - self._measurement_consumer, - callbacks, - unit, - description, - ) - - self._measurement_consumer.register_asynchronous_instrument(instrument) - - with self._instrument_id_instrument_lock: - self._instrument_id_instrument[instrument_id] = instrument - return instrument - - -class MeterProvider(APIMeterProvider): - r"""See `opentelemetry.metrics.MeterProvider`. - - Args: - metric_readers: Register metric readers to collect metrics from the SDK - on demand. Each :class:`opensafely._vendor.opentelemetry.sdk.metrics.export.MetricReader` is - completely independent and will collect separate streams of - metrics. TODO: reference ``PeriodicExportingMetricReader`` usage with push - exporters here. - resource: The resource representing what the metrics emitted from the SDK pertain to. - shutdown_on_exit: If true, registers an `atexit` handler to call - `MeterProvider.shutdown` - views: The views to configure the metric output the SDK - - By default, instruments which do not match any :class:`opensafely._vendor.opentelemetry.sdk.metrics.view.View` (or if no :class:`opensafely._vendor.opentelemetry.sdk.metrics.view.View`\ s - are provided) will report metrics with the default aggregation for the - instrument's kind. To disable instruments by default, configure a match-all - :class:`opensafely._vendor.opentelemetry.sdk.metrics.view.View` with `DropAggregation` and then create :class:`opensafely._vendor.opentelemetry.sdk.metrics.view.View`\ s to re-enable - individual instruments: - - .. code-block:: python - :caption: Disable default views - - MeterProvider( - views=[ - View(instrument_name="*", aggregation=DropAggregation()), - View(instrument_name="mycounter"), - ], - # ... - ) - """ - - _all_metric_readers_lock = Lock() - _all_metric_readers = set() - - def __init__( - self, - metric_readers: Sequence[ - "opensafely._vendor.opentelemetry.sdk.metrics.export.MetricReader" - ] = (), - resource: Resource = Resource.create({}), - shutdown_on_exit: bool = True, - views: Sequence["opensafely._vendor.opentelemetry.sdk.metrics.view.View"] = (), - ): - self._lock = Lock() - self._meter_lock = Lock() - self._atexit_handler = None - self._sdk_config = SdkConfiguration( - resource=resource, - metric_readers=metric_readers, - views=views, - ) - self._measurement_consumer = SynchronousMeasurementConsumer( - sdk_config=self._sdk_config - ) - - if shutdown_on_exit: - self._atexit_handler = register(self.shutdown) - - self._meters = {} - - for metric_reader in self._sdk_config.metric_readers: - - with self._all_metric_readers_lock: - if metric_reader in self._all_metric_readers: - raise Exception( - f"MetricReader {metric_reader} has been registered " - "already in other MeterProvider instance" - ) - - self._all_metric_readers.add(metric_reader) - - metric_reader._set_collect_callback( - self._measurement_consumer.collect - ) - - self._shutdown_once = Once() - self._shutdown = False - - def force_flush(self, timeout_millis: float = 10_000) -> bool: - deadline_ns = _time_ns() + timeout_millis * 10**6 - - metric_reader_error = {} - - for metric_reader in self._sdk_config.metric_readers: - current_ts = _time_ns() - try: - if current_ts >= deadline_ns: - raise MetricsTimeoutError( - "Timed out while flushing metric readers" - ) - metric_reader.force_flush( - timeout_millis=(deadline_ns - current_ts) / 10**6 - ) - - # pylint: disable=broad-except - except Exception as error: - - metric_reader_error[metric_reader] = error - - if metric_reader_error: - - metric_reader_error_string = "\n".join( - [ - f"{metric_reader.__class__.__name__}: {repr(error)}" - for metric_reader, error in metric_reader_error.items() - ] - ) - - raise Exception( - "MeterProvider.force_flush failed because the following " - "metric readers failed during collect:\n" - f"{metric_reader_error_string}" - ) - return True - - def shutdown(self, timeout_millis: float = 30_000): - deadline_ns = _time_ns() + timeout_millis * 10**6 - - def _shutdown(): - self._shutdown = True - - did_shutdown = self._shutdown_once.do_once(_shutdown) - - if not did_shutdown: - _logger.warning("shutdown can only be called once") - return - - metric_reader_error = {} - - for metric_reader in self._sdk_config.metric_readers: - current_ts = _time_ns() - try: - if current_ts >= deadline_ns: - raise Exception( - "Didn't get to execute, deadline already exceeded" - ) - metric_reader.shutdown( - timeout_millis=(deadline_ns - current_ts) / 10**6 - ) - - # pylint: disable=broad-except - except Exception as error: - - metric_reader_error[metric_reader] = error - - if self._atexit_handler is not None: - unregister(self._atexit_handler) - self._atexit_handler = None - - if metric_reader_error: - - metric_reader_error_string = "\n".join( - [ - f"{metric_reader.__class__.__name__}: {repr(error)}" - for metric_reader, error in metric_reader_error.items() - ] - ) - - raise Exception( - ( - "MeterProvider.shutdown failed because the following " - "metric readers failed during shutdown:\n" - f"{metric_reader_error_string}" - ) - ) - - def get_meter( - self, - name: str, - version: Optional[str] = None, - schema_url: Optional[str] = None, - ) -> Meter: - - if self._shutdown: - _logger.warning( - "A shutdown `MeterProvider` can not provide a `Meter`" - ) - return NoOpMeter(name, version=version, schema_url=schema_url) - - if not name: - _logger.warning("Meter name cannot be None or empty.") - return NoOpMeter(name, version=version, schema_url=schema_url) - - info = InstrumentationScope(name, version, schema_url) - with self._meter_lock: - if not self._meters.get(info): - # FIXME #2558 pass SDKConfig object to meter so that the meter - # has access to views. - self._meters[info] = Meter( - info, - self._measurement_consumer, - ) - return self._meters[info] diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/_view_instrument_match.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/_view_instrument_match.py deleted file mode 100644 index 59243ba8..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/_view_instrument_match.py +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 logging import getLogger -from threading import Lock -from typing import Dict, Iterable - -from opensafely._vendor.opentelemetry.metrics import Instrument -from opensafely._vendor.opentelemetry.sdk.metrics._internal.aggregation import ( - Aggregation, - DefaultAggregation, - _Aggregation, - _SumAggregation, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.export import AggregationTemporality -from opensafely._vendor.opentelemetry.sdk.metrics._internal.measurement import Measurement -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import DataPointT -from opensafely._vendor.opentelemetry.sdk.metrics._internal.view import View -from opensafely._vendor.opentelemetry.util._time import _time_ns - -_logger = getLogger(__name__) - - -class _ViewInstrumentMatch: - def __init__( - self, - view: View, - instrument: Instrument, - instrument_class_aggregation: Dict[type, Aggregation], - ): - self._start_time_unix_nano = _time_ns() - self._view = view - self._instrument = instrument - self._attributes_aggregation: Dict[frozenset, _Aggregation] = {} - self._lock = Lock() - self._instrument_class_aggregation = instrument_class_aggregation - self._name = self._view._name or self._instrument.name - self._description = ( - self._view._description or self._instrument.description - ) - if not isinstance(self._view._aggregation, DefaultAggregation): - self._aggregation = self._view._aggregation._create_aggregation( - self._instrument, None, 0 - ) - else: - self._aggregation = self._instrument_class_aggregation[ - self._instrument.__class__ - ]._create_aggregation(self._instrument, None, 0) - - def conflicts(self, other: "_ViewInstrumentMatch") -> bool: - # pylint: disable=protected-access - - result = ( - self._name == other._name - and self._instrument.unit == other._instrument.unit - # The aggregation class is being used here instead of data point - # type since they are functionally equivalent. - and self._aggregation.__class__ == other._aggregation.__class__ - ) - if isinstance(self._aggregation, _SumAggregation): - result = ( - result - and self._aggregation._instrument_is_monotonic - == other._aggregation._instrument_is_monotonic - and self._aggregation._instrument_temporality - == other._aggregation._instrument_temporality - ) - - return result - - # pylint: disable=protected-access - def consume_measurement(self, measurement: Measurement) -> None: - - if self._view._attribute_keys is not None: - - attributes = {} - - for key, value in (measurement.attributes or {}).items(): - if key in self._view._attribute_keys: - attributes[key] = value - elif measurement.attributes is not None: - attributes = measurement.attributes - else: - attributes = {} - - aggr_key = frozenset(attributes.items()) - - if aggr_key not in self._attributes_aggregation: - with self._lock: - if aggr_key not in self._attributes_aggregation: - if not isinstance( - self._view._aggregation, DefaultAggregation - ): - aggregation = ( - self._view._aggregation._create_aggregation( - self._instrument, - attributes, - self._start_time_unix_nano, - ) - ) - else: - aggregation = self._instrument_class_aggregation[ - self._instrument.__class__ - ]._create_aggregation( - self._instrument, - attributes, - self._start_time_unix_nano, - ) - self._attributes_aggregation[aggr_key] = aggregation - - self._attributes_aggregation[aggr_key].aggregate(measurement) - - def collect( - self, - aggregation_temporality: AggregationTemporality, - collection_start_nanos: int, - ) -> Iterable[DataPointT]: - - with self._lock: - for aggregation in self._attributes_aggregation.values(): - data_point = aggregation.collect( - aggregation_temporality, collection_start_nanos - ) - if data_point is not None: - yield data_point diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/aggregation.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/aggregation.py deleted file mode 100644 index 357d4824..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/aggregation.py +++ /dev/null @@ -1,531 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 abc import ABC, abstractmethod -from bisect import bisect_left -from enum import IntEnum -from logging import getLogger -from math import inf -from threading import Lock -from typing import Generic, List, Optional, Sequence, TypeVar - -from opensafely._vendor.opentelemetry.metrics import ( - Asynchronous, - Counter, - Histogram, - Instrument, - ObservableCounter, - ObservableGauge, - ObservableUpDownCounter, - Synchronous, - UpDownCounter, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.measurement import Measurement -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import Gauge -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import ( - Histogram as HistogramPoint, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import ( - HistogramDataPoint, - NumberDataPoint, - Sum, -) -from opensafely._vendor.opentelemetry.util.types import Attributes - -_DataPointVarT = TypeVar("_DataPointVarT", NumberDataPoint, HistogramDataPoint) - -_logger = getLogger(__name__) - - -class AggregationTemporality(IntEnum): - """ - The temporality to use when aggregating data. - - Can be one of the following values: - """ - - UNSPECIFIED = 0 - DELTA = 1 - CUMULATIVE = 2 - - -class _Aggregation(ABC, Generic[_DataPointVarT]): - def __init__(self, attributes: Attributes): - self._lock = Lock() - self._attributes = attributes - self._previous_point = None - - @abstractmethod - def aggregate(self, measurement: Measurement) -> None: - pass - - @abstractmethod - def collect( - self, - aggregation_temporality: AggregationTemporality, - collection_start_nano: int, - ) -> Optional[_DataPointVarT]: - pass - - -class _DropAggregation(_Aggregation): - def aggregate(self, measurement: Measurement) -> None: - pass - - def collect( - self, - aggregation_temporality: AggregationTemporality, - collection_start_nano: int, - ) -> Optional[_DataPointVarT]: - pass - - -class _SumAggregation(_Aggregation[Sum]): - def __init__( - self, - attributes: Attributes, - instrument_is_monotonic: bool, - instrument_temporality: AggregationTemporality, - start_time_unix_nano: int, - ): - super().__init__(attributes) - - self._start_time_unix_nano = start_time_unix_nano - self._instrument_temporality = instrument_temporality - self._instrument_is_monotonic = instrument_is_monotonic - - if self._instrument_temporality is AggregationTemporality.DELTA: - self._value = 0 - else: - self._value = None - - def aggregate(self, measurement: Measurement) -> None: - with self._lock: - if self._value is None: - self._value = 0 - self._value = self._value + measurement.value - - def collect( - self, - aggregation_temporality: AggregationTemporality, - collection_start_nano: int, - ) -> Optional[NumberDataPoint]: - """ - Atomically return a point for the current value of the metric and - reset the aggregation value. - """ - if self._instrument_temporality is AggregationTemporality.DELTA: - - with self._lock: - value = self._value - start_time_unix_nano = self._start_time_unix_nano - - self._value = 0 - self._start_time_unix_nano = collection_start_nano - - else: - - with self._lock: - if self._value is None: - return None - value = self._value - self._value = None - start_time_unix_nano = self._start_time_unix_nano - - current_point = NumberDataPoint( - attributes=self._attributes, - start_time_unix_nano=start_time_unix_nano, - time_unix_nano=collection_start_nano, - value=value, - ) - - if self._previous_point is None or ( - self._instrument_temporality is aggregation_temporality - ): - # Output DELTA for a synchronous instrument - # Output CUMULATIVE for an asynchronous instrument - self._previous_point = current_point - return current_point - - if aggregation_temporality is AggregationTemporality.DELTA: - # Output temporality DELTA for an asynchronous instrument - value = current_point.value - self._previous_point.value - output_start_time_unix_nano = self._previous_point.time_unix_nano - - else: - # Output CUMULATIVE for a synchronous instrument - value = current_point.value + self._previous_point.value - output_start_time_unix_nano = ( - self._previous_point.start_time_unix_nano - ) - - current_point = NumberDataPoint( - attributes=self._attributes, - start_time_unix_nano=output_start_time_unix_nano, - time_unix_nano=current_point.time_unix_nano, - value=value, - ) - - self._previous_point = current_point - return current_point - - -class _LastValueAggregation(_Aggregation[Gauge]): - def __init__(self, attributes: Attributes): - super().__init__(attributes) - self._value = None - - def aggregate(self, measurement: Measurement): - with self._lock: - self._value = measurement.value - - def collect( - self, - aggregation_temporality: AggregationTemporality, - collection_start_nano: int, - ) -> Optional[_DataPointVarT]: - """ - Atomically return a point for the current value of the metric. - """ - with self._lock: - if self._value is None: - return None - value = self._value - self._value = None - - return NumberDataPoint( - attributes=self._attributes, - start_time_unix_nano=0, - time_unix_nano=collection_start_nano, - value=value, - ) - - -class _ExplicitBucketHistogramAggregation(_Aggregation[HistogramPoint]): - def __init__( - self, - attributes: Attributes, - start_time_unix_nano: int, - boundaries: Sequence[float] = ( - 0.0, - 5.0, - 10.0, - 25.0, - 50.0, - 75.0, - 100.0, - 250.0, - 500.0, - 1000.0, - ), - record_min_max: bool = True, - ): - super().__init__(attributes) - self._boundaries = tuple(boundaries) - self._bucket_counts = self._get_empty_bucket_counts() - self._min = inf - self._max = -inf - self._sum = 0 - self._record_min_max = record_min_max - self._start_time_unix_nano = start_time_unix_nano - # It is assumed that the "natural" aggregation temporality for a - # Histogram instrument is DELTA, like the "natural" aggregation - # temporality for a Counter is DELTA and the "natural" aggregation - # temporality for an ObservableCounter is CUMULATIVE. - self._instrument_temporality = AggregationTemporality.DELTA - - def _get_empty_bucket_counts(self) -> List[int]: - return [0] * (len(self._boundaries) + 1) - - def aggregate(self, measurement: Measurement) -> None: - - value = measurement.value - - if self._record_min_max: - self._min = min(self._min, value) - self._max = max(self._max, value) - - self._sum += value - - self._bucket_counts[bisect_left(self._boundaries, value)] += 1 - - def collect( - self, - aggregation_temporality: AggregationTemporality, - collection_start_nano: int, - ) -> Optional[_DataPointVarT]: - """ - Atomically return a point for the current value of the metric. - """ - with self._lock: - if not any(self._bucket_counts): - return None - - bucket_counts = self._bucket_counts - start_time_unix_nano = self._start_time_unix_nano - sum_ = self._sum - max_ = self._max - min_ = self._min - - self._bucket_counts = self._get_empty_bucket_counts() - self._start_time_unix_nano = collection_start_nano - self._sum = 0 - self._min = inf - self._max = -inf - - current_point = HistogramDataPoint( - attributes=self._attributes, - start_time_unix_nano=start_time_unix_nano, - time_unix_nano=collection_start_nano, - count=sum(bucket_counts), - sum=sum_, - bucket_counts=tuple(bucket_counts), - explicit_bounds=self._boundaries, - min=min_, - max=max_, - ) - - if self._previous_point is None or ( - self._instrument_temporality is aggregation_temporality - ): - self._previous_point = current_point - return current_point - - max_ = current_point.max - min_ = current_point.min - - if aggregation_temporality is AggregationTemporality.CUMULATIVE: - start_time_unix_nano = self._previous_point.start_time_unix_nano - sum_ = current_point.sum + self._previous_point.sum - # Only update min/max on delta -> cumulative - max_ = max(current_point.max, self._previous_point.max) - min_ = min(current_point.min, self._previous_point.min) - bucket_counts = [ - curr_count + prev_count - for curr_count, prev_count in zip( - current_point.bucket_counts, - self._previous_point.bucket_counts, - ) - ] - else: - start_time_unix_nano = self._previous_point.time_unix_nano - sum_ = current_point.sum - self._previous_point.sum - bucket_counts = [ - curr_count - prev_count - for curr_count, prev_count in zip( - current_point.bucket_counts, - self._previous_point.bucket_counts, - ) - ] - - current_point = HistogramDataPoint( - attributes=self._attributes, - start_time_unix_nano=start_time_unix_nano, - time_unix_nano=current_point.time_unix_nano, - count=sum(bucket_counts), - sum=sum_, - bucket_counts=tuple(bucket_counts), - explicit_bounds=current_point.explicit_bounds, - min=min_, - max=max_, - ) - self._previous_point = current_point - return current_point - - -class Aggregation(ABC): - """ - Base class for all aggregation types. - """ - - @abstractmethod - def _create_aggregation( - self, - instrument: Instrument, - attributes: Attributes, - start_time_unix_nano: int, - ) -> _Aggregation: - """Creates an aggregation""" - - -class DefaultAggregation(Aggregation): - """ - The default aggregation to be used in a `View`. - - This aggregation will create an actual aggregation depending on the - instrument type, as specified next: - - ==================================================== ==================================== - Instrument Aggregation - ==================================================== ==================================== - `opensafely._vendor.opentelemetry.sdk.metrics.Counter` `SumAggregation` - `opensafely._vendor.opentelemetry.sdk.metrics.UpDownCounter` `SumAggregation` - `opensafely._vendor.opentelemetry.sdk.metrics.ObservableCounter` `SumAggregation` - `opensafely._vendor.opentelemetry.sdk.metrics.ObservableUpDownCounter` `SumAggregation` - `opensafely._vendor.opentelemetry.sdk.metrics.Histogram` `ExplicitBucketHistogramAggregation` - `opensafely._vendor.opentelemetry.sdk.metrics.ObservableGauge` `LastValueAggregation` - ==================================================== ==================================== - """ - - def _create_aggregation( - self, - instrument: Instrument, - attributes: Attributes, - start_time_unix_nano: int, - ) -> _Aggregation: - - # pylint: disable=too-many-return-statements - if isinstance(instrument, Counter): - return _SumAggregation( - attributes, - instrument_is_monotonic=True, - instrument_temporality=AggregationTemporality.DELTA, - start_time_unix_nano=start_time_unix_nano, - ) - if isinstance(instrument, UpDownCounter): - return _SumAggregation( - attributes, - instrument_is_monotonic=False, - instrument_temporality=AggregationTemporality.DELTA, - start_time_unix_nano=start_time_unix_nano, - ) - - if isinstance(instrument, ObservableCounter): - return _SumAggregation( - attributes, - instrument_is_monotonic=True, - instrument_temporality=AggregationTemporality.CUMULATIVE, - start_time_unix_nano=start_time_unix_nano, - ) - - if isinstance(instrument, ObservableUpDownCounter): - return _SumAggregation( - attributes, - instrument_is_monotonic=False, - instrument_temporality=AggregationTemporality.CUMULATIVE, - start_time_unix_nano=start_time_unix_nano, - ) - - if isinstance(instrument, Histogram): - return _ExplicitBucketHistogramAggregation( - attributes, start_time_unix_nano - ) - - if isinstance(instrument, ObservableGauge): - return _LastValueAggregation(attributes) - - raise Exception(f"Invalid instrument type {type(instrument)} found") - - -class ExplicitBucketHistogramAggregation(Aggregation): - """This aggregation informs the SDK to collect: - - - Count of Measurement values falling within explicit bucket boundaries. - - Arithmetic sum of Measurement values in population. This SHOULD NOT be collected when used with instruments that record negative measurements, e.g. UpDownCounter or ObservableGauge. - - Min (optional) Measurement value in population. - - Max (optional) Measurement value in population. - - - Args: - boundaries: Array of increasing values representing explicit bucket boundary values. - record_min_max: Whether to record min and max. - """ - - def __init__( - self, - boundaries: Sequence[float] = ( - 0.0, - 5.0, - 10.0, - 25.0, - 50.0, - 75.0, - 100.0, - 250.0, - 500.0, - 1000.0, - ), - record_min_max: bool = True, - ) -> None: - self._boundaries = boundaries - self._record_min_max = record_min_max - - def _create_aggregation( - self, - instrument: Instrument, - attributes: Attributes, - start_time_unix_nano: int, - ) -> _Aggregation: - return _ExplicitBucketHistogramAggregation( - attributes, - start_time_unix_nano, - self._boundaries, - self._record_min_max, - ) - - -class SumAggregation(Aggregation): - """This aggregation informs the SDK to collect: - - - The arithmetic sum of Measurement values. - """ - - def _create_aggregation( - self, - instrument: Instrument, - attributes: Attributes, - start_time_unix_nano: int, - ) -> _Aggregation: - - temporality = AggregationTemporality.UNSPECIFIED - if isinstance(instrument, Synchronous): - temporality = AggregationTemporality.DELTA - elif isinstance(instrument, Asynchronous): - temporality = AggregationTemporality.CUMULATIVE - - return _SumAggregation( - attributes, - isinstance(instrument, (Counter, ObservableCounter)), - temporality, - start_time_unix_nano, - ) - - -class LastValueAggregation(Aggregation): - """ - This aggregation informs the SDK to collect: - - - The last Measurement. - - The timestamp of the last Measurement. - """ - - def _create_aggregation( - self, - instrument: Instrument, - attributes: Attributes, - start_time_unix_nano: int, - ) -> _Aggregation: - return _LastValueAggregation(attributes) - - -class DropAggregation(Aggregation): - """Using this aggregation will make all measurements be ignored.""" - - def _create_aggregation( - self, - instrument: Instrument, - attributes: Attributes, - start_time_unix_nano: int, - ) -> _Aggregation: - return _DropAggregation(attributes) diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/exceptions.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/exceptions.py deleted file mode 100644 index 0f8c3a75..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/exceptions.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - - -class MetricsTimeoutError(Exception): - """Raised when a metrics function times out""" diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/export/__init__.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/export/__init__.py deleted file mode 100644 index e184e42e..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/export/__init__.py +++ /dev/null @@ -1,505 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 abc import ABC, abstractmethod -from enum import Enum -from logging import getLogger -from os import environ, linesep -from sys import stdout -from threading import Event, RLock, Thread -from typing import IO, Callable, Dict, Iterable, Optional - -from opensafely._vendor.typing_extensions import final - -# This kind of import is needed to avoid Sphinx errors. -import opensafely._vendor.opentelemetry.sdk.metrics._internal -from opensafely._vendor.opentelemetry.context import ( - _SUPPRESS_INSTRUMENTATION_KEY, - attach, - detach, - set_value, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.aggregation import ( - AggregationTemporality, - DefaultAggregation, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.instrument import ( - Counter, - Histogram, - ObservableCounter, - ObservableGauge, - ObservableUpDownCounter, - UpDownCounter, - _Counter, - _Histogram, - _ObservableCounter, - _ObservableGauge, - _ObservableUpDownCounter, - _UpDownCounter, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import MetricsData -from opensafely._vendor.opentelemetry.util._once import Once -from opensafely._vendor.opentelemetry.util._time import _time_ns - -_logger = getLogger(__name__) - - -class MetricExportResult(Enum): - """Result of exporting a metric - - Can be any of the following values:""" - - SUCCESS = 0 - FAILURE = 1 - - -class MetricExporter(ABC): - """Interface for exporting metrics. - - Interface to be implemented by services that want to export metrics received - in their own format. - - Args: - preferred_temporality: Used by `opensafely._vendor.opentelemetry.sdk.metrics.export.PeriodicExportingMetricReader` to - configure exporter level preferred temporality. See `opensafely._vendor.opentelemetry.sdk.metrics.export.MetricReader` for - more details on what preferred temporality is. - preferred_aggregation: Used by `opensafely._vendor.opentelemetry.sdk.metrics.export.PeriodicExportingMetricReader` to - configure exporter level preferred aggregation. See `opensafely._vendor.opentelemetry.sdk.metrics.export.MetricReader` for - more details on what preferred aggregation is. - """ - - def __init__( - self, - preferred_temporality: Dict[type, AggregationTemporality] = None, - preferred_aggregation: Dict[ - type, "opensafely._vendor.opentelemetry.sdk.metrics.view.Aggregation" - ] = None, - ) -> None: - self._preferred_temporality = preferred_temporality - self._preferred_aggregation = preferred_aggregation - - @abstractmethod - def export( - self, - metrics_data: MetricsData, - timeout_millis: float = 10_000, - **kwargs, - ) -> MetricExportResult: - """Exports a batch of telemetry data. - - Args: - metrics: The list of `opensafely._vendor.opentelemetry.sdk.metrics.export.Metric` objects to be exported - - Returns: - The result of the export - """ - - @abstractmethod - def force_flush(self, timeout_millis: float = 10_000) -> bool: - """ - Ensure that export of any metrics currently received by the exporter - are completed as soon as possible. - """ - - @abstractmethod - def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: - """Shuts down the exporter. - - Called when the SDK is shut down. - """ - - -class ConsoleMetricExporter(MetricExporter): - """Implementation of :class:`MetricExporter` that prints metrics to the - console. - - This class can be used for diagnostic purposes. It prints the exported - metrics to the console STDOUT. - """ - - def __init__( - self, - out: IO = stdout, - formatter: Callable[ - ["opensafely._vendor.opentelemetry.sdk.metrics.export.MetricsData"], str - ] = lambda metrics_data: metrics_data.to_json() - + linesep, - ): - super().__init__() - self.out = out - self.formatter = formatter - - def export( - self, - metrics_data: MetricsData, - timeout_millis: float = 10_000, - **kwargs, - ) -> MetricExportResult: - self.out.write(self.formatter(metrics_data)) - self.out.flush() - return MetricExportResult.SUCCESS - - def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: - pass - - def force_flush(self, timeout_millis: float = 10_000) -> bool: - return True - - -class MetricReader(ABC): - # pylint: disable=too-many-branches - """ - Base class for all metric readers - - Args: - preferred_temporality: A mapping between instrument classes and - aggregation temporality. By default uses CUMULATIVE for all instrument - classes. This mapping will be used to define the default aggregation - temporality of every instrument class. If the user wants to make a - change in the default aggregation temporality of an instrument class, - it is enough to pass here a dictionary whose keys are the instrument - classes and the values are the corresponding desired aggregation - temporalities of the classes that the user wants to change, not all of - them. The classes not included in the passed dictionary will retain - their association to their default aggregation temporalities. - preferred_aggregation: A mapping between instrument classes and - aggregation instances. By default maps all instrument classes to an - instance of `DefaultAggregation`. This mapping will be used to - define the default aggregation of every instrument class. If the - user wants to make a change in the default aggregation of an - instrument class, it is enough to pass here a dictionary whose keys - are the instrument classes and the values are the corresponding - desired aggregation for the instrument classes that the user wants - to change, not necessarily all of them. The classes not included in - the passed dictionary will retain their association to their - default aggregations. The aggregation defined here will be - overriden by an aggregation defined by a view that is not - `DefaultAggregation`. - - .. document protected _receive_metrics which is a intended to be overriden by subclass - .. automethod:: _receive_metrics - """ - - def __init__( - self, - preferred_temporality: Dict[type, AggregationTemporality] = None, - preferred_aggregation: Dict[ - type, "opensafely._vendor.opentelemetry.sdk.metrics.view.Aggregation" - ] = None, - ) -> None: - self._collect: Callable[ - [ - "opensafely._vendor.opentelemetry.sdk.metrics.export.MetricReader", - AggregationTemporality, - ], - Iterable["opensafely._vendor.opentelemetry.sdk.metrics.export.Metric"], - ] = None - - self._instrument_class_temporality = { - _Counter: AggregationTemporality.CUMULATIVE, - _UpDownCounter: AggregationTemporality.CUMULATIVE, - _Histogram: AggregationTemporality.CUMULATIVE, - _ObservableCounter: AggregationTemporality.CUMULATIVE, - _ObservableUpDownCounter: AggregationTemporality.CUMULATIVE, - _ObservableGauge: AggregationTemporality.CUMULATIVE, - } - - if preferred_temporality is not None: - for temporality in preferred_temporality.values(): - if temporality not in ( - AggregationTemporality.CUMULATIVE, - AggregationTemporality.DELTA, - ): - raise Exception( - f"Invalid temporality value found {temporality}" - ) - - if preferred_temporality is not None: - for typ, temporality in preferred_temporality.items(): - if typ is Counter: - self._instrument_class_temporality[_Counter] = temporality - elif typ is UpDownCounter: - self._instrument_class_temporality[ - _UpDownCounter - ] = temporality - elif typ is Histogram: - self._instrument_class_temporality[ - _Histogram - ] = temporality - elif typ is ObservableCounter: - self._instrument_class_temporality[ - _ObservableCounter - ] = temporality - elif typ is ObservableUpDownCounter: - self._instrument_class_temporality[ - _ObservableUpDownCounter - ] = temporality - elif typ is ObservableGauge: - self._instrument_class_temporality[ - _ObservableGauge - ] = temporality - else: - raise Exception(f"Invalid instrument class found {typ}") - - self._preferred_temporality = preferred_temporality - self._instrument_class_aggregation = { - _Counter: DefaultAggregation(), - _UpDownCounter: DefaultAggregation(), - _Histogram: DefaultAggregation(), - _ObservableCounter: DefaultAggregation(), - _ObservableUpDownCounter: DefaultAggregation(), - _ObservableGauge: DefaultAggregation(), - } - - if preferred_aggregation is not None: - for typ, aggregation in preferred_aggregation.items(): - if typ is Counter: - self._instrument_class_aggregation[_Counter] = aggregation - elif typ is UpDownCounter: - self._instrument_class_aggregation[ - _UpDownCounter - ] = aggregation - elif typ is Histogram: - self._instrument_class_aggregation[ - _Histogram - ] = aggregation - elif typ is ObservableCounter: - self._instrument_class_aggregation[ - _ObservableCounter - ] = aggregation - elif typ is ObservableUpDownCounter: - self._instrument_class_aggregation[ - _ObservableUpDownCounter - ] = aggregation - elif typ is ObservableGauge: - self._instrument_class_aggregation[ - _ObservableGauge - ] = aggregation - else: - raise Exception(f"Invalid instrument class found {typ}") - - @final - def collect(self, timeout_millis: float = 10_000) -> None: - """Collects the metrics from the internal SDK state and - invokes the `_receive_metrics` with the collection. - - Args: - timeout_millis: Amount of time in milliseconds before this function - raises a timeout error. - - If any of the underlying ``collect`` methods called by this method - fails by any reason (including timeout) an exception will be raised - detailing the individual errors that caused this function to fail. - """ - if self._collect is None: - _logger.warning( - "Cannot call collect on a MetricReader until it is registered on a MeterProvider" - ) - return - - self._receive_metrics( - self._collect(self, timeout_millis=timeout_millis), - timeout_millis=timeout_millis, - ) - - @final - def _set_collect_callback( - self, - func: Callable[ - [ - "opensafely._vendor.opentelemetry.sdk.metrics.export.MetricReader", - AggregationTemporality, - ], - Iterable["opensafely._vendor.opentelemetry.sdk.metrics.export.Metric"], - ], - ) -> None: - """This function is internal to the SDK. It should not be called or overriden by users""" - self._collect = func - - @abstractmethod - def _receive_metrics( - self, - metrics_data: "opensafely._vendor.opentelemetry.sdk.metrics.export.MetricsData", - timeout_millis: float = 10_000, - **kwargs, - ) -> None: - """Called by `MetricReader.collect` when it receives a batch of metrics""" - - def force_flush(self, timeout_millis: float = 10_000) -> bool: - self.collect(timeout_millis=timeout_millis) - return True - - @abstractmethod - def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: - """Shuts down the MetricReader. This method provides a way - for the MetricReader to do any cleanup required. A metric reader can - only be shutdown once, any subsequent calls are ignored and return - failure status. - - When a `MetricReader` is registered on a - :class:`~opensafely._vendor.opentelemetry.sdk.metrics.MeterProvider`, - :meth:`~opensafely._vendor.opentelemetry.sdk.metrics.MeterProvider.shutdown` will invoke this - automatically. - """ - - -class InMemoryMetricReader(MetricReader): - """Implementation of `MetricReader` that returns its metrics from :func:`get_metrics_data`. - - This is useful for e.g. unit tests. - """ - - def __init__( - self, - preferred_temporality: Dict[type, AggregationTemporality] = None, - preferred_aggregation: Dict[ - type, "opensafely._vendor.opentelemetry.sdk.metrics.view.Aggregation" - ] = None, - ) -> None: - super().__init__( - preferred_temporality=preferred_temporality, - preferred_aggregation=preferred_aggregation, - ) - self._lock = RLock() - self._metrics_data: ( - "opensafely._vendor.opentelemetry.sdk.metrics.export.MetricsData" - ) = None - - def get_metrics_data( - self, - ) -> ("opensafely._vendor.opentelemetry.sdk.metrics.export.MetricsData"): - """Reads and returns current metrics from the SDK""" - with self._lock: - self.collect() - metrics_data = self._metrics_data - self._metrics_data = None - return metrics_data - - def _receive_metrics( - self, - metrics_data: "opensafely._vendor.opentelemetry.sdk.metrics.export.MetricsData", - timeout_millis: float = 10_000, - **kwargs, - ) -> None: - with self._lock: - self._metrics_data = metrics_data - - def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: - pass - - -class PeriodicExportingMetricReader(MetricReader): - """`PeriodicExportingMetricReader` is an implementation of `MetricReader` - that collects metrics based on a user-configurable time interval, and passes the - metrics to the configured exporter. - """ - - def __init__( - self, - exporter: MetricExporter, - export_interval_millis: Optional[float] = None, - export_timeout_millis: Optional[float] = None, - ) -> None: - # PeriodicExportingMetricReader defers to exporter for configuration - super().__init__( - preferred_temporality=exporter._preferred_temporality, - preferred_aggregation=exporter._preferred_aggregation, - ) - self._exporter = exporter - if export_interval_millis is None: - try: - export_interval_millis = float( - environ.get("OTEL_METRIC_EXPORT_INTERVAL", 60000) - ) - except ValueError: - _logger.warning( - "Found invalid value for export interval, using default" - ) - export_interval_millis = 60000 - if export_timeout_millis is None: - try: - export_timeout_millis = float( - environ.get("OTEL_METRIC_EXPORT_TIMEOUT", 30000) - ) - except ValueError: - _logger.warning( - "Found invalid value for export timeout, using default" - ) - export_timeout_millis = 30000 - self._export_interval_millis = export_interval_millis - self._export_timeout_millis = export_timeout_millis - self._shutdown = False - self._shutdown_event = Event() - self._shutdown_once = Once() - self._daemon_thread = Thread( - name="OtelPeriodicExportingMetricReader", - target=self._ticker, - daemon=True, - ) - self._daemon_thread.start() - if hasattr(os, "register_at_fork"): - os.register_at_fork( - after_in_child=self._at_fork_reinit - ) # pylint: disable=protected-access - - def _at_fork_reinit(self): - self._daemon_thread = Thread( - name="OtelPeriodicExportingMetricReader", - target=self._ticker, - daemon=True, - ) - self._daemon_thread.start() - - def _ticker(self) -> None: - interval_secs = self._export_interval_millis / 1e3 - while not self._shutdown_event.wait(interval_secs): - self.collect(timeout_millis=self._export_timeout_millis) - # one last collection below before shutting down completely - self.collect(timeout_millis=self._export_interval_millis) - - def _receive_metrics( - self, - metrics_data: MetricsData, - timeout_millis: float = 10_000, - **kwargs, - ) -> None: - if metrics_data is None: - return - token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)) - try: - self._exporter.export(metrics_data, timeout_millis=timeout_millis) - except Exception as e: # pylint: disable=broad-except,invalid-name - _logger.exception("Exception while exporting metrics %s", str(e)) - detach(token) - - def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: - deadline_ns = _time_ns() + timeout_millis * 10**6 - - def _shutdown(): - self._shutdown = True - - did_set = self._shutdown_once.do_once(_shutdown) - if not did_set: - _logger.warning("Can't shutdown multiple times") - return - - self._shutdown_event.set() - self._daemon_thread.join(timeout=(deadline_ns - _time_ns()) / 10**9) - self._exporter.shutdown(timeout=(deadline_ns - _time_ns()) / 10**6) - - def force_flush(self, timeout_millis: float = 10_000) -> bool: - super().force_flush(timeout_millis=timeout_millis) - self._exporter.force_flush(timeout_millis=timeout_millis) - return True diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/instrument.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/instrument.py deleted file mode 100644 index c2248c66..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/instrument.py +++ /dev/null @@ -1,246 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=too-many-ancestors, unused-import - -from logging import getLogger -from typing import Dict, Generator, Iterable, List, Optional, Union - -# This kind of import is needed to avoid Sphinx errors. -import opensafely._vendor.opentelemetry.sdk.metrics -from opensafely._vendor.opentelemetry.metrics import CallbackT -from opensafely._vendor.opentelemetry.metrics import Counter as APICounter -from opensafely._vendor.opentelemetry.metrics import Histogram as APIHistogram -from opensafely._vendor.opentelemetry.metrics import ObservableCounter as APIObservableCounter -from opensafely._vendor.opentelemetry.metrics import ObservableGauge as APIObservableGauge -from opensafely._vendor.opentelemetry.metrics import ( - ObservableUpDownCounter as APIObservableUpDownCounter, -) -from opensafely._vendor.opentelemetry.metrics import UpDownCounter as APIUpDownCounter -from opensafely._vendor.opentelemetry.metrics._internal.instrument import CallbackOptions -from opensafely._vendor.opentelemetry.sdk.metrics._internal.measurement import Measurement -from opensafely._vendor.opentelemetry.sdk.util.instrumentation import InstrumentationScope - -_logger = getLogger(__name__) - - -_ERROR_MESSAGE = ( - "Expected ASCII string of maximum length 63 characters but got {}" -) - - -class _Synchronous: - def __init__( - self, - name: str, - instrumentation_scope: InstrumentationScope, - measurement_consumer: "opensafely._vendor.opentelemetry.sdk.metrics.MeasurementConsumer", - unit: str = "", - description: str = "", - ): - # pylint: disable=no-member - result = self._check_name_unit_description(name, unit, description) - - if result["name"] is None: - raise Exception(_ERROR_MESSAGE.format(name)) - - if result["unit"] is None: - raise Exception(_ERROR_MESSAGE.format(unit)) - - name = result["name"] - unit = result["unit"] - description = result["description"] - - self.name = name.lower() - self.unit = unit - self.description = description - self.instrumentation_scope = instrumentation_scope - self._measurement_consumer = measurement_consumer - super().__init__(name, unit=unit, description=description) - - -class _Asynchronous: - def __init__( - self, - name: str, - instrumentation_scope: InstrumentationScope, - measurement_consumer: "opensafely._vendor.opentelemetry.sdk.metrics.MeasurementConsumer", - callbacks: Optional[Iterable[CallbackT]] = None, - unit: str = "", - description: str = "", - ): - # pylint: disable=no-member - result = self._check_name_unit_description(name, unit, description) - - if result["name"] is None: - raise Exception(_ERROR_MESSAGE.format(name)) - - if result["unit"] is None: - raise Exception(_ERROR_MESSAGE.format(unit)) - - name = result["name"] - unit = result["unit"] - description = result["description"] - - self.name = name.lower() - self.unit = unit - self.description = description - self.instrumentation_scope = instrumentation_scope - self._measurement_consumer = measurement_consumer - super().__init__(name, callbacks, unit=unit, description=description) - - self._callbacks: List[CallbackT] = [] - - if callbacks is not None: - - for callback in callbacks: - - if isinstance(callback, Generator): - - # advance generator to it's first yield - next(callback) - - def inner( - options: CallbackOptions, - callback=callback, - ) -> Iterable[Measurement]: - try: - return callback.send(options) - except StopIteration: - return [] - - self._callbacks.append(inner) - else: - self._callbacks.append(callback) - - def callback( - self, callback_options: CallbackOptions - ) -> Iterable[Measurement]: - for callback in self._callbacks: - try: - for api_measurement in callback(callback_options): - yield Measurement( - api_measurement.value, - instrument=self, - attributes=api_measurement.attributes, - ) - except Exception: # pylint: disable=broad-except - _logger.exception( - "Callback failed for instrument %s.", self.name - ) - - -class Counter(_Synchronous, APICounter): - def __new__(cls, *args, **kwargs): - if cls is Counter: - raise TypeError("Counter must be instantiated via a meter.") - return super().__new__(cls) - - def add( - self, amount: Union[int, float], attributes: Dict[str, str] = None - ): - if amount < 0: - _logger.warning( - "Add amount must be non-negative on Counter %s.", self.name - ) - return - self._measurement_consumer.consume_measurement( - Measurement(amount, self, attributes) - ) - - -class UpDownCounter(_Synchronous, APIUpDownCounter): - def __new__(cls, *args, **kwargs): - if cls is UpDownCounter: - raise TypeError("UpDownCounter must be instantiated via a meter.") - return super().__new__(cls) - - def add( - self, amount: Union[int, float], attributes: Dict[str, str] = None - ): - self._measurement_consumer.consume_measurement( - Measurement(amount, self, attributes) - ) - - -class ObservableCounter(_Asynchronous, APIObservableCounter): - def __new__(cls, *args, **kwargs): - if cls is ObservableCounter: - raise TypeError( - "ObservableCounter must be instantiated via a meter." - ) - return super().__new__(cls) - - -class ObservableUpDownCounter(_Asynchronous, APIObservableUpDownCounter): - def __new__(cls, *args, **kwargs): - if cls is ObservableUpDownCounter: - raise TypeError( - "ObservableUpDownCounter must be instantiated via a meter." - ) - return super().__new__(cls) - - -class Histogram(_Synchronous, APIHistogram): - def __new__(cls, *args, **kwargs): - if cls is Histogram: - raise TypeError("Histogram must be instantiated via a meter.") - return super().__new__(cls) - - def record( - self, amount: Union[int, float], attributes: Dict[str, str] = None - ): - if amount < 0: - _logger.warning( - "Record amount must be non-negative on Histogram %s.", - self.name, - ) - return - self._measurement_consumer.consume_measurement( - Measurement(amount, self, attributes) - ) - - -class ObservableGauge(_Asynchronous, APIObservableGauge): - def __new__(cls, *args, **kwargs): - if cls is ObservableGauge: - raise TypeError( - "ObservableGauge must be instantiated via a meter." - ) - return super().__new__(cls) - - -# Below classes exist to prevent the direct instantiation -class _Counter(Counter): - pass - - -class _UpDownCounter(UpDownCounter): - pass - - -class _ObservableCounter(ObservableCounter): - pass - - -class _ObservableUpDownCounter(ObservableUpDownCounter): - pass - - -class _Histogram(Histogram): - pass - - -class _ObservableGauge(ObservableGauge): - pass diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement.py deleted file mode 100644 index c152370d..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 dataclasses import dataclass -from typing import Union - -from opensafely._vendor.opentelemetry.metrics import Instrument -from opensafely._vendor.opentelemetry.util.types import Attributes - - -@dataclass(frozen=True) -class Measurement: - """ - Represents a data point reported via the metrics API to the SDK. - """ - - value: Union[int, float] - instrument: Instrument - attributes: Attributes = None diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement_consumer.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement_consumer.py deleted file mode 100644 index 90c59c6b..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/measurement_consumer.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=unused-import - -from abc import ABC, abstractmethod -from threading import Lock -from typing import Iterable, List, Mapping - -# This kind of import is needed to avoid Sphinx errors. -import opensafely._vendor.opentelemetry.sdk.metrics -import opensafely._vendor.opentelemetry.sdk.metrics._internal.instrument -import opensafely._vendor.opentelemetry.sdk.metrics._internal.sdk_configuration -from opensafely._vendor.opentelemetry.metrics._internal.instrument import CallbackOptions -from opensafely._vendor.opentelemetry.sdk.metrics._internal.exceptions import MetricsTimeoutError -from opensafely._vendor.opentelemetry.sdk.metrics._internal.measurement import Measurement -from opensafely._vendor.opentelemetry.sdk.metrics._internal.metric_reader_storage import ( - MetricReaderStorage, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import Metric -from opensafely._vendor.opentelemetry.util._time import _time_ns - - -class MeasurementConsumer(ABC): - @abstractmethod - def consume_measurement(self, measurement: Measurement) -> None: - pass - - @abstractmethod - def register_asynchronous_instrument( - self, - instrument: ( - "opensafely._vendor.opentelemetry.sdk.metrics._internal.instrument_Asynchronous" - ), - ): - pass - - @abstractmethod - def collect( - self, - metric_reader: "opensafely._vendor.opentelemetry.sdk.metrics.MetricReader", - timeout_millis: float = 10_000, - ) -> Iterable[Metric]: - pass - - -class SynchronousMeasurementConsumer(MeasurementConsumer): - def __init__( - self, - sdk_config: "opensafely._vendor.opentelemetry.sdk.metrics._internal.SdkConfiguration", - ) -> None: - self._lock = Lock() - self._sdk_config = sdk_config - # should never be mutated - self._reader_storages: Mapping[ - "opensafely._vendor.opentelemetry.sdk.metrics.MetricReader", MetricReaderStorage - ] = { - reader: MetricReaderStorage( - sdk_config, - reader._instrument_class_temporality, - reader._instrument_class_aggregation, - ) - for reader in sdk_config.metric_readers - } - self._async_instruments: List[ - "opensafely._vendor.opentelemetry.sdk.metrics._internal.instrument._Asynchronous" - ] = [] - - def consume_measurement(self, measurement: Measurement) -> None: - for reader_storage in self._reader_storages.values(): - reader_storage.consume_measurement(measurement) - - def register_asynchronous_instrument( - self, - instrument: ( - "opensafely._vendor.opentelemetry.sdk.metrics._internal.instrument._Asynchronous" - ), - ) -> None: - with self._lock: - self._async_instruments.append(instrument) - - def collect( - self, - metric_reader: "opensafely._vendor.opentelemetry.sdk.metrics.MetricReader", - timeout_millis: float = 10_000, - ) -> Iterable[Metric]: - - with self._lock: - metric_reader_storage = self._reader_storages[metric_reader] - # for now, just use the defaults - callback_options = CallbackOptions() - deadline_ns = _time_ns() + timeout_millis * 10**6 - - default_timeout_millis = 10000 * 10**6 - - for async_instrument in self._async_instruments: - - remaining_time = deadline_ns - _time_ns() - - if remaining_time < default_timeout_millis: - - callback_options = CallbackOptions( - timeout_millis=remaining_time - ) - - measurements = async_instrument.callback(callback_options) - if _time_ns() >= deadline_ns: - raise MetricsTimeoutError( - "Timed out while executing callback" - ) - - for measurement in measurements: - metric_reader_storage.consume_measurement(measurement) - - return self._reader_storages[metric_reader].collect() diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py deleted file mode 100644 index c658a821..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py +++ /dev/null @@ -1,298 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 logging import getLogger -from threading import RLock -from typing import Dict, List - -from opensafely._vendor.opentelemetry.metrics import ( - Asynchronous, - Counter, - Instrument, - ObservableCounter, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal._view_instrument_match import ( - _ViewInstrumentMatch, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.aggregation import ( - Aggregation, - ExplicitBucketHistogramAggregation, - _DropAggregation, - _ExplicitBucketHistogramAggregation, - _LastValueAggregation, - _SumAggregation, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.export import AggregationTemporality -from opensafely._vendor.opentelemetry.sdk.metrics._internal.measurement import Measurement -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import ( - Gauge, - Histogram, - Metric, - MetricsData, - ResourceMetrics, - ScopeMetrics, - Sum, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.sdk_configuration import ( - SdkConfiguration, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.view import View -from opensafely._vendor.opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opensafely._vendor.opentelemetry.util._time import _time_ns - -_logger = getLogger(__name__) - -_DEFAULT_VIEW = View(instrument_name="") - - -class MetricReaderStorage: - """The SDK's storage for a given reader""" - - def __init__( - self, - sdk_config: SdkConfiguration, - instrument_class_temporality: Dict[type, AggregationTemporality], - instrument_class_aggregation: Dict[type, Aggregation], - ) -> None: - self._lock = RLock() - self._sdk_config = sdk_config - self._instrument_view_instrument_matches: Dict[ - Instrument, List[_ViewInstrumentMatch] - ] = {} - self._instrument_class_temporality = instrument_class_temporality - self._instrument_class_aggregation = instrument_class_aggregation - - def _get_or_init_view_instrument_match( - self, instrument: Instrument - ) -> List[_ViewInstrumentMatch]: - # Optimistically get the relevant views for the given instrument. Once set for a given - # instrument, the mapping will never change - - if instrument in self._instrument_view_instrument_matches: - return self._instrument_view_instrument_matches[instrument] - - with self._lock: - # double check if it was set before we held the lock - if instrument in self._instrument_view_instrument_matches: - return self._instrument_view_instrument_matches[instrument] - - # not present, hold the lock and add a new mapping - view_instrument_matches = [] - - self._handle_view_instrument_match( - instrument, view_instrument_matches - ) - - # if no view targeted the instrument, use the default - if not view_instrument_matches: - view_instrument_matches.append( - _ViewInstrumentMatch( - view=_DEFAULT_VIEW, - instrument=instrument, - instrument_class_aggregation=( - self._instrument_class_aggregation - ), - ) - ) - self._instrument_view_instrument_matches[ - instrument - ] = view_instrument_matches - - return view_instrument_matches - - def consume_measurement(self, measurement: Measurement) -> None: - for view_instrument_match in self._get_or_init_view_instrument_match( - measurement.instrument - ): - view_instrument_match.consume_measurement(measurement) - - def collect(self) -> MetricsData: - # Use a list instead of yielding to prevent a slow reader from holding - # SDK locks - - # While holding the lock, new _ViewInstrumentMatch can't be added from - # another thread (so we are sure we collect all existing view). - # However, instruments can still send measurements that will make it - # into the individual aggregations; collection will acquire those locks - # iteratively to keep locking as fine-grained as possible. One side - # effect is that end times can be slightly skewed among the metric - # streams produced by the SDK, but we still align the output timestamps - # for a single instrument. - - collection_start_nanos = _time_ns() - - with self._lock: - - instrumentation_scope_scope_metrics: ( - Dict[InstrumentationScope, ScopeMetrics] - ) = {} - - for ( - instrument, - view_instrument_matches, - ) in self._instrument_view_instrument_matches.items(): - aggregation_temporality = self._instrument_class_temporality[ - instrument.__class__ - ] - - metrics: List[Metric] = [] - - for view_instrument_match in view_instrument_matches: - - if isinstance( - # pylint: disable=protected-access - view_instrument_match._aggregation, - _SumAggregation, - ): - data = Sum( - aggregation_temporality=aggregation_temporality, - data_points=view_instrument_match.collect( - aggregation_temporality, collection_start_nanos - ), - is_monotonic=isinstance( - instrument, (Counter, ObservableCounter) - ), - ) - elif isinstance( - # pylint: disable=protected-access - view_instrument_match._aggregation, - _LastValueAggregation, - ): - data = Gauge( - data_points=view_instrument_match.collect( - aggregation_temporality, collection_start_nanos - ) - ) - elif isinstance( - # pylint: disable=protected-access - view_instrument_match._aggregation, - _ExplicitBucketHistogramAggregation, - ): - data = Histogram( - data_points=view_instrument_match.collect( - aggregation_temporality, collection_start_nanos - ), - aggregation_temporality=aggregation_temporality, - ) - elif isinstance( - # pylint: disable=protected-access - view_instrument_match._aggregation, - _DropAggregation, - ): - continue - - metrics.append( - Metric( - # pylint: disable=protected-access - name=view_instrument_match._name, - description=view_instrument_match._description, - unit=view_instrument_match._instrument.unit, - data=data, - ) - ) - - if instrument.instrumentation_scope not in ( - instrumentation_scope_scope_metrics - ): - instrumentation_scope_scope_metrics[ - instrument.instrumentation_scope - ] = ScopeMetrics( - scope=instrument.instrumentation_scope, - metrics=metrics, - schema_url=instrument.instrumentation_scope.schema_url, - ) - else: - instrumentation_scope_scope_metrics[ - instrument.instrumentation_scope - ].metrics.extend(metrics) - - return MetricsData( - resource_metrics=[ - ResourceMetrics( - resource=self._sdk_config.resource, - scope_metrics=list( - instrumentation_scope_scope_metrics.values() - ), - schema_url=self._sdk_config.resource.schema_url, - ) - ] - ) - - def _handle_view_instrument_match( - self, - instrument: Instrument, - view_instrument_matches: List["_ViewInstrumentMatch"], - ) -> None: - for view in self._sdk_config.views: - # pylint: disable=protected-access - if not view._match(instrument): - continue - - if not self._check_view_instrument_compatibility(view, instrument): - continue - - new_view_instrument_match = _ViewInstrumentMatch( - view=view, - instrument=instrument, - instrument_class_aggregation=( - self._instrument_class_aggregation - ), - ) - - for ( - existing_view_instrument_matches - ) in self._instrument_view_instrument_matches.values(): - for ( - existing_view_instrument_match - ) in existing_view_instrument_matches: - if existing_view_instrument_match.conflicts( - new_view_instrument_match - ): - - _logger.warning( - "Views %s and %s will cause conflicting " - "metrics identities", - existing_view_instrument_match._view, - new_view_instrument_match._view, - ) - - view_instrument_matches.append(new_view_instrument_match) - - @staticmethod - def _check_view_instrument_compatibility( - view: View, instrument: Instrument - ) -> bool: - """ - Checks if a view and an instrument are compatible. - - Returns `true` if they are compatible and a `_ViewInstrumentMatch` - object should be created, `false` otherwise. - """ - - result = True - - # pylint: disable=protected-access - if isinstance(instrument, Asynchronous) and isinstance( - view._aggregation, ExplicitBucketHistogramAggregation - ): - _logger.warning( - "View %s and instrument %s will produce " - "semantic errors when matched, the view " - "has not been applied.", - view, - instrument, - ) - result = False - - return result diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/point.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/point.py deleted file mode 100644 index 8e3ac5e7..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/point.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=unused-import - -from dataclasses import asdict, dataclass -from json import dumps, loads -from typing import Optional, Sequence, Union - -# This kind of import is needed to avoid Sphinx errors. -import opensafely._vendor.opentelemetry.sdk.metrics._internal -from opensafely._vendor.opentelemetry.sdk.resources import Resource -from opensafely._vendor.opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opensafely._vendor.opentelemetry.util.types import Attributes - - -@dataclass(frozen=True) -class NumberDataPoint: - """Single data point in a timeseries that describes the time-varying scalar - value of a metric. - """ - - attributes: Attributes - start_time_unix_nano: int - time_unix_nano: int - value: Union[int, float] - - def to_json(self, indent=4) -> str: - return dumps(asdict(self), indent=indent) - - -@dataclass(frozen=True) -class HistogramDataPoint: - """Single data point in a timeseries that describes the time-varying scalar - value of a metric. - """ - - attributes: Attributes - start_time_unix_nano: int - time_unix_nano: int - count: int - sum: Union[int, float] - bucket_counts: Sequence[int] - explicit_bounds: Sequence[float] - min: float - max: float - - def to_json(self, indent=4) -> str: - return dumps(asdict(self), indent=indent) - - -@dataclass(frozen=True) -class Sum: - """Represents the type of a scalar metric that is calculated as a sum of - all reported measurements over a time interval.""" - - data_points: Sequence[NumberDataPoint] - aggregation_temporality: ( - "opensafely._vendor.opentelemetry.sdk.metrics.export.AggregationTemporality" - ) - is_monotonic: bool - - def to_json(self, indent=4) -> str: - return dumps( - { - "data_points": [ - loads(data_point.to_json(indent=indent)) - for data_point in self.data_points - ], - "aggregation_temporality": self.aggregation_temporality, - "is_monotonic": self.is_monotonic, - }, - indent=indent, - ) - - -@dataclass(frozen=True) -class Gauge: - """Represents the type of a scalar metric that always exports the current - value for every data point. It should be used for an unknown - aggregation.""" - - data_points: Sequence[NumberDataPoint] - - def to_json(self, indent=4) -> str: - return dumps( - { - "data_points": [ - loads(data_point.to_json(indent=indent)) - for data_point in self.data_points - ], - }, - indent=indent, - ) - - -@dataclass(frozen=True) -class Histogram: - """Represents the type of a metric that is calculated by aggregating as a - histogram of all reported measurements over a time interval.""" - - data_points: Sequence[HistogramDataPoint] - aggregation_temporality: ( - "opensafely._vendor.opentelemetry.sdk.metrics.export.AggregationTemporality" - ) - - def to_json(self, indent=4) -> str: - return dumps( - { - "data_points": [ - loads(data_point.to_json(indent=indent)) - for data_point in self.data_points - ], - "aggregation_temporality": self.aggregation_temporality, - }, - indent=indent, - ) - - -DataT = Union[Sum, Gauge, Histogram] -DataPointT = Union[NumberDataPoint, HistogramDataPoint] - - -@dataclass(frozen=True) -class Metric: - """Represents a metric point in the OpenTelemetry data model to be - exported.""" - - name: str - description: Optional[str] - unit: Optional[str] - data: DataT - - def to_json(self, indent=4) -> str: - return dumps( - { - "name": self.name, - "description": self.description or "", - "unit": self.unit or "", - "data": loads(self.data.to_json(indent=indent)), - }, - indent=indent, - ) - - -@dataclass(frozen=True) -class ScopeMetrics: - """A collection of Metrics produced by a scope""" - - scope: InstrumentationScope - metrics: Sequence[Metric] - schema_url: str - - def to_json(self, indent=4) -> str: - return dumps( - { - "scope": loads(self.scope.to_json(indent=indent)), - "metrics": [ - loads(metric.to_json(indent=indent)) - for metric in self.metrics - ], - "schema_url": self.schema_url, - }, - indent=indent, - ) - - -@dataclass(frozen=True) -class ResourceMetrics: - """A collection of ScopeMetrics from a Resource""" - - resource: Resource - scope_metrics: Sequence[ScopeMetrics] - schema_url: str - - def to_json(self, indent=4) -> str: - return dumps( - { - "resource": loads(self.resource.to_json(indent=indent)), - "scope_metrics": [ - loads(scope_metrics.to_json(indent=indent)) - for scope_metrics in self.scope_metrics - ], - "schema_url": self.schema_url, - }, - indent=indent, - ) - - -@dataclass(frozen=True) -class MetricsData: - """An array of ResourceMetrics""" - - resource_metrics: Sequence[ResourceMetrics] - - def to_json(self, indent=4) -> str: - return dumps( - { - "resource_metrics": [ - loads(resource_metrics.to_json(indent=indent)) - for resource_metrics in self.resource_metrics - ] - } - ) diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/sdk_configuration.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/sdk_configuration.py deleted file mode 100644 index aa01db51..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/sdk_configuration.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=unused-import - -from dataclasses import dataclass -from typing import Sequence - -# This kind of import is needed to avoid Sphinx errors. -import opensafely._vendor.opentelemetry.sdk.metrics -import opensafely._vendor.opentelemetry.sdk.resources - - -@dataclass -class SdkConfiguration: - resource: "opensafely._vendor.opentelemetry.sdk.resources.Resource" - metric_readers: Sequence["opensafely._vendor.opentelemetry.sdk.metrics.MetricReader"] - views: Sequence["opensafely._vendor.opentelemetry.sdk.metrics.View"] diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/view.py b/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/view.py deleted file mode 100644 index 308a7d81..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/_internal/view.py +++ /dev/null @@ -1,161 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 fnmatch import fnmatch -from logging import getLogger -from typing import Optional, Set, Type - -# FIXME import from typing when support for 3.6 is removed -from opensafely._vendor.typing_extensions import final - -from opensafely._vendor.opentelemetry.metrics import Instrument -from opensafely._vendor.opentelemetry.sdk.metrics._internal.aggregation import ( - Aggregation, - DefaultAggregation, -) - -_logger = getLogger(__name__) - - -class View: - """ - A `View` configuration parameters can be used for the following - purposes: - - 1. Match instruments: When an instrument matches a view, measurements - received by that instrument will be processed. - 2. Customize metric streams: A metric stream is identified by a match - between a view and an instrument and a set of attributes. The metric - stream can be customized by certain attributes of the corresponding view. - - The attributes documented next serve one of the previous two purposes. - - Args: - instrument_type: This is an instrument matching attribute: the class the - instrument must be to match the view. - - instrument_name: This is an instrument matching attribute: the name the - instrument must have to match the view. Wild card characters are supported. Wild - card characters should not be used with this attribute if the view has also a - ``name`` defined. - - meter_name: This is an instrument matching attribute: the name the - instrument meter must have to match the view. - - meter_version: This is an instrument matching attribute: the version - the instrument meter must have to match the view. - - meter_schema_url: This is an instrument matching attribute: the schema - URL the instrument meter must have to match the view. - - name: This is a metric stream customizing attribute: the name of the - metric stream. If `None`, the name of the instrument will be used. - - description: This is a metric stream customizing attribute: the - description of the metric stream. If `None`, the description of the instrument will - be used. - - attribute_keys: This is a metric stream customizing attribute: this is - a set of attribute keys. If not `None` then only the measurement attributes that - are in ``attribute_keys`` will be used to identify the metric stream. - - aggregation: This is a metric stream customizing attribute: the - aggregation instance to use when data is aggregated for the - corresponding metrics stream. If `None` an instance of - `DefaultAggregation` will be used. - - This class is not intended to be subclassed by the user. - """ - - _default_aggregation = DefaultAggregation() - - def __init__( - self, - instrument_type: Optional[Type[Instrument]] = None, - instrument_name: Optional[str] = None, - meter_name: Optional[str] = None, - meter_version: Optional[str] = None, - meter_schema_url: Optional[str] = None, - name: Optional[str] = None, - description: Optional[str] = None, - attribute_keys: Optional[Set[str]] = None, - aggregation: Optional[Aggregation] = None, - ): - if ( - instrument_type - is instrument_name - is meter_name - is meter_version - is meter_schema_url - is None - ): - raise Exception( - "Some instrument selection " - f"criteria must be provided for View {name}" - ) - - if ( - name is not None - and instrument_name is not None - and ("*" in instrument_name or "?" in instrument_name) - ): - - raise Exception( - f"View {name} declared with wildcard " - "characters in instrument_name" - ) - - # _name, _description, _aggregation and _attribute_keys will be - # accessed when instantiating a _ViewInstrumentMatch. - self._name = name - self._instrument_type = instrument_type - self._instrument_name = instrument_name - self._meter_name = meter_name - self._meter_version = meter_version - self._meter_schema_url = meter_schema_url - - self._description = description - self._attribute_keys = attribute_keys - self._aggregation = aggregation or self._default_aggregation - - # pylint: disable=too-many-return-statements - # pylint: disable=too-many-branches - @final - def _match(self, instrument: Instrument) -> bool: - - if self._instrument_type is not None: - if not isinstance(instrument, self._instrument_type): - return False - - if self._instrument_name is not None: - if not fnmatch(instrument.name, self._instrument_name): - return False - - if self._meter_name is not None: - if instrument.instrumentation_scope.name != self._meter_name: - return False - - if self._meter_version is not None: - if instrument.instrumentation_scope.version != self._meter_version: - return False - - if self._meter_schema_url is not None: - if ( - instrument.instrumentation_scope.schema_url - != self._meter_schema_url - ): - return False - - return True diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/export/__init__.py b/opensafely/_vendor/opentelemetry/sdk/metrics/export/__init__.py deleted file mode 100644 index 872d825b..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/export/__init__.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=unused-import -# FIXME Remove when 3.6 is no longer supported -from sys import version_info as _version_info - -from opensafely._vendor.opentelemetry.sdk.metrics._internal.export import ( # noqa: F401 - AggregationTemporality, - ConsoleMetricExporter, - InMemoryMetricReader, - MetricExporter, - MetricExportResult, - MetricReader, - PeriodicExportingMetricReader, -) - -# The point module is not in the export directory to avoid a circular import. -from opensafely._vendor.opentelemetry.sdk.metrics._internal.point import ( # noqa: F401 - DataPointT, - DataT, - Gauge, - Histogram, - HistogramDataPoint, - Metric, - MetricsData, - NumberDataPoint, - ResourceMetrics, - ScopeMetrics, - Sum, -) - -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - if _version_info.minor == 6 and key in ["DataPointT", "DataT"]: - continue - value.__module__ = __name__ - __all__.append(key) diff --git a/opensafely/_vendor/opentelemetry/sdk/metrics/view/__init__.py b/opensafely/_vendor/opentelemetry/sdk/metrics/view/__init__.py deleted file mode 100644 index eaf470d9..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/metrics/view/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=unused-import - -from opensafely._vendor.opentelemetry.sdk.metrics._internal.aggregation import ( # noqa: F401 - Aggregation, - DefaultAggregation, - DropAggregation, - ExplicitBucketHistogramAggregation, - LastValueAggregation, - SumAggregation, -) -from opensafely._vendor.opentelemetry.sdk.metrics._internal.view import View # noqa: F401 - -__all__ = [] -for key, value in globals().copy().items(): - if not key.startswith("_"): - value.__module__ = __name__ - __all__.append(key) diff --git a/opensafely/_vendor/opentelemetry/sdk/py.typed b/opensafely/_vendor/opentelemetry/sdk/py.typed deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/sdk/resources/__init__.py b/opensafely/_vendor/opentelemetry/sdk/resources/__init__.py deleted file mode 100644 index d2f060d3..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/resources/__init__.py +++ /dev/null @@ -1,355 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -""" -This package implements `OpenTelemetry Resources -`_: - - *A Resource is an immutable representation of the entity producing - telemetry. For example, a process producing telemetry that is running in - a container on Kubernetes has a Pod name, it is in a namespace and - possibly is part of a Deployment which also has a name. All three of - these attributes can be included in the Resource.* - -Resource objects are created with `Resource.create`, which accepts attributes -(key-values). Resources should NOT be created via constructor, and working with -`Resource` objects should only be done via the Resource API methods. Resource -attributes can also be passed at process invocation in the -:envvar:`OTEL_RESOURCE_ATTRIBUTES` environment variable. You should register -your resource with the `opentelemetry.sdk.trace.TracerProvider` by passing -them into their constructors. The `Resource` passed to a provider is available -to the exporter, which can send on this information as it sees fit. - -.. code-block:: python - - trace.set_tracer_provider( - TracerProvider( - resource=Resource.create({ - "service.name": "shoppingcart", - "service.instance.id": "instance-12", - }), - ), - ) - print(trace.get_tracer_provider().resource.attributes) - - {'telemetry.sdk.language': 'python', - 'telemetry.sdk.name': 'opentelemetry', - 'telemetry.sdk.version': '0.13.dev0', - 'service.name': 'shoppingcart', - 'service.instance.id': 'instance-12'} - -Note that the OpenTelemetry project documents certain `"standard attributes" -`_ -that have prescribed semantic meanings, for example ``service.name`` in the -above example. - """ - -import abc -import concurrent.futures -import logging -import os -import sys -import typing -from json import dumps - -import pkg_resources - -from opensafely._vendor.opentelemetry.attributes import BoundedAttributes -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - OTEL_RESOURCE_ATTRIBUTES, - OTEL_SERVICE_NAME, -) -from opensafely._vendor.opentelemetry.semconv.resource import ResourceAttributes -from opensafely._vendor.opentelemetry.util.types import AttributeValue - -LabelValue = AttributeValue -Attributes = typing.Dict[str, LabelValue] -logger = logging.getLogger(__name__) - - -CLOUD_PROVIDER = ResourceAttributes.CLOUD_PROVIDER -CLOUD_ACCOUNT_ID = ResourceAttributes.CLOUD_ACCOUNT_ID -CLOUD_REGION = ResourceAttributes.CLOUD_REGION -CLOUD_AVAILABILITY_ZONE = ResourceAttributes.CLOUD_AVAILABILITY_ZONE -CONTAINER_NAME = ResourceAttributes.CONTAINER_NAME -CONTAINER_ID = ResourceAttributes.CONTAINER_ID -CONTAINER_IMAGE_NAME = ResourceAttributes.CONTAINER_IMAGE_NAME -CONTAINER_IMAGE_TAG = ResourceAttributes.CONTAINER_IMAGE_TAG -DEPLOYMENT_ENVIRONMENT = ResourceAttributes.DEPLOYMENT_ENVIRONMENT -FAAS_NAME = ResourceAttributes.FAAS_NAME -FAAS_ID = ResourceAttributes.FAAS_ID -FAAS_VERSION = ResourceAttributes.FAAS_VERSION -FAAS_INSTANCE = ResourceAttributes.FAAS_INSTANCE -HOST_NAME = ResourceAttributes.HOST_NAME -HOST_TYPE = ResourceAttributes.HOST_TYPE -HOST_IMAGE_NAME = ResourceAttributes.HOST_IMAGE_NAME -HOST_IMAGE_ID = ResourceAttributes.HOST_IMAGE_ID -HOST_IMAGE_VERSION = ResourceAttributes.HOST_IMAGE_VERSION -KUBERNETES_CLUSTER_NAME = ResourceAttributes.K8S_CLUSTER_NAME -KUBERNETES_NAMESPACE_NAME = ResourceAttributes.K8S_NAMESPACE_NAME -KUBERNETES_POD_UID = ResourceAttributes.K8S_POD_UID -KUBERNETES_POD_NAME = ResourceAttributes.K8S_POD_NAME -KUBERNETES_CONTAINER_NAME = ResourceAttributes.K8S_CONTAINER_NAME -KUBERNETES_REPLICA_SET_UID = ResourceAttributes.K8S_REPLICASET_UID -KUBERNETES_REPLICA_SET_NAME = ResourceAttributes.K8S_REPLICASET_NAME -KUBERNETES_DEPLOYMENT_UID = ResourceAttributes.K8S_DEPLOYMENT_UID -KUBERNETES_DEPLOYMENT_NAME = ResourceAttributes.K8S_DEPLOYMENT_NAME -KUBERNETES_STATEFUL_SET_UID = ResourceAttributes.K8S_STATEFULSET_UID -KUBERNETES_STATEFUL_SET_NAME = ResourceAttributes.K8S_STATEFULSET_NAME -KUBERNETES_DAEMON_SET_UID = ResourceAttributes.K8S_DAEMONSET_UID -KUBERNETES_DAEMON_SET_NAME = ResourceAttributes.K8S_DAEMONSET_NAME -KUBERNETES_JOB_UID = ResourceAttributes.K8S_JOB_UID -KUBERNETES_JOB_NAME = ResourceAttributes.K8S_JOB_NAME -KUBERNETES_CRON_JOB_UID = ResourceAttributes.K8S_CRONJOB_UID -KUBERNETES_CRON_JOB_NAME = ResourceAttributes.K8S_CRONJOB_NAME -OS_TYPE = ResourceAttributes.OS_TYPE -OS_DESCRIPTION = ResourceAttributes.OS_DESCRIPTION -PROCESS_PID = ResourceAttributes.PROCESS_PID -PROCESS_EXECUTABLE_NAME = ResourceAttributes.PROCESS_EXECUTABLE_NAME -PROCESS_EXECUTABLE_PATH = ResourceAttributes.PROCESS_EXECUTABLE_PATH -PROCESS_COMMAND = ResourceAttributes.PROCESS_COMMAND -PROCESS_COMMAND_LINE = ResourceAttributes.PROCESS_COMMAND_LINE -PROCESS_COMMAND_ARGS = ResourceAttributes.PROCESS_COMMAND_ARGS -PROCESS_OWNER = ResourceAttributes.PROCESS_OWNER -PROCESS_RUNTIME_NAME = ResourceAttributes.PROCESS_RUNTIME_NAME -PROCESS_RUNTIME_VERSION = ResourceAttributes.PROCESS_RUNTIME_VERSION -PROCESS_RUNTIME_DESCRIPTION = ResourceAttributes.PROCESS_RUNTIME_DESCRIPTION -SERVICE_NAME = ResourceAttributes.SERVICE_NAME -SERVICE_NAMESPACE = ResourceAttributes.SERVICE_NAMESPACE -SERVICE_INSTANCE_ID = ResourceAttributes.SERVICE_INSTANCE_ID -SERVICE_VERSION = ResourceAttributes.SERVICE_VERSION -TELEMETRY_SDK_NAME = ResourceAttributes.TELEMETRY_SDK_NAME -TELEMETRY_SDK_VERSION = ResourceAttributes.TELEMETRY_SDK_VERSION -TELEMETRY_AUTO_VERSION = ResourceAttributes.TELEMETRY_AUTO_VERSION -TELEMETRY_SDK_LANGUAGE = ResourceAttributes.TELEMETRY_SDK_LANGUAGE - - -_OPENTELEMETRY_SDK_VERSION = pkg_resources.get_distribution( - "opentelemetry-sdk" -).version - - -class Resource: - """A Resource is an immutable representation of the entity producing telemetry as Attributes.""" - - def __init__( - self, attributes: Attributes, schema_url: typing.Optional[str] = None - ): - self._attributes = BoundedAttributes(attributes=attributes) - if schema_url is None: - schema_url = "" - self._schema_url = schema_url - - @staticmethod - def create( - attributes: typing.Optional[Attributes] = None, - schema_url: typing.Optional[str] = None, - ) -> "Resource": - """Creates a new `Resource` from attributes. - - Args: - attributes: Optional zero or more key-value pairs. - schema_url: Optional URL pointing to the schema - - Returns: - The newly-created Resource. - """ - if not attributes: - attributes = {} - resource = _DEFAULT_RESOURCE.merge( - OTELResourceDetector().detect() - ).merge(Resource(attributes, schema_url)) - if not resource.attributes.get(SERVICE_NAME, None): - default_service_name = "unknown_service" - process_executable_name = resource.attributes.get( - PROCESS_EXECUTABLE_NAME, None - ) - if process_executable_name: - default_service_name += ":" + process_executable_name - resource = resource.merge( - Resource({SERVICE_NAME: default_service_name}, schema_url) - ) - return resource - - @staticmethod - def get_empty() -> "Resource": - return _EMPTY_RESOURCE - - @property - def attributes(self) -> Attributes: - return self._attributes - - @property - def schema_url(self) -> str: - return self._schema_url - - def merge(self, other: "Resource") -> "Resource": - """Merges this resource and an updating resource into a new `Resource`. - - If a key exists on both the old and updating resource, the value of the - updating resource will override the old resource value. - - The updating resource's `schema_url` will be used only if the old - `schema_url` is empty. Attempting to merge two resources with - different, non-empty values for `schema_url` will result in an error - and return the old resource. - - Args: - other: The other resource to be merged. - - Returns: - The newly-created Resource. - """ - merged_attributes = self.attributes.copy() - merged_attributes.update(other.attributes) - - if self.schema_url == "": - schema_url = other.schema_url - elif other.schema_url == "": - schema_url = self.schema_url - elif self.schema_url == other.schema_url: - schema_url = other.schema_url - else: - logger.error( - "Failed to merge resources: The two schemas %s and %s are incompatible", - self.schema_url, - other.schema_url, - ) - return self - - return Resource(merged_attributes, schema_url) - - def __eq__(self, other: object) -> bool: - if not isinstance(other, Resource): - return False - return ( - self._attributes == other._attributes - and self._schema_url == other._schema_url - ) - - def __hash__(self): - return hash( - f"{dumps(self._attributes.copy(), sort_keys=True)}|{self._schema_url}" - ) - - def to_json(self, indent=4) -> str: - return dumps( - { - "attributes": dict(self._attributes), - "schema_url": self._schema_url, - }, - indent=indent, - ) - - -_EMPTY_RESOURCE = Resource({}) -_DEFAULT_RESOURCE = Resource( - { - TELEMETRY_SDK_LANGUAGE: "python", - TELEMETRY_SDK_NAME: "opentelemetry", - TELEMETRY_SDK_VERSION: _OPENTELEMETRY_SDK_VERSION, - } -) - - -class ResourceDetector(abc.ABC): - def __init__(self, raise_on_error=False): - self.raise_on_error = raise_on_error - - @abc.abstractmethod - def detect(self) -> "Resource": - raise NotImplementedError() - - -class OTELResourceDetector(ResourceDetector): - # pylint: disable=no-self-use - def detect(self) -> "Resource": - env_resources_items = os.environ.get(OTEL_RESOURCE_ATTRIBUTES) - env_resource_map = {} - - if env_resources_items: - for item in env_resources_items.split(","): - try: - key, value = item.split("=", maxsplit=1) - except ValueError as exc: - logger.warning( - "Invalid key value resource attribute pair %s: %s", - item, - exc, - ) - continue - env_resource_map[key.strip()] = value.strip() - - service_name = os.environ.get(OTEL_SERVICE_NAME) - if service_name: - env_resource_map[SERVICE_NAME] = service_name - return Resource(env_resource_map) - - -class ProcessResourceDetector(ResourceDetector): - # pylint: disable=no-self-use - def detect(self) -> "Resource": - _runtime_version = ".".join( - map( - str, - sys.version_info[:3] - if sys.version_info.releaselevel == "final" - and not sys.version_info.serial - else sys.version_info, - ) - ) - - return Resource( - { - PROCESS_RUNTIME_DESCRIPTION: sys.version, - PROCESS_RUNTIME_NAME: sys.implementation.name, - PROCESS_RUNTIME_VERSION: _runtime_version, - } - ) - - -def get_aggregated_resources( - detectors: typing.List["ResourceDetector"], - initial_resource: typing.Optional[Resource] = None, - timeout=5, -) -> "Resource": - """Retrieves resources from detectors in the order that they were passed - - :param detectors: List of resources in order of priority - :param initial_resource: Static resource. This has highest priority - :param timeout: Number of seconds to wait for each detector to return - :return: - """ - detectors_merged_resource = initial_resource or Resource.create() - - with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor: - futures = [executor.submit(detector.detect) for detector in detectors] - for detector_ind, future in enumerate(futures): - detector = detectors[detector_ind] - try: - detected_resource = future.result(timeout=timeout) - # pylint: disable=broad-except - except Exception as ex: - detected_resource = _EMPTY_RESOURCE - if detector.raise_on_error: - raise ex - logger.warning( - "Exception %s in detector %s, ignoring", ex, detector - ) - finally: - detectors_merged_resource = detectors_merged_resource.merge( - detected_resource - ) - - return detectors_merged_resource diff --git a/opensafely/_vendor/opentelemetry/sdk/trace/__init__.py b/opensafely/_vendor/opentelemetry/sdk/trace/__init__.py deleted file mode 100644 index 8744d166..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/trace/__init__.py +++ /dev/null @@ -1,1210 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=too-many-lines -import abc -import atexit -import concurrent.futures -import json -import logging -import threading -import traceback -import typing -from collections import OrderedDict -from contextlib import contextmanager -from os import environ -from types import MappingProxyType, TracebackType -from typing import ( - Any, - Callable, - Dict, - Iterator, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from opensafely._vendor.deprecated import deprecated - -from opensafely._vendor.opentelemetry import context as context_api -from opensafely._vendor.opentelemetry import trace as trace_api -from opensafely._vendor.opentelemetry.attributes import BoundedAttributes -from opensafely._vendor.opentelemetry.sdk import util -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - OTEL_ATTRIBUTE_COUNT_LIMIT, - OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, - OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT, - OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, - OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, - OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, - OTEL_SPAN_EVENT_COUNT_LIMIT, - OTEL_SPAN_LINK_COUNT_LIMIT, -) -from opensafely._vendor.opentelemetry.sdk.resources import Resource -from opensafely._vendor.opentelemetry.sdk.trace import sampling -from opensafely._vendor.opentelemetry.sdk.trace.id_generator import IdGenerator, RandomIdGenerator -from opensafely._vendor.opentelemetry.sdk.util import BoundedList -from opensafely._vendor.opentelemetry.sdk.util.instrumentation import ( - InstrumentationInfo, - InstrumentationScope, -) -from opensafely._vendor.opentelemetry.trace import SpanContext -from opensafely._vendor.opentelemetry.trace.status import Status, StatusCode -from opensafely._vendor.opentelemetry.util import types -from opensafely._vendor.opentelemetry.util._time import _time_ns - -logger = logging.getLogger(__name__) - -_DEFAULT_OTEL_ATTRIBUTE_COUNT_LIMIT = 128 -_DEFAULT_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT = 128 -_DEFAULT_OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT = 128 -_DEFAULT_OTEL_LINK_ATTRIBUTE_COUNT_LIMIT = 128 -_DEFAULT_OTEL_SPAN_EVENT_COUNT_LIMIT = 128 -_DEFAULT_OTEL_SPAN_LINK_COUNT_LIMIT = 128 - - -_ENV_VALUE_UNSET = "" - -# pylint: disable=protected-access -_TRACE_SAMPLER = sampling._get_from_env_or_default() - - -class SpanProcessor: - """Interface which allows hooks for SDK's `Span` start and end method - invocations. - - Span processors can be registered directly using - :func:`TracerProvider.add_span_processor` and they are invoked - in the same order as they were registered. - """ - - def on_start( - self, - span: "Span", - parent_context: Optional[context_api.Context] = None, - ) -> None: - """Called when a :class:`opentelemetry.trace.Span` is started. - - This method is called synchronously on the thread that starts the - span, therefore it should not block or throw an exception. - - Args: - span: The :class:`opentelemetry.trace.Span` that just started. - parent_context: The parent context of the span that just started. - """ - - def on_end(self, span: "ReadableSpan") -> None: - """Called when a :class:`opentelemetry.trace.Span` is ended. - - This method is called synchronously on the thread that ends the - span, therefore it should not block or throw an exception. - - Args: - span: The :class:`opentelemetry.trace.Span` that just ended. - """ - - def shutdown(self) -> None: - """Called when a :class:`opentelemetry.sdk.trace.TracerProvider` is shutdown.""" - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Export all ended spans to the configured Exporter that have not yet - been exported. - - Args: - timeout_millis: The maximum amount of time to wait for spans to be - exported. - - Returns: - False if the timeout is exceeded, True otherwise. - """ - - -# Temporary fix until https://github.com/PyCQA/pylint/issues/4098 is resolved -# pylint:disable=no-member -class SynchronousMultiSpanProcessor(SpanProcessor): - """Implementation of class:`SpanProcessor` that forwards all received - events to a list of span processors sequentially. - - The underlying span processors are called in sequential order as they were - added. - """ - - def __init__(self): - # use a tuple to avoid race conditions when adding a new span and - # iterating through it on "on_start" and "on_end". - self._span_processors = () # type: Tuple[SpanProcessor, ...] - self._lock = threading.Lock() - - def add_span_processor(self, span_processor: SpanProcessor) -> None: - """Adds a SpanProcessor to the list handled by this instance.""" - with self._lock: - self._span_processors += (span_processor,) - - def on_start( - self, - span: "Span", - parent_context: Optional[context_api.Context] = None, - ) -> None: - for sp in self._span_processors: - sp.on_start(span, parent_context=parent_context) - - def on_end(self, span: "ReadableSpan") -> None: - for sp in self._span_processors: - sp.on_end(span) - - def shutdown(self) -> None: - """Sequentially shuts down all underlying span processors.""" - for sp in self._span_processors: - sp.shutdown() - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Sequentially calls force_flush on all underlying - :class:`SpanProcessor` - - Args: - timeout_millis: The maximum amount of time over all span processors - to wait for spans to be exported. In case the first n span - processors exceeded the timeout followup span processors will be - skipped. - - Returns: - True if all span processors flushed their spans within the - given timeout, False otherwise. - """ - deadline_ns = _time_ns() + timeout_millis * 1000000 - for sp in self._span_processors: - current_time_ns = _time_ns() - if current_time_ns >= deadline_ns: - return False - - if not sp.force_flush((deadline_ns - current_time_ns) // 1000000): - return False - - return True - - -class ConcurrentMultiSpanProcessor(SpanProcessor): - """Implementation of :class:`SpanProcessor` that forwards all received - events to a list of span processors in parallel. - - Calls to the underlying span processors are forwarded in parallel by - submitting them to a thread pool executor and waiting until each span - processor finished its work. - - Args: - num_threads: The number of threads managed by the thread pool executor - and thus defining how many span processors can work in parallel. - """ - - def __init__(self, num_threads: int = 2): - # use a tuple to avoid race conditions when adding a new span and - # iterating through it on "on_start" and "on_end". - self._span_processors = () # type: Tuple[SpanProcessor, ...] - self._lock = threading.Lock() - self._executor = concurrent.futures.ThreadPoolExecutor( - max_workers=num_threads - ) - - def add_span_processor(self, span_processor: SpanProcessor) -> None: - """Adds a SpanProcessor to the list handled by this instance.""" - with self._lock: - self._span_processors += (span_processor,) - - def _submit_and_await( - self, - func: Callable[[SpanProcessor], Callable[..., None]], - *args: Any, - **kwargs: Any, - ): - futures = [] - for sp in self._span_processors: - future = self._executor.submit(func(sp), *args, **kwargs) - futures.append(future) - for future in futures: - future.result() - - def on_start( - self, - span: "Span", - parent_context: Optional[context_api.Context] = None, - ) -> None: - self._submit_and_await( - lambda sp: sp.on_start, span, parent_context=parent_context - ) - - def on_end(self, span: "ReadableSpan") -> None: - self._submit_and_await(lambda sp: sp.on_end, span) - - def shutdown(self) -> None: - """Shuts down all underlying span processors in parallel.""" - self._submit_and_await(lambda sp: sp.shutdown) - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Calls force_flush on all underlying span processors in parallel. - - Args: - timeout_millis: The maximum amount of time to wait for spans to be - exported. - - Returns: - True if all span processors flushed their spans within the given - timeout, False otherwise. - """ - futures = [] - for sp in self._span_processors: # type: SpanProcessor - future = self._executor.submit(sp.force_flush, timeout_millis) - futures.append(future) - - timeout_sec = timeout_millis / 1e3 - done_futures, not_done_futures = concurrent.futures.wait( - futures, timeout_sec - ) - if not_done_futures: - return False - - for future in done_futures: - if not future.result(): - return False - - return True - - -class EventBase(abc.ABC): - def __init__(self, name: str, timestamp: Optional[int] = None) -> None: - self._name = name - if timestamp is None: - self._timestamp = _time_ns() - else: - self._timestamp = timestamp - - @property - def name(self) -> str: - return self._name - - @property - def timestamp(self) -> int: - return self._timestamp - - @property - @abc.abstractmethod - def attributes(self) -> types.Attributes: - pass - - -class Event(EventBase): - """A text annotation with a set of attributes. The attributes of an event - are immutable. - - Args: - name: Name of the event. - attributes: Attributes of the event. - timestamp: Timestamp of the event. If `None` it will filled - automatically. - """ - - def __init__( - self, - name: str, - attributes: types.Attributes = None, - timestamp: Optional[int] = None, - limit: Optional[int] = _DEFAULT_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, - ) -> None: - super().__init__(name, timestamp) - self._attributes = attributes - - @property - def attributes(self) -> types.Attributes: - return self._attributes - - -def _check_span_ended(func): - def wrapper(self, *args, **kwargs): - already_ended = False - with self._lock: # pylint: disable=protected-access - if self._end_time is None: - func(self, *args, **kwargs) - else: - already_ended = True - - if already_ended: - logger.warning("Tried calling %s on an ended span.", func.__name__) - - return wrapper - - -class ReadableSpan: - """Provides read-only access to span attributes""" - - def __init__( - self, - name: str = None, - context: trace_api.SpanContext = None, - parent: Optional[trace_api.SpanContext] = None, - resource: Resource = Resource.create({}), - attributes: types.Attributes = None, - events: Sequence[Event] = (), - links: Sequence[trace_api.Link] = (), - kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL, - instrumentation_info: InstrumentationInfo = None, - status: Status = Status(StatusCode.UNSET), - start_time: Optional[int] = None, - end_time: Optional[int] = None, - instrumentation_scope: InstrumentationScope = None, - ) -> None: - self._name = name - self._context = context - self._kind = kind - self._instrumentation_info = instrumentation_info - self._instrumentation_scope = instrumentation_scope - self._parent = parent - self._start_time = start_time - self._end_time = end_time - self._attributes = attributes - self._events = events - self._links = links - self._resource = resource - self._status = status - - @property - def dropped_attributes(self) -> int: - if self._attributes: - return self._attributes.dropped - return 0 - - @property - def dropped_events(self) -> int: - if self._events: - return self._events.dropped - return 0 - - @property - def dropped_links(self) -> int: - if self._links: - return self._links.dropped - return 0 - - @property - def name(self) -> str: - return self._name - - def get_span_context(self): - return self._context - - @property - def context(self): - return self._context - - @property - def kind(self) -> trace_api.SpanKind: - return self._kind - - @property - def parent(self) -> Optional[trace_api.SpanContext]: - return self._parent - - @property - def start_time(self) -> Optional[int]: - return self._start_time - - @property - def end_time(self) -> Optional[int]: - return self._end_time - - @property - def status(self) -> trace_api.Status: - return self._status - - @property - def attributes(self) -> types.Attributes: - return MappingProxyType(self._attributes) - - @property - def events(self) -> Sequence[Event]: - return tuple(event for event in self._events) - - @property - def links(self) -> Sequence[trace_api.Link]: - return tuple(link for link in self._links) - - @property - def resource(self) -> Resource: - return self._resource - - @property - @deprecated( - version="1.11.1", reason="You should use instrumentation_scope" - ) - def instrumentation_info(self) -> InstrumentationInfo: - return self._instrumentation_info - - @property - def instrumentation_scope(self) -> InstrumentationScope: - return self._instrumentation_scope - - def to_json(self, indent=4): - parent_id = None - if self.parent is not None: - if isinstance(self.parent, Span): - ctx = self.parent.context - parent_id = f"0x{trace_api.format_span_id(ctx.span_id)}" - elif isinstance(self.parent, SpanContext): - parent_id = ( - f"0x{trace_api.format_span_id(self.parent.span_id)}" - ) - - start_time = None - if self._start_time: - start_time = util.ns_to_iso_str(self._start_time) - - end_time = None - if self._end_time: - end_time = util.ns_to_iso_str(self._end_time) - - if self._status is not None: - status = OrderedDict() - status["status_code"] = str(self._status.status_code.name) - if self._status.description: - status["description"] = self._status.description - - f_span = OrderedDict() - - f_span["name"] = self._name - f_span["context"] = self._format_context(self._context) - f_span["kind"] = str(self.kind) - f_span["parent_id"] = parent_id - f_span["start_time"] = start_time - f_span["end_time"] = end_time - if self._status is not None: - f_span["status"] = status - f_span["attributes"] = self._format_attributes(self._attributes) - f_span["events"] = self._format_events(self._events) - f_span["links"] = self._format_links(self._links) - f_span["resource"] = json.loads(self.resource.to_json()) - - return json.dumps(f_span, indent=indent) - - @staticmethod - def _format_context(context): - x_ctx = OrderedDict() - x_ctx["trace_id"] = f"0x{trace_api.format_trace_id(context.trace_id)}" - x_ctx["span_id"] = f"0x{trace_api.format_span_id(context.span_id)}" - x_ctx["trace_state"] = repr(context.trace_state) - return x_ctx - - @staticmethod - def _format_attributes(attributes): - if isinstance(attributes, BoundedAttributes): - return attributes._dict # pylint: disable=protected-access - if isinstance(attributes, MappingProxyType): - return attributes.copy() - return attributes - - @staticmethod - def _format_events(events): - f_events = [] - for event in events: - f_event = OrderedDict() - f_event["name"] = event.name - f_event["timestamp"] = util.ns_to_iso_str(event.timestamp) - f_event["attributes"] = Span._format_attributes(event.attributes) - f_events.append(f_event) - return f_events - - @staticmethod - def _format_links(links): - f_links = [] - for link in links: - f_link = OrderedDict() - f_link["context"] = Span._format_context(link.context) - f_link["attributes"] = Span._format_attributes(link.attributes) - f_links.append(f_link) - return f_links - - -class SpanLimits: - """The limits that should be enforce on recorded data such as events, links, attributes etc. - - This class does not enforce any limits itself. It only provides an a way read limits from env, - default values and from user provided arguments. - - All limit arguments must be either a non-negative integer, ``None`` or ``SpanLimits.UNSET``. - - - All limit arguments are optional. - - If a limit argument is not set, the class will try to read its value from the corresponding - environment variable. - - If the environment variable is not set, the default value, if any, will be used. - - Limit precedence: - - - If a model specific limit is set, it will be used. - - Else if the corresponding global limit is set, it will be used. - - Else if the model specific limit has a default value, the default value will be used. - - Else if the global limit has a default value, the default value will be used. - - Args: - max_attributes: Maximum number of attributes that can be added to a span, event, and link. - Environment variable: OTEL_ATTRIBUTE_COUNT_LIMIT - Default: {_DEFAULT_ATTRIBUTE_COUNT_LIMIT} - max_events: Maximum number of events that can be added to a Span. - Environment variable: OTEL_SPAN_EVENT_COUNT_LIMIT - Default: {_DEFAULT_SPAN_EVENT_COUNT_LIMIT} - max_links: Maximum number of links that can be added to a Span. - Environment variable: OTEL_SPAN_LINK_COUNT_LIMIT - Default: {_DEFAULT_SPAN_LINK_COUNT_LIMIT} - max_span_attributes: Maximum number of attributes that can be added to a Span. - Environment variable: OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT - Default: {_DEFAULT_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT} - max_event_attributes: Maximum number of attributes that can be added to an Event. - Default: {_DEFAULT_OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT} - max_link_attributes: Maximum number of attributes that can be added to a Link. - Default: {_DEFAULT_OTEL_LINK_ATTRIBUTE_COUNT_LIMIT} - max_attribute_length: Maximum length an attribute value can have. Values longer than - the specified length will be truncated. - max_span_attribute_length: Maximum length a span attribute value can have. Values longer than - the specified length will be truncated. - """ - - UNSET = -1 - - def __init__( - self, - max_attributes: Optional[int] = None, - max_events: Optional[int] = None, - max_links: Optional[int] = None, - max_span_attributes: Optional[int] = None, - max_event_attributes: Optional[int] = None, - max_link_attributes: Optional[int] = None, - max_attribute_length: Optional[int] = None, - max_span_attribute_length: Optional[int] = None, - ): - - # span events and links count - self.max_events = self._from_env_if_absent( - max_events, - OTEL_SPAN_EVENT_COUNT_LIMIT, - _DEFAULT_OTEL_SPAN_EVENT_COUNT_LIMIT, - ) - self.max_links = self._from_env_if_absent( - max_links, - OTEL_SPAN_LINK_COUNT_LIMIT, - _DEFAULT_OTEL_SPAN_LINK_COUNT_LIMIT, - ) - - # attribute count - global_max_attributes = self._from_env_if_absent( - max_attributes, OTEL_ATTRIBUTE_COUNT_LIMIT - ) - self.max_attributes = ( - global_max_attributes - if global_max_attributes is not None - else _DEFAULT_OTEL_ATTRIBUTE_COUNT_LIMIT - ) - - self.max_span_attributes = self._from_env_if_absent( - max_span_attributes, - OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, - global_max_attributes - if global_max_attributes is not None - else _DEFAULT_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, - ) - self.max_event_attributes = self._from_env_if_absent( - max_event_attributes, - OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT, - global_max_attributes - if global_max_attributes is not None - else _DEFAULT_OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT, - ) - self.max_link_attributes = self._from_env_if_absent( - max_link_attributes, - OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, - global_max_attributes - if global_max_attributes is not None - else _DEFAULT_OTEL_LINK_ATTRIBUTE_COUNT_LIMIT, - ) - - # attribute length - self.max_attribute_length = self._from_env_if_absent( - max_attribute_length, - OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, - ) - self.max_span_attribute_length = self._from_env_if_absent( - max_span_attribute_length, - OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, - # use global attribute length limit as default - self.max_attribute_length, - ) - - def __repr__(self): - return f"{type(self).__name__}(max_span_attributes={self.max_span_attributes}, max_events_attributes={self.max_event_attributes}, max_link_attributes={self.max_link_attributes}, max_attributes={self.max_attributes}, max_events={self.max_events}, max_links={self.max_links}, max_attribute_length={self.max_attribute_length})" - - @classmethod - def _from_env_if_absent( - cls, value: Optional[int], env_var: str, default: Optional[int] = None - ) -> Optional[int]: - if value == cls.UNSET: - return None - - err_msg = "{0} must be a non-negative integer but got {}" - - # if no value is provided for the limit, try to load it from env - if value is None: - # return default value if env var is not set - if env_var not in environ: - return default - - str_value = environ.get(env_var, "").strip().lower() - if str_value == _ENV_VALUE_UNSET: - return None - - try: - value = int(str_value) - except ValueError: - raise ValueError(err_msg.format(env_var, str_value)) - - if value < 0: - raise ValueError(err_msg.format(env_var, value)) - return value - - -_UnsetLimits = SpanLimits( - max_attributes=SpanLimits.UNSET, - max_events=SpanLimits.UNSET, - max_links=SpanLimits.UNSET, - max_span_attributes=SpanLimits.UNSET, - max_event_attributes=SpanLimits.UNSET, - max_link_attributes=SpanLimits.UNSET, - max_attribute_length=SpanLimits.UNSET, - max_span_attribute_length=SpanLimits.UNSET, -) - -# not removed for backward compat. please use SpanLimits instead. -SPAN_ATTRIBUTE_COUNT_LIMIT = SpanLimits._from_env_if_absent( - None, - OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, - _DEFAULT_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, -) - - -class Span(trace_api.Span, ReadableSpan): - """See `opentelemetry.trace.Span`. - - Users should create `Span` objects via the `Tracer` instead of this - constructor. - - Args: - name: The name of the operation this span represents - context: The immutable span context - parent: This span's parent's `opentelemetry.trace.SpanContext`, or - None if this is a root span - sampler: The sampler used to create this span - trace_config: TODO - resource: Entity producing telemetry - attributes: The span's attributes to be exported - events: Timestamped events to be exported - links: Links to other spans to be exported - span_processor: `SpanProcessor` to invoke when starting and ending - this `Span`. - limits: `SpanLimits` instance that was passed to the `TracerProvider` - """ - - def __new__(cls, *args, **kwargs): - if cls is Span: - raise TypeError("Span must be instantiated via a tracer.") - return super().__new__(cls) - - # pylint: disable=too-many-locals - def __init__( - self, - name: str, - context: trace_api.SpanContext, - parent: Optional[trace_api.SpanContext] = None, - sampler: Optional[sampling.Sampler] = None, - trace_config: None = None, # TODO - resource: Resource = Resource.create({}), - attributes: types.Attributes = None, - events: Sequence[Event] = None, - links: Sequence[trace_api.Link] = (), - kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL, - span_processor: SpanProcessor = SpanProcessor(), - instrumentation_info: InstrumentationInfo = None, - record_exception: bool = True, - set_status_on_exception: bool = True, - limits=_UnsetLimits, - instrumentation_scope: InstrumentationScope = None, - ) -> None: - super().__init__( - name=name, - context=context, - parent=parent, - kind=kind, - resource=resource, - instrumentation_info=instrumentation_info, - instrumentation_scope=instrumentation_scope, - ) - self._sampler = sampler - self._trace_config = trace_config - self._record_exception = record_exception - self._set_status_on_exception = set_status_on_exception - self._span_processor = span_processor - self._limits = limits - self._lock = threading.Lock() - self._attributes = BoundedAttributes( - self._limits.max_span_attributes, - attributes, - immutable=False, - max_value_len=self._limits.max_span_attribute_length, - ) - self._events = self._new_events() - if events: - for event in events: - event._attributes = BoundedAttributes( - self._limits.max_event_attributes, - event.attributes, - max_value_len=self._limits.max_attribute_length, - ) - self._events.append(event) - - if links is None: - self._links = self._new_links() - else: - for link in links: - link._attributes = BoundedAttributes( - self._limits.max_link_attributes, - link.attributes, - max_value_len=self._limits.max_attribute_length, - ) - self._links = BoundedList.from_seq(self._limits.max_links, links) - - def __repr__(self): - return f'{type(self).__name__}(name="{self._name}", context={self._context})' - - def _new_events(self): - return BoundedList(self._limits.max_events) - - def _new_links(self): - return BoundedList(self._limits.max_links) - - def get_span_context(self): - return self._context - - def set_attributes( - self, attributes: Dict[str, types.AttributeValue] - ) -> None: - with self._lock: - if self._end_time is not None: - logger.warning("Setting attribute on ended span.") - return - - for key, value in attributes.items(): - self._attributes[key] = value - - def set_attribute(self, key: str, value: types.AttributeValue) -> None: - return self.set_attributes({key: value}) - - @_check_span_ended - def _add_event(self, event: EventBase) -> None: - self._events.append(event) - - def add_event( - self, - name: str, - attributes: types.Attributes = None, - timestamp: Optional[int] = None, - ) -> None: - attributes = BoundedAttributes( - self._limits.max_event_attributes, - attributes, - max_value_len=self._limits.max_attribute_length, - ) - self._add_event( - Event( - name=name, - attributes=attributes, - timestamp=timestamp, - ) - ) - - def _readable_span(self) -> ReadableSpan: - return ReadableSpan( - name=self._name, - context=self._context, - parent=self._parent, - resource=self._resource, - attributes=self._attributes, - events=self._events, - links=self._links, - kind=self.kind, - status=self._status, - start_time=self._start_time, - end_time=self._end_time, - instrumentation_info=self._instrumentation_info, - instrumentation_scope=self._instrumentation_scope, - ) - - def start( - self, - start_time: Optional[int] = None, - parent_context: Optional[context_api.Context] = None, - ) -> None: - with self._lock: - if self._start_time is not None: - logger.warning("Calling start() on a started span.") - return - self._start_time = ( - start_time if start_time is not None else _time_ns() - ) - - self._span_processor.on_start(self, parent_context=parent_context) - - def end(self, end_time: Optional[int] = None) -> None: - with self._lock: - if self._start_time is None: - raise RuntimeError("Calling end() on a not started span.") - if self._end_time is not None: - logger.warning("Calling end() on an ended span.") - return - - self._end_time = end_time if end_time is not None else _time_ns() - - self._span_processor.on_end(self._readable_span()) - - @_check_span_ended - def update_name(self, name: str) -> None: - self._name = name - - def is_recording(self) -> bool: - return self._end_time is None - - @_check_span_ended - def set_status( - self, - status: typing.Union[Status, StatusCode], - description: typing.Optional[str] = None, - ) -> None: - # Ignore future calls if status is already set to OK - # Ignore calls to set to StatusCode.UNSET - if isinstance(status, Status): - if ( - self._status - and self._status.status_code is StatusCode.OK - or status.status_code is StatusCode.UNSET - ): - return - if description is not None: - logger.warning( - "Description %s ignored. Use either `Status` or `(StatusCode, Description)`", - description, - ) - self._status = status - elif isinstance(status, StatusCode): - if ( - self._status - and self._status.status_code is StatusCode.OK - or status is StatusCode.UNSET - ): - return - self._status = Status(status, description) - - def __exit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> None: - """Ends context manager and calls `end` on the `Span`.""" - if exc_val is not None and self.is_recording(): - # Record the exception as an event - # pylint:disable=protected-access - if self._record_exception: - self.record_exception(exception=exc_val, escaped=True) - # Records status if span is used as context manager - # i.e. with tracer.start_span() as span: - if self._set_status_on_exception: - self.set_status( - Status( - status_code=StatusCode.ERROR, - description=f"{exc_type.__name__}: {exc_val}", - ) - ) - - super().__exit__(exc_type, exc_val, exc_tb) - - def record_exception( - self, - exception: Exception, - attributes: types.Attributes = None, - timestamp: Optional[int] = None, - escaped: bool = False, - ) -> None: - """Records an exception as a span event.""" - try: - stacktrace = traceback.format_exc() - except Exception: # pylint: disable=broad-except - # workaround for python 3.4, format_exc can raise - # an AttributeError if the __context__ on - # an exception is None - stacktrace = "Exception occurred on stacktrace formatting" - _attributes = { - "exception.type": exception.__class__.__name__, - "exception.message": str(exception), - "exception.stacktrace": stacktrace, - "exception.escaped": str(escaped), - } - if attributes: - _attributes.update(attributes) - self.add_event( - name="exception", attributes=_attributes, timestamp=timestamp - ) - - -class _Span(Span): - """Protected implementation of `opentelemetry.trace.Span`. - - This constructor exists to prevent the instantiation of the `Span` class - by other mechanisms than through the `Tracer`. - """ - - -class Tracer(trace_api.Tracer): - """See `opentelemetry.trace.Tracer`.""" - - def __init__( - self, - sampler: sampling.Sampler, - resource: Resource, - span_processor: Union[ - SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor - ], - id_generator: IdGenerator, - instrumentation_info: InstrumentationInfo, - span_limits: SpanLimits, - instrumentation_scope: InstrumentationScope, - ) -> None: - self.sampler = sampler - self.resource = resource - self.span_processor = span_processor - self.id_generator = id_generator - self.instrumentation_info = instrumentation_info - self._span_limits = span_limits - self._instrumentation_scope = instrumentation_scope - - @contextmanager - def start_as_current_span( - self, - name: str, - context: Optional[context_api.Context] = None, - kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL, - attributes: types.Attributes = None, - links: Sequence[trace_api.Link] = (), - start_time: Optional[int] = None, - record_exception: bool = True, - set_status_on_exception: bool = True, - end_on_exit: bool = True, - ) -> Iterator[trace_api.Span]: - span = self.start_span( - name=name, - context=context, - kind=kind, - attributes=attributes, - links=links, - start_time=start_time, - record_exception=record_exception, - set_status_on_exception=set_status_on_exception, - ) - with trace_api.use_span( - span, - end_on_exit=end_on_exit, - record_exception=record_exception, - set_status_on_exception=set_status_on_exception, - ) as span_context: - yield span_context - - def start_span( # pylint: disable=too-many-locals - self, - name: str, - context: Optional[context_api.Context] = None, - kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL, - attributes: types.Attributes = None, - links: Sequence[trace_api.Link] = (), - start_time: Optional[int] = None, - record_exception: bool = True, - set_status_on_exception: bool = True, - ) -> trace_api.Span: - - parent_span_context = trace_api.get_current_span( - context - ).get_span_context() - - if parent_span_context is not None and not isinstance( - parent_span_context, trace_api.SpanContext - ): - raise TypeError( - "parent_span_context must be a SpanContext or None." - ) - - # is_valid determines root span - if parent_span_context is None or not parent_span_context.is_valid: - parent_span_context = None - trace_id = self.id_generator.generate_trace_id() - else: - trace_id = parent_span_context.trace_id - - # The sampler decides whether to create a real or no-op span at the - # time of span creation. No-op spans do not record events, and are not - # exported. - # The sampler may also add attributes to the newly-created span, e.g. - # to include information about the sampling result. - # The sampler may also modify the parent span context's tracestate - sampling_result = self.sampler.should_sample( - context, trace_id, name, kind, attributes, links - ) - - trace_flags = ( - trace_api.TraceFlags(trace_api.TraceFlags.SAMPLED) - if sampling_result.decision.is_sampled() - else trace_api.TraceFlags(trace_api.TraceFlags.DEFAULT) - ) - span_context = trace_api.SpanContext( - trace_id, - self.id_generator.generate_span_id(), - is_remote=False, - trace_flags=trace_flags, - trace_state=sampling_result.trace_state, - ) - - # Only record if is_recording() is true - if sampling_result.decision.is_recording(): - # pylint:disable=protected-access - span = _Span( - name=name, - context=span_context, - parent=parent_span_context, - sampler=self.sampler, - resource=self.resource, - attributes=sampling_result.attributes.copy(), - span_processor=self.span_processor, - kind=kind, - links=links, - instrumentation_info=self.instrumentation_info, - record_exception=record_exception, - set_status_on_exception=set_status_on_exception, - limits=self._span_limits, - instrumentation_scope=self._instrumentation_scope, - ) - span.start(start_time=start_time, parent_context=context) - else: - span = trace_api.NonRecordingSpan(context=span_context) - return span - - -class TracerProvider(trace_api.TracerProvider): - """See `opentelemetry.trace.TracerProvider`.""" - - def __init__( - self, - sampler: sampling.Sampler = _TRACE_SAMPLER, - resource: Resource = Resource.create({}), - shutdown_on_exit: bool = True, - active_span_processor: Union[ - SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor - ] = None, - id_generator: IdGenerator = None, - span_limits: SpanLimits = None, - ): - self._active_span_processor = ( - active_span_processor or SynchronousMultiSpanProcessor() - ) - if id_generator is None: - self.id_generator = RandomIdGenerator() - else: - self.id_generator = id_generator - self._resource = resource - self.sampler = sampler - self._span_limits = span_limits or SpanLimits() - self._atexit_handler = None - - if shutdown_on_exit: - self._atexit_handler = atexit.register(self.shutdown) - - @property - def resource(self) -> Resource: - return self._resource - - def get_tracer( - self, - instrumenting_module_name: str, - instrumenting_library_version: typing.Optional[str] = None, - schema_url: typing.Optional[str] = None, - ) -> "trace_api.Tracer": - if not instrumenting_module_name: # Reject empty strings too. - instrumenting_module_name = "" - logger.error("get_tracer called with missing module name.") - if instrumenting_library_version is None: - instrumenting_library_version = "" - return Tracer( - self.sampler, - self.resource, - self._active_span_processor, - self.id_generator, - InstrumentationInfo( - instrumenting_module_name, - instrumenting_library_version, - schema_url, - ), - self._span_limits, - InstrumentationScope( - instrumenting_module_name, - instrumenting_library_version, - schema_url, - ), - ) - - def add_span_processor(self, span_processor: SpanProcessor) -> None: - """Registers a new :class:`SpanProcessor` for this `TracerProvider`. - - The span processors are invoked in the same order they are registered. - """ - - # no lock here because add_span_processor is thread safe for both - # SynchronousMultiSpanProcessor and ConcurrentMultiSpanProcessor. - self._active_span_processor.add_span_processor(span_processor) - - def shutdown(self): - """Shut down the span processors added to the tracer provider.""" - self._active_span_processor.shutdown() - if self._atexit_handler is not None: - atexit.unregister(self._atexit_handler) - self._atexit_handler = None - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Requests the active span processor to process all spans that have not - yet been processed. - - By default force flush is called sequentially on all added span - processors. This means that span processors further back in the list - have less time to flush their spans. - To have span processors flush their spans in parallel it is possible to - initialize the tracer provider with an instance of - `ConcurrentMultiSpanProcessor` at the cost of using multiple threads. - - Args: - timeout_millis: The maximum amount of time to wait for spans to be - processed. - - Returns: - False if the timeout is exceeded, True otherwise. - """ - return self._active_span_processor.force_flush(timeout_millis) diff --git a/opensafely/_vendor/opentelemetry/sdk/trace/export/__init__.py b/opensafely/_vendor/opentelemetry/sdk/trace/export/__init__.py deleted file mode 100644 index 8f7870ed..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/trace/export/__init__.py +++ /dev/null @@ -1,440 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 collections -import logging -import os -import sys -import threading -import typing -from enum import Enum -from os import environ, linesep -from typing import Optional - -from opensafely._vendor.opentelemetry.context import ( - _SUPPRESS_INSTRUMENTATION_KEY, - Context, - attach, - detach, - set_value, -) -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - OTEL_BSP_EXPORT_TIMEOUT, - OTEL_BSP_MAX_EXPORT_BATCH_SIZE, - OTEL_BSP_MAX_QUEUE_SIZE, - OTEL_BSP_SCHEDULE_DELAY, -) -from opensafely._vendor.opentelemetry.sdk.trace import ReadableSpan, Span, SpanProcessor -from opensafely._vendor.opentelemetry.util._once import Once -from opensafely._vendor.opentelemetry.util._time import _time_ns - -logger = logging.getLogger(__name__) - - -class SpanExportResult(Enum): - SUCCESS = 0 - FAILURE = 1 - - -class SpanExporter: - """Interface for exporting spans. - - Interface to be implemented by services that want to export spans recorded - in their own format. - - To export data this MUST be registered to the :class`opentelemetry.sdk.trace.Tracer` using a - `SimpleSpanProcessor` or a `BatchSpanProcessor`. - """ - - def export( - self, spans: typing.Sequence[ReadableSpan] - ) -> "SpanExportResult": - """Exports a batch of telemetry data. - - Args: - spans: The list of `opentelemetry.trace.Span` objects to be exported - - Returns: - The result of the export - """ - - def shutdown(self) -> None: - """Shuts down the exporter. - - Called when the SDK is shut down. - """ - - -class SimpleSpanProcessor(SpanProcessor): - """Simple SpanProcessor implementation. - - SimpleSpanProcessor is an implementation of `SpanProcessor` that - passes ended spans directly to the configured `SpanExporter`. - """ - - def __init__(self, span_exporter: SpanExporter): - self.span_exporter = span_exporter - - def on_start( - self, span: Span, parent_context: typing.Optional[Context] = None - ) -> None: - pass - - def on_end(self, span: ReadableSpan) -> None: - if not span.context.trace_flags.sampled: - return - token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)) - try: - self.span_exporter.export((span,)) - # pylint: disable=broad-except - except Exception: - logger.exception("Exception while exporting Span.") - detach(token) - - def shutdown(self) -> None: - self.span_exporter.shutdown() - - def force_flush(self, timeout_millis: int = 30000) -> bool: - # pylint: disable=unused-argument - return True - - -class _FlushRequest: - """Represents a request for the BatchSpanProcessor to flush spans.""" - - __slots__ = ["event", "num_spans"] - - def __init__(self): - self.event = threading.Event() - self.num_spans = 0 - - -_BSP_RESET_ONCE = Once() - - -class BatchSpanProcessor(SpanProcessor): - """Batch span processor implementation. - - `BatchSpanProcessor` is an implementation of `SpanProcessor` that - batches ended spans and pushes them to the configured `SpanExporter`. - - `BatchSpanProcessor` is configurable with the following environment - variables which correspond to constructor parameters: - - - :envvar:`OTEL_BSP_SCHEDULE_DELAY` - - :envvar:`OTEL_BSP_MAX_QUEUE_SIZE` - - :envvar:`OTEL_BSP_MAX_EXPORT_BATCH_SIZE` - - :envvar:`OTEL_BSP_EXPORT_TIMEOUT` - """ - - def __init__( - self, - span_exporter: SpanExporter, - max_queue_size: int = None, - schedule_delay_millis: float = None, - max_export_batch_size: int = None, - export_timeout_millis: float = None, - ): - - if max_queue_size is None: - max_queue_size = int(environ.get(OTEL_BSP_MAX_QUEUE_SIZE, 2048)) - - if schedule_delay_millis is None: - schedule_delay_millis = int( - environ.get(OTEL_BSP_SCHEDULE_DELAY, 5000) - ) - - if max_export_batch_size is None: - max_export_batch_size = int( - environ.get(OTEL_BSP_MAX_EXPORT_BATCH_SIZE, 512) - ) - - if export_timeout_millis is None: - export_timeout_millis = int( - environ.get(OTEL_BSP_EXPORT_TIMEOUT, 30000) - ) - - if max_queue_size <= 0: - raise ValueError("max_queue_size must be a positive integer.") - - if schedule_delay_millis <= 0: - raise ValueError("schedule_delay_millis must be positive.") - - if max_export_batch_size <= 0: - raise ValueError( - "max_export_batch_size must be a positive integer." - ) - - if max_export_batch_size > max_queue_size: - raise ValueError( - "max_export_batch_size must be less than or equal to max_queue_size." - ) - - self.span_exporter = span_exporter - self.queue = collections.deque( - [], max_queue_size - ) # type: typing.Deque[Span] - self.worker_thread = threading.Thread( - name="OtelBatchSpanProcessor", target=self.worker, daemon=True - ) - self.condition = threading.Condition(threading.Lock()) - self._flush_request = None # type: typing.Optional[_FlushRequest] - self.schedule_delay_millis = schedule_delay_millis - self.max_export_batch_size = max_export_batch_size - self.max_queue_size = max_queue_size - self.export_timeout_millis = export_timeout_millis - self.done = False - # flag that indicates that spans are being dropped - self._spans_dropped = False - # precallocated list to send spans to exporter - self.spans_list = [ - None - ] * self.max_export_batch_size # type: typing.List[typing.Optional[Span]] - self.worker_thread.start() - # Only available in *nix since py37. - if hasattr(os, "register_at_fork"): - os.register_at_fork( - after_in_child=self._at_fork_reinit - ) # pylint: disable=protected-access - self._pid = os.getpid() - - def on_start( - self, span: Span, parent_context: typing.Optional[Context] = None - ) -> None: - pass - - def on_end(self, span: ReadableSpan) -> None: - if self.done: - logger.warning("Already shutdown, dropping span.") - return - if not span.context.trace_flags.sampled: - return - if self._pid != os.getpid(): - _BSP_RESET_ONCE.do_once(self._at_fork_reinit) - - if len(self.queue) == self.max_queue_size: - if not self._spans_dropped: - logger.warning("Queue is full, likely spans will be dropped.") - self._spans_dropped = True - - self.queue.appendleft(span) - - if len(self.queue) >= self.max_export_batch_size: - with self.condition: - self.condition.notify() - - def _at_fork_reinit(self): - self.condition = threading.Condition(threading.Lock()) - self.queue.clear() - - # worker_thread is local to a process, only the thread that issued fork continues - # to exist. A new worker thread must be started in child process. - self.worker_thread = threading.Thread( - name="OtelBatchSpanProcessor", target=self.worker, daemon=True - ) - self.worker_thread.start() - self._pid = os.getpid() - - def worker(self): - timeout = self.schedule_delay_millis / 1e3 - flush_request = None # type: typing.Optional[_FlushRequest] - while not self.done: - with self.condition: - if self.done: - # done flag may have changed, avoid waiting - break - flush_request = self._get_and_unset_flush_request() - if ( - len(self.queue) < self.max_export_batch_size - and flush_request is None - ): - - self.condition.wait(timeout) - flush_request = self._get_and_unset_flush_request() - if not self.queue: - # spurious notification, let's wait again, reset timeout - timeout = self.schedule_delay_millis / 1e3 - self._notify_flush_request_finished(flush_request) - flush_request = None - continue - if self.done: - # missing spans will be sent when calling flush - break - - # subtract the duration of this export call to the next timeout - start = _time_ns() - self._export(flush_request) - end = _time_ns() - duration = (end - start) / 1e9 - timeout = self.schedule_delay_millis / 1e3 - duration - - self._notify_flush_request_finished(flush_request) - flush_request = None - - # there might have been a new flush request while export was running - # and before the done flag switched to true - with self.condition: - shutdown_flush_request = self._get_and_unset_flush_request() - - # be sure that all spans are sent - self._drain_queue() - self._notify_flush_request_finished(flush_request) - self._notify_flush_request_finished(shutdown_flush_request) - - def _get_and_unset_flush_request( - self, - ) -> typing.Optional[_FlushRequest]: - """Returns the current flush request and makes it invisible to the - worker thread for subsequent calls. - """ - flush_request = self._flush_request - self._flush_request = None - if flush_request is not None: - flush_request.num_spans = len(self.queue) - return flush_request - - @staticmethod - def _notify_flush_request_finished( - flush_request: typing.Optional[_FlushRequest], - ): - """Notifies the flush initiator(s) waiting on the given request/event - that the flush operation was finished. - """ - if flush_request is not None: - flush_request.event.set() - - def _get_or_create_flush_request(self) -> _FlushRequest: - """Either returns the current active flush event or creates a new one. - - The flush event will be visible and read by the worker thread before an - export operation starts. Callers of a flush operation may wait on the - returned event to be notified when the flush/export operation was - finished. - - This method is not thread-safe, i.e. callers need to take care about - synchronization/locking. - """ - if self._flush_request is None: - self._flush_request = _FlushRequest() - return self._flush_request - - def _export(self, flush_request: typing.Optional[_FlushRequest]): - """Exports spans considering the given flush_request. - - In case of a given flush_requests spans are exported in batches until - the number of exported spans reached or exceeded the number of spans in - the flush request. - In no flush_request was given at most max_export_batch_size spans are - exported. - """ - if not flush_request: - self._export_batch() - return - - num_spans = flush_request.num_spans - while self.queue: - num_exported = self._export_batch() - num_spans -= num_exported - - if num_spans <= 0: - break - - def _export_batch(self) -> int: - """Exports at most max_export_batch_size spans and returns the number of - exported spans. - """ - idx = 0 - # currently only a single thread acts as consumer, so queue.pop() will - # not raise an exception - while idx < self.max_export_batch_size and self.queue: - self.spans_list[idx] = self.queue.pop() - idx += 1 - token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)) - try: - # Ignore type b/c the Optional[None]+slicing is too "clever" - # for mypy - self.span_exporter.export(self.spans_list[:idx]) # type: ignore - except Exception: # pylint: disable=broad-except - logger.exception("Exception while exporting Span batch.") - detach(token) - - # clean up list - for index in range(idx): - self.spans_list[index] = None - return idx - - def _drain_queue(self): - """Export all elements until queue is empty. - - Can only be called from the worker thread context because it invokes - `export` that is not thread safe. - """ - while self.queue: - self._export_batch() - - def force_flush(self, timeout_millis: int = None) -> bool: - - if timeout_millis is None: - timeout_millis = self.export_timeout_millis - - if self.done: - logger.warning("Already shutdown, ignoring call to force_flush().") - return True - - with self.condition: - flush_request = self._get_or_create_flush_request() - # signal the worker thread to flush and wait for it to finish - self.condition.notify_all() - - # wait for token to be processed - ret = flush_request.event.wait(timeout_millis / 1e3) - if not ret: - logger.warning("Timeout was exceeded in force_flush().") - return ret - - def shutdown(self) -> None: - # signal the worker thread to finish and then wait for it - self.done = True - with self.condition: - self.condition.notify_all() - self.worker_thread.join() - self.span_exporter.shutdown() - - -class ConsoleSpanExporter(SpanExporter): - """Implementation of :class:`SpanExporter` that prints spans to the - console. - - This class can be used for diagnostic purposes. It prints the exported - spans to the console STDOUT. - """ - - def __init__( - self, - service_name: Optional[str] = None, - out: typing.IO = sys.stdout, - formatter: typing.Callable[ - [ReadableSpan], str - ] = lambda span: span.to_json() - + linesep, - ): - self.out = out - self.formatter = formatter - self.service_name = service_name - - def export(self, spans: typing.Sequence[ReadableSpan]) -> SpanExportResult: - for span in spans: - self.out.write(self.formatter(span)) - self.out.flush() - return SpanExportResult.SUCCESS diff --git a/opensafely/_vendor/opentelemetry/sdk/trace/export/in_memory_span_exporter.py b/opensafely/_vendor/opentelemetry/sdk/trace/export/in_memory_span_exporter.py deleted file mode 100644 index 549cc588..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/trace/export/in_memory_span_exporter.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 threading -import typing - -from opensafely._vendor.opentelemetry.sdk.trace import ReadableSpan -from opensafely._vendor.opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult - - -class InMemorySpanExporter(SpanExporter): - """Implementation of :class:`.SpanExporter` that stores spans in memory. - - This class can be used for testing purposes. It stores the exported spans - in a list in memory that can be retrieved using the - :func:`.get_finished_spans` method. - """ - - def __init__(self): - self._finished_spans = [] - self._stopped = False - self._lock = threading.Lock() - - def clear(self): - """Clear list of collected spans.""" - with self._lock: - self._finished_spans.clear() - - def get_finished_spans(self): - """Get list of collected spans.""" - with self._lock: - return tuple(self._finished_spans) - - def export(self, spans: typing.Sequence[ReadableSpan]) -> SpanExportResult: - """Stores a list of spans in memory.""" - if self._stopped: - return SpanExportResult.FAILURE - with self._lock: - self._finished_spans.extend(spans) - return SpanExportResult.SUCCESS - - def shutdown(self): - """Shut downs the exporter. - - Calls to export after the exporter has been shut down will fail. - """ - self._stopped = True diff --git a/opensafely/_vendor/opentelemetry/sdk/trace/id_generator.py b/opensafely/_vendor/opentelemetry/sdk/trace/id_generator.py deleted file mode 100644 index 62b12a94..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/trace/id_generator.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 abc -import random - - -class IdGenerator(abc.ABC): - @abc.abstractmethod - def generate_span_id(self) -> int: - """Get a new span ID. - - Returns: - A 64-bit int for use as a span ID - """ - - @abc.abstractmethod - def generate_trace_id(self) -> int: - """Get a new trace ID. - - Implementations should at least make the 64 least significant bits - uniformly random. Samplers like the `TraceIdRatioBased` sampler rely on - this randomness to make sampling decisions. - - See `the specification on TraceIdRatioBased `_. - - Returns: - A 128-bit int for use as a trace ID - """ - - -class RandomIdGenerator(IdGenerator): - """The default ID generator for TracerProvider which randomly generates all - bits when generating IDs. - """ - - def generate_span_id(self) -> int: - return random.getrandbits(64) - - def generate_trace_id(self) -> int: - return random.getrandbits(128) diff --git a/opensafely/_vendor/opentelemetry/sdk/trace/sampling.py b/opensafely/_vendor/opentelemetry/sdk/trace/sampling.py deleted file mode 100644 index cc315db9..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/trace/sampling.py +++ /dev/null @@ -1,397 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -""" -For general information about sampling, see `the specification `_. - -OpenTelemetry provides two types of samplers: - -- `StaticSampler` -- `TraceIdRatioBased` - -A `StaticSampler` always returns the same sampling result regardless of the conditions. Both possible StaticSamplers are already created: - -- Always sample spans: ALWAYS_ON -- Never sample spans: ALWAYS_OFF - -A `TraceIdRatioBased` sampler makes a random sampling result based on the sampling probability given. - -If the span being sampled has a parent, `ParentBased` will respect the parent delegate sampler. Otherwise, it returns the sampling result from the given root sampler. - -Currently, sampling results are always made during the creation of the span. However, this might not always be the case in the future (see `OTEP #115 `_). - -Custom samplers can be created by subclassing `Sampler` and implementing `Sampler.should_sample` as well as `Sampler.get_description`. - -Samplers are able to modify the `opentelemetry.trace.span.TraceState` of the parent of the span being created. For custom samplers, it is suggested to implement `Sampler.should_sample` to utilize the -parent span context's `opentelemetry.trace.span.TraceState` and pass into the `SamplingResult` instead of the explicit trace_state field passed into the parameter of `Sampler.should_sample`. - -To use a sampler, pass it into the tracer provider constructor. For example: - -.. code:: python - - from opensafely._vendor.opentelemetry import trace - from opensafely._vendor.opentelemetry.sdk.trace import TracerProvider - from opensafely._vendor.opentelemetry.sdk.trace.export import ( - ConsoleSpanExporter, - SimpleSpanProcessor, - ) - from opensafely._vendor.opentelemetry.sdk.trace.sampling import TraceIdRatioBased - - # sample 1 in every 1000 traces - sampler = TraceIdRatioBased(1/1000) - - # set the sampler onto the global tracer provider - trace.set_tracer_provider(TracerProvider(sampler=sampler)) - - # set up an exporter for sampled spans - trace.get_tracer_provider().add_span_processor( - SimpleSpanProcessor(ConsoleSpanExporter()) - ) - - # created spans will now be sampled by the TraceIdRatioBased sampler - with trace.get_tracer(__name__).start_as_current_span("Test Span"): - ... - -The tracer sampler can also be configured via environment variables ``OTEL_TRACES_SAMPLER`` and ``OTEL_TRACES_SAMPLER_ARG`` (only if applicable). -The list of known values for ``OTEL_TRACES_SAMPLER`` are: - - * always_on - Sampler that always samples spans, regardless of the parent span's sampling decision. - * always_off - Sampler that never samples spans, regardless of the parent span's sampling decision. - * traceidratio - Sampler that samples probabalistically based on rate. - * parentbased_always_on - (default) Sampler that respects its parent span's sampling decision, but otherwise always samples. - * parentbased_always_off - Sampler that respects its parent span's sampling decision, but otherwise never samples. - * parentbased_traceidratio - Sampler that respects its parent span's sampling decision, but otherwise samples probabalistically based on rate. - -Sampling probability can be set with ``OTEL_TRACES_SAMPLER_ARG`` if the sampler is traceidratio or parentbased_traceidratio, when not provided rate will be set to 1.0 (maximum rate possible). - - -Prev example but with environment vairables. Please make sure to set the env ``OTEL_TRACES_SAMPLER=traceidratio`` and ``OTEL_TRACES_SAMPLER_ARG=0.001``. - -.. code:: python - - from opensafely._vendor.opentelemetry import trace - from opensafely._vendor.opentelemetry.sdk.trace import TracerProvider - from opensafely._vendor.opentelemetry.sdk.trace.export import ( - ConsoleSpanExporter, - SimpleSpanProcessor, - ) - - trace.set_tracer_provider(TracerProvider()) - - # set up an exporter for sampled spans - trace.get_tracer_provider().add_span_processor( - SimpleSpanProcessor(ConsoleSpanExporter()) - ) - - # created spans will now be sampled by the TraceIdRatioBased sampler with rate 1/1000. - with trace.get_tracer(__name__).start_as_current_span("Test Span"): - ... -""" -import abc -import enum -import os -from logging import getLogger -from types import MappingProxyType -from typing import Optional, Sequence - -# pylint: disable=unused-import -from opensafely._vendor.opentelemetry.context import Context -from opensafely._vendor.opentelemetry.sdk.environment_variables import ( - OTEL_TRACES_SAMPLER, - OTEL_TRACES_SAMPLER_ARG, -) -from opensafely._vendor.opentelemetry.trace import Link, SpanKind, get_current_span -from opensafely._vendor.opentelemetry.trace.span import TraceState -from opensafely._vendor.opentelemetry.util.types import Attributes - -_logger = getLogger(__name__) - - -class Decision(enum.Enum): - # IsRecording() == false, span will not be recorded and all events and attributes will be dropped. - DROP = 0 - # IsRecording() == true, but Sampled flag MUST NOT be set. - RECORD_ONLY = 1 - # IsRecording() == true AND Sampled flag` MUST be set. - RECORD_AND_SAMPLE = 2 - - def is_recording(self): - return self in (Decision.RECORD_ONLY, Decision.RECORD_AND_SAMPLE) - - def is_sampled(self): - return self is Decision.RECORD_AND_SAMPLE - - -class SamplingResult: - """A sampling result as applied to a newly-created Span. - - Args: - decision: A sampling decision based off of whether the span is recorded - and the sampled flag in trace flags in the span context. - attributes: Attributes to add to the `opentelemetry.trace.Span`. - trace_state: The tracestate used for the `opentelemetry.trace.Span`. - Could possibly have been modified by the sampler. - """ - - def __repr__(self) -> str: - return f"{type(self).__name__}({str(self.decision)}, attributes={str(self.attributes)})" - - def __init__( - self, - decision: Decision, - attributes: "Attributes" = None, - trace_state: "TraceState" = None, - ) -> None: - self.decision = decision - if attributes is None: - self.attributes = MappingProxyType({}) - else: - self.attributes = MappingProxyType(attributes) - self.trace_state = trace_state - - -class Sampler(abc.ABC): - @abc.abstractmethod - def should_sample( - self, - parent_context: Optional["Context"], - trace_id: int, - name: str, - kind: SpanKind = None, - attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, - ) -> "SamplingResult": - pass - - @abc.abstractmethod - def get_description(self) -> str: - pass - - -class StaticSampler(Sampler): - """Sampler that always returns the same decision.""" - - def __init__(self, decision: "Decision"): - self._decision = decision - - def should_sample( - self, - parent_context: Optional["Context"], - trace_id: int, - name: str, - kind: SpanKind = None, - attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, - ) -> "SamplingResult": - if self._decision is Decision.DROP: - attributes = None - return SamplingResult( - self._decision, - attributes, - _get_parent_trace_state(parent_context), - ) - - def get_description(self) -> str: - if self._decision is Decision.DROP: - return "AlwaysOffSampler" - return "AlwaysOnSampler" - - -ALWAYS_OFF = StaticSampler(Decision.DROP) -"""Sampler that never samples spans, regardless of the parent span's sampling decision.""" - -ALWAYS_ON = StaticSampler(Decision.RECORD_AND_SAMPLE) -"""Sampler that always samples spans, regardless of the parent span's sampling decision.""" - - -class TraceIdRatioBased(Sampler): - """ - Sampler that makes sampling decisions probabilistically based on `rate`. - - Args: - rate: Probability (between 0 and 1) that a span will be sampled - """ - - def __init__(self, rate: float): - if rate < 0.0 or rate > 1.0: - raise ValueError("Probability must be in range [0.0, 1.0].") - self._rate = rate - self._bound = self.get_bound_for_rate(self._rate) - - # For compatibility with 64 bit trace IDs, the sampler checks the 64 - # low-order bits of the trace ID to decide whether to sample a given trace. - TRACE_ID_LIMIT = (1 << 64) - 1 - - @classmethod - def get_bound_for_rate(cls, rate: float) -> int: - return round(rate * (cls.TRACE_ID_LIMIT + 1)) - - @property - def rate(self) -> float: - return self._rate - - @property - def bound(self) -> int: - return self._bound - - def should_sample( - self, - parent_context: Optional["Context"], - trace_id: int, - name: str, - kind: SpanKind = None, - attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, - ) -> "SamplingResult": - decision = Decision.DROP - if trace_id & self.TRACE_ID_LIMIT < self.bound: - decision = Decision.RECORD_AND_SAMPLE - if decision is Decision.DROP: - attributes = None - return SamplingResult( - decision, - attributes, - _get_parent_trace_state(parent_context), - ) - - def get_description(self) -> str: - return f"TraceIdRatioBased{{{self._rate}}}" - - -class ParentBased(Sampler): - """ - If a parent is set, applies the respective delegate sampler. - Otherwise, uses the root provided at initialization to make a - decision. - - Args: - root: Sampler called for spans with no parent (root spans). - remote_parent_sampled: Sampler called for a remote sampled parent. - remote_parent_not_sampled: Sampler called for a remote parent that is - not sampled. - local_parent_sampled: Sampler called for a local sampled parent. - local_parent_not_sampled: Sampler called for a local parent that is - not sampled. - """ - - def __init__( - self, - root: Sampler, - remote_parent_sampled: Sampler = ALWAYS_ON, - remote_parent_not_sampled: Sampler = ALWAYS_OFF, - local_parent_sampled: Sampler = ALWAYS_ON, - local_parent_not_sampled: Sampler = ALWAYS_OFF, - ): - self._root = root - self._remote_parent_sampled = remote_parent_sampled - self._remote_parent_not_sampled = remote_parent_not_sampled - self._local_parent_sampled = local_parent_sampled - self._local_parent_not_sampled = local_parent_not_sampled - - def should_sample( - self, - parent_context: Optional["Context"], - trace_id: int, - name: str, - kind: SpanKind = None, - attributes: Attributes = None, - links: Sequence["Link"] = None, - trace_state: "TraceState" = None, - ) -> "SamplingResult": - parent_span_context = get_current_span( - parent_context - ).get_span_context() - # default to the root sampler - sampler = self._root - # respect the sampling and remote flag of the parent if present - if parent_span_context is not None and parent_span_context.is_valid: - if parent_span_context.is_remote: - if parent_span_context.trace_flags.sampled: - sampler = self._remote_parent_sampled - else: - sampler = self._remote_parent_not_sampled - else: - if parent_span_context.trace_flags.sampled: - sampler = self._local_parent_sampled - else: - sampler = self._local_parent_not_sampled - - return sampler.should_sample( - parent_context=parent_context, - trace_id=trace_id, - name=name, - kind=kind, - attributes=attributes, - links=links, - ) - - def get_description(self): - return f"ParentBased{{root:{self._root.get_description()},remoteParentSampled:{self._remote_parent_sampled.get_description()},remoteParentNotSampled:{self._remote_parent_not_sampled.get_description()},localParentSampled:{self._local_parent_sampled.get_description()},localParentNotSampled:{self._local_parent_not_sampled.get_description()}}}" - - -DEFAULT_OFF = ParentBased(ALWAYS_OFF) -"""Sampler that respects its parent span's sampling decision, but otherwise never samples.""" - -DEFAULT_ON = ParentBased(ALWAYS_ON) -"""Sampler that respects its parent span's sampling decision, but otherwise always samples.""" - - -class ParentBasedTraceIdRatio(ParentBased): - """ - Sampler that respects its parent span's sampling decision, but otherwise - samples probabalistically based on `rate`. - """ - - def __init__(self, rate: float): - root = TraceIdRatioBased(rate=rate) - super().__init__(root=root) - - -_KNOWN_SAMPLERS = { - "always_on": ALWAYS_ON, - "always_off": ALWAYS_OFF, - "parentbased_always_on": DEFAULT_ON, - "parentbased_always_off": DEFAULT_OFF, - "traceidratio": TraceIdRatioBased, - "parentbased_traceidratio": ParentBasedTraceIdRatio, -} - - -def _get_from_env_or_default() -> Sampler: - trace_sampler = os.getenv( - OTEL_TRACES_SAMPLER, "parentbased_always_on" - ).lower() - if trace_sampler not in _KNOWN_SAMPLERS: - _logger.warning("Couldn't recognize sampler %s.", trace_sampler) - trace_sampler = "parentbased_always_on" - - if trace_sampler in ("traceidratio", "parentbased_traceidratio"): - try: - rate = float(os.getenv(OTEL_TRACES_SAMPLER_ARG)) - except ValueError: - _logger.warning("Could not convert TRACES_SAMPLER_ARG to float.") - rate = 1.0 - return _KNOWN_SAMPLERS[trace_sampler](rate) - - return _KNOWN_SAMPLERS[trace_sampler] - - -def _get_parent_trace_state(parent_context) -> Optional["TraceState"]: - parent_span_context = get_current_span(parent_context).get_span_context() - if parent_span_context is None or not parent_span_context.is_valid: - return None - return parent_span_context.trace_state diff --git a/opensafely/_vendor/opentelemetry/sdk/util/__init__.py b/opensafely/_vendor/opentelemetry/sdk/util/__init__.py deleted file mode 100644 index 5b7dbf10..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/util/__init__.py +++ /dev/null @@ -1,150 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 datetime -import threading -from collections import OrderedDict, deque -from collections.abc import MutableMapping, Sequence -from typing import Optional - -from opensafely._vendor.deprecated import deprecated - - -def ns_to_iso_str(nanoseconds): - """Get an ISO 8601 string from time_ns value.""" - ts = datetime.datetime.utcfromtimestamp(nanoseconds / 1e9) - return ts.strftime("%Y-%m-%dT%H:%M:%S.%fZ") - - -def get_dict_as_key(labels): - """Converts a dict to be used as a unique key""" - return tuple( - sorted( - map( - lambda kv: (kv[0], tuple(kv[1])) - if isinstance(kv[1], list) - else kv, - labels.items(), - ) - ) - ) - - -class BoundedList(Sequence): - """An append only list with a fixed max size. - - Calls to `append` and `extend` will drop the oldest elements if there is - not enough room. - """ - - def __init__(self, maxlen: Optional[int]): - self.dropped = 0 - self._dq = deque(maxlen=maxlen) # type: deque - self._lock = threading.Lock() - - def __repr__(self): - return f"{type(self).__name__}({list(self._dq)}, maxlen={self._dq.maxlen})" - - def __getitem__(self, index): - return self._dq[index] - - def __len__(self): - return len(self._dq) - - def __iter__(self): - with self._lock: - return iter(deque(self._dq)) - - def append(self, item): - with self._lock: - if ( - self._dq.maxlen is not None - and len(self._dq) == self._dq.maxlen - ): - self.dropped += 1 - self._dq.append(item) - - def extend(self, seq): - with self._lock: - if self._dq.maxlen is not None: - to_drop = len(seq) + len(self._dq) - self._dq.maxlen - if to_drop > 0: - self.dropped += to_drop - self._dq.extend(seq) - - @classmethod - def from_seq(cls, maxlen, seq): - seq = tuple(seq) - bounded_list = cls(maxlen) - bounded_list.extend(seq) - return bounded_list - - -@deprecated(version="1.4.0") # type: ignore -class BoundedDict(MutableMapping): - """An ordered dict with a fixed max capacity. - - Oldest elements are dropped when the dict is full and a new element is - added. - """ - - def __init__(self, maxlen: Optional[int]): - if maxlen is not None: - if not isinstance(maxlen, int): - raise ValueError - if maxlen < 0: - raise ValueError - self.maxlen = maxlen - self.dropped = 0 - self._dict = OrderedDict() # type: OrderedDict - self._lock = threading.Lock() # type: threading.Lock - - def __repr__(self): - return ( - f"{type(self).__name__}({dict(self._dict)}, maxlen={self.maxlen})" - ) - - def __getitem__(self, key): - return self._dict[key] - - def __setitem__(self, key, value): - with self._lock: - if self.maxlen is not None and self.maxlen == 0: - self.dropped += 1 - return - - if key in self._dict: - del self._dict[key] - elif self.maxlen is not None and len(self._dict) == self.maxlen: - del self._dict[next(iter(self._dict.keys()))] - self.dropped += 1 - self._dict[key] = value - - def __delitem__(self, key): - del self._dict[key] - - def __iter__(self): - with self._lock: - return iter(self._dict.copy()) - - def __len__(self): - return len(self._dict) - - @classmethod - def from_map(cls, maxlen, mapping): - mapping = OrderedDict(mapping) - bounded_dict = cls(maxlen) - for key, value in mapping.items(): - bounded_dict[key] = value - return bounded_dict diff --git a/opensafely/_vendor/opentelemetry/sdk/util/__init__.pyi b/opensafely/_vendor/opentelemetry/sdk/util/__init__.pyi deleted file mode 100644 index d42e0f01..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/util/__init__.pyi +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 ( - Iterable, - Iterator, - Mapping, - MutableMapping, - Sequence, - TypeVar, - overload, -) - -from opentelemetry.util.types import AttributesAsKey, AttributeValue - -_T = TypeVar("_T") -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") - -def ns_to_iso_str(nanoseconds: int) -> str: ... -def get_dict_as_key( - labels: Mapping[str, AttributeValue] -) -> AttributesAsKey: ... - -class BoundedList(Sequence[_T]): - """An append only list with a fixed max size. - - Calls to `append` and `extend` will drop the oldest elements if there is - not enough room. - """ - - dropped: int - def __init__(self, maxlen: int): ... - def insert(self, index: int, value: _T) -> None: ... - @overload - def __getitem__(self, i: int) -> _T: ... - @overload - def __getitem__(self, s: slice) -> Sequence[_T]: ... - def __len__(self) -> int: ... - def append(self, item: _T): ... - def extend(self, seq: Sequence[_T]): ... - @classmethod - def from_seq(cls, maxlen: int, seq: Iterable[_T]) -> BoundedList[_T]: ... - -class BoundedDict(MutableMapping[_KT, _VT]): - """An ordered dict with a fixed max capacity. - - Oldest elements are dropped when the dict is full and a new element is - added. - """ - - dropped: int - def __init__(self, maxlen: int): ... - def __getitem__(self, k: _KT) -> _VT: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... - def __delitem__(self, v: _KT) -> None: ... - def __iter__(self) -> Iterator[_KT]: ... - def __len__(self) -> int: ... - @classmethod - def from_map( - cls, maxlen: int, mapping: Mapping[_KT, _VT] - ) -> BoundedDict[_KT, _VT]: ... diff --git a/opensafely/_vendor/opentelemetry/sdk/util/instrumentation.py b/opensafely/_vendor/opentelemetry/sdk/util/instrumentation.py deleted file mode 100644 index 3ccf14f2..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/util/instrumentation.py +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 json import dumps -from typing import Optional - -from opensafely._vendor.deprecated import deprecated - - -class InstrumentationInfo: - """Immutable information about an instrumentation library module. - - See `opentelemetry.trace.TracerProvider.get_tracer` for the meaning of these - properties. - """ - - __slots__ = ("_name", "_version", "_schema_url") - - @deprecated(version="1.11.1", reason="You should use InstrumentationScope") - def __init__( - self, - name: str, - version: Optional[str] = None, - schema_url: Optional[str] = None, - ): - self._name = name - self._version = version - if schema_url is None: - schema_url = "" - self._schema_url = schema_url - - def __repr__(self): - return f"{type(self).__name__}({self._name}, {self._version}, {self._schema_url})" - - def __hash__(self): - return hash((self._name, self._version, self._schema_url)) - - def __eq__(self, value): - return type(value) is type(self) and ( - self._name, - self._version, - self._schema_url, - ) == (value._name, value._version, value._schema_url) - - def __lt__(self, value): - if type(value) is not type(self): - return NotImplemented - return (self._name, self._version, self._schema_url) < ( - value._name, - value._version, - value._schema_url, - ) - - @property - def schema_url(self) -> Optional[str]: - return self._schema_url - - @property - def version(self) -> Optional[str]: - return self._version - - @property - def name(self) -> str: - return self._name - - -class InstrumentationScope: - """A logical unit of the application code with which the emitted telemetry can be - associated. - - See `opentelemetry.trace.TracerProvider.get_tracer` for the meaning of these - properties. - """ - - __slots__ = ("_name", "_version", "_schema_url") - - def __init__( - self, - name: str, - version: Optional[str] = None, - schema_url: Optional[str] = None, - ) -> None: - self._name = name - self._version = version - if schema_url is None: - schema_url = "" - self._schema_url = schema_url - - def __repr__(self) -> str: - return f"{type(self).__name__}({self._name}, {self._version}, {self._schema_url})" - - def __hash__(self) -> int: - return hash((self._name, self._version, self._schema_url)) - - def __eq__(self, value: object) -> bool: - if not isinstance(value, InstrumentationScope): - return NotImplemented - return (self._name, self._version, self._schema_url) == ( - value._name, - value._version, - value._schema_url, - ) - - def __lt__(self, value: object) -> bool: - if not isinstance(value, InstrumentationScope): - return NotImplemented - return (self._name, self._version, self._schema_url) < ( - value._name, - value._version, - value._schema_url, - ) - - @property - def schema_url(self) -> Optional[str]: - return self._schema_url - - @property - def version(self) -> Optional[str]: - return self._version - - @property - def name(self) -> str: - return self._name - - def to_json(self, indent=4) -> str: - return dumps( - { - "name": self._name, - "version": self._version, - "schema_url": self._schema_url, - }, - indent=indent, - ) diff --git a/opensafely/_vendor/opentelemetry/sdk/version.py b/opensafely/_vendor/opentelemetry/sdk/version.py deleted file mode 100644 index 797af7e4..00000000 --- a/opensafely/_vendor/opentelemetry/sdk/version.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -__version__ = "1.12.0" diff --git a/opensafely/_vendor/opentelemetry/semconv/__init__.py b/opensafely/_vendor/opentelemetry/semconv/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry/semconv/resource/__init__.py b/opensafely/_vendor/opentelemetry/semconv/resource/__init__.py deleted file mode 100644 index dc24d22b..00000000 --- a/opensafely/_vendor/opentelemetry/semconv/resource/__init__.py +++ /dev/null @@ -1,657 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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 enum import Enum - - -class ResourceAttributes: - CLOUD_PROVIDER = "cloud.provider" - """ - Name of the cloud provider. - """ - - CLOUD_ACCOUNT_ID = "cloud.account.id" - """ - The cloud account ID the resource is assigned to. - """ - - CLOUD_REGION = "cloud.region" - """ - The geographical region the resource is running. - Note: Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://intl.cloud.tencent.com/document/product/213/6091). - """ - - CLOUD_AVAILABILITY_ZONE = "cloud.availability_zone" - """ - Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. - Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. - """ - - CLOUD_PLATFORM = "cloud.platform" - """ - The cloud platform in use. - Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. - """ - - AWS_ECS_CONTAINER_ARN = "aws.ecs.container.arn" - """ - The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - """ - - AWS_ECS_CLUSTER_ARN = "aws.ecs.cluster.arn" - """ - The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). - """ - - AWS_ECS_LAUNCHTYPE = "aws.ecs.launchtype" - """ - The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. - """ - - AWS_ECS_TASK_ARN = "aws.ecs.task.arn" - """ - The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). - """ - - AWS_ECS_TASK_FAMILY = "aws.ecs.task.family" - """ - The task definition family this task definition is a member of. - """ - - AWS_ECS_TASK_REVISION = "aws.ecs.task.revision" - """ - The revision for this task definition. - """ - - AWS_EKS_CLUSTER_ARN = "aws.eks.cluster.arn" - """ - The ARN of an EKS cluster. - """ - - AWS_LOG_GROUP_NAMES = "aws.log.group.names" - """ - The name(s) of the AWS log group(s) an application is writing to. - Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group. - """ - - AWS_LOG_GROUP_ARNS = "aws.log.group.arns" - """ - The Amazon Resource Name(s) (ARN) of the AWS log group(s). - Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - """ - - AWS_LOG_STREAM_NAMES = "aws.log.stream.names" - """ - The name(s) of the AWS log stream(s) an application is writing to. - """ - - AWS_LOG_STREAM_ARNS = "aws.log.stream.arns" - """ - The ARN(s) of the AWS log stream(s). - Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream. - """ - - CONTAINER_NAME = "container.name" - """ - Container name used by container runtime. - """ - - CONTAINER_ID = "container.id" - """ - Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. - """ - - CONTAINER_RUNTIME = "container.runtime" - """ - The container runtime managing this container. - """ - - CONTAINER_IMAGE_NAME = "container.image.name" - """ - Name of the image the container was built on. - """ - - CONTAINER_IMAGE_TAG = "container.image.tag" - """ - Container image tag. - """ - - DEPLOYMENT_ENVIRONMENT = "deployment.environment" - """ - Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier). - """ - - DEVICE_ID = "device.id" - """ - A unique identifier representing the device. - Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence. - """ - - DEVICE_MODEL_IDENTIFIER = "device.model.identifier" - """ - The model identifier for the device. - Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device. - """ - - DEVICE_MODEL_NAME = "device.model.name" - """ - The marketing name for the device model. - Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative. - """ - - DEVICE_MANUFACTURER = "device.manufacturer" - """ - The name of the device manufacturer. - Note: The Android OS provides this field via [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). iOS apps SHOULD hardcode the value `Apple`. - """ - - FAAS_NAME = "faas.name" - """ - The name of the single function that this runtime instance executes. - Note: This is the name of the function as configured/deployed on the FaaS platform and is usually different from the name of the callback function (which may be stored in the [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) span attributes). - """ - - FAAS_ID = "faas.id" - """ - The unique ID of the single function that this runtime instance executes. - Note: Depending on the cloud provider, use: - -* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). -Take care not to use the "invoked ARN" directly but replace any -[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) with the resolved function version, as the same runtime instance may be invokable with multiple -different aliases. -* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) -* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id). - -On some providers, it may not be possible to determine the full ID at startup, -which is why this field cannot be made required. For example, on AWS the account ID -part of the ARN is not available without calling another AWS API -which may be deemed too slow for a short-running lambda function. -As an alternative, consider setting `faas.id` as a span attribute instead. - """ - - FAAS_VERSION = "faas.version" - """ - The immutable version of the function being executed. - Note: Depending on the cloud provider and platform, use: - -* **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) - (an integer represented as a decimal string). -* **Google Cloud Run:** The [revision](https://cloud.google.com/run/docs/managing/revisions) - (i.e., the function name plus the revision suffix). -* **Google Cloud Functions:** The value of the - [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). -* **Azure Functions:** Not applicable. Do not set this attribute. - """ - - FAAS_INSTANCE = "faas.instance" - """ - The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. - Note: * **AWS Lambda:** Use the (full) log stream name. - """ - - FAAS_MAX_MEMORY = "faas.max_memory" - """ - The amount of memory available to the serverless function in MiB. - Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. - """ - - HOST_ID = "host.id" - """ - Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. - """ - - HOST_NAME = "host.name" - """ - Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. - """ - - HOST_TYPE = "host.type" - """ - Type of host. For Cloud, this must be the machine type. - """ - - HOST_ARCH = "host.arch" - """ - The CPU architecture the host system is running on. - """ - - HOST_IMAGE_NAME = "host.image.name" - """ - Name of the VM image or OS install the host was instantiated from. - """ - - HOST_IMAGE_ID = "host.image.id" - """ - VM image ID. For Cloud, this value is from the provider. - """ - - HOST_IMAGE_VERSION = "host.image.version" - """ - The version string of the VM image as defined in [Version Attributes](README.md#version-attributes). - """ - - K8S_CLUSTER_NAME = "k8s.cluster.name" - """ - The name of the cluster. - """ - - K8S_NODE_NAME = "k8s.node.name" - """ - The name of the Node. - """ - - K8S_NODE_UID = "k8s.node.uid" - """ - The UID of the Node. - """ - - K8S_NAMESPACE_NAME = "k8s.namespace.name" - """ - The name of the namespace that the pod is running in. - """ - - K8S_POD_UID = "k8s.pod.uid" - """ - The UID of the Pod. - """ - - K8S_POD_NAME = "k8s.pod.name" - """ - The name of the Pod. - """ - - K8S_CONTAINER_NAME = "k8s.container.name" - """ - The name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (`container.name`). - """ - - K8S_CONTAINER_RESTART_COUNT = "k8s.container.restart_count" - """ - Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec. - """ - - K8S_REPLICASET_UID = "k8s.replicaset.uid" - """ - The UID of the ReplicaSet. - """ - - K8S_REPLICASET_NAME = "k8s.replicaset.name" - """ - The name of the ReplicaSet. - """ - - K8S_DEPLOYMENT_UID = "k8s.deployment.uid" - """ - The UID of the Deployment. - """ - - K8S_DEPLOYMENT_NAME = "k8s.deployment.name" - """ - The name of the Deployment. - """ - - K8S_STATEFULSET_UID = "k8s.statefulset.uid" - """ - The UID of the StatefulSet. - """ - - K8S_STATEFULSET_NAME = "k8s.statefulset.name" - """ - The name of the StatefulSet. - """ - - K8S_DAEMONSET_UID = "k8s.daemonset.uid" - """ - The UID of the DaemonSet. - """ - - K8S_DAEMONSET_NAME = "k8s.daemonset.name" - """ - The name of the DaemonSet. - """ - - K8S_JOB_UID = "k8s.job.uid" - """ - The UID of the Job. - """ - - K8S_JOB_NAME = "k8s.job.name" - """ - The name of the Job. - """ - - K8S_CRONJOB_UID = "k8s.cronjob.uid" - """ - The UID of the CronJob. - """ - - K8S_CRONJOB_NAME = "k8s.cronjob.name" - """ - The name of the CronJob. - """ - - OS_TYPE = "os.type" - """ - The operating system type. - """ - - OS_DESCRIPTION = "os.description" - """ - Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. - """ - - OS_NAME = "os.name" - """ - Human readable operating system name. - """ - - OS_VERSION = "os.version" - """ - The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). - """ - - PROCESS_PID = "process.pid" - """ - Process identifier (PID). - """ - - PROCESS_EXECUTABLE_NAME = "process.executable.name" - """ - The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. - """ - - PROCESS_EXECUTABLE_PATH = "process.executable.path" - """ - The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. - """ - - PROCESS_COMMAND = "process.command" - """ - The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. - """ - - PROCESS_COMMAND_LINE = "process.command_line" - """ - The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. - """ - - PROCESS_COMMAND_ARGS = "process.command_args" - """ - All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. - """ - - PROCESS_OWNER = "process.owner" - """ - The username of the user that owns the process. - """ - - PROCESS_RUNTIME_NAME = "process.runtime.name" - """ - The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler. - """ - - PROCESS_RUNTIME_VERSION = "process.runtime.version" - """ - The version of the runtime of this process, as returned by the runtime without modification. - """ - - PROCESS_RUNTIME_DESCRIPTION = "process.runtime.description" - """ - An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment. - """ - - SERVICE_NAME = "service.name" - """ - Logical name of the service. - Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. - """ - - SERVICE_NAMESPACE = "service.namespace" - """ - A namespace for `service.name`. - Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. - """ - - SERVICE_INSTANCE_ID = "service.instance.id" - """ - The string ID of the service instance. - Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations). - """ - - SERVICE_VERSION = "service.version" - """ - The version string of the service API or implementation. - """ - - TELEMETRY_SDK_NAME = "telemetry.sdk.name" - """ - The name of the telemetry SDK as defined above. - """ - - TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language" - """ - The language of the telemetry SDK. - """ - - TELEMETRY_SDK_VERSION = "telemetry.sdk.version" - """ - The version string of the telemetry SDK. - """ - - TELEMETRY_AUTO_VERSION = "telemetry.auto.version" - """ - The version string of the auto instrumentation agent, if used. - """ - - WEBENGINE_NAME = "webengine.name" - """ - The name of the web engine. - """ - - WEBENGINE_VERSION = "webengine.version" - """ - The version of the web engine. - """ - - WEBENGINE_DESCRIPTION = "webengine.description" - """ - Additional description of the web engine (e.g. detailed version and edition information). - """ - - -class CloudProviderValues(Enum): - ALIBABA_CLOUD = "alibaba_cloud" - """Alibaba Cloud.""" - - AWS = "aws" - """Amazon Web Services.""" - - AZURE = "azure" - """Microsoft Azure.""" - - GCP = "gcp" - """Google Cloud Platform.""" - - TENCENT_CLOUD = "tencent_cloud" - """Tencent Cloud.""" - - -class CloudPlatformValues(Enum): - ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs" - """Alibaba Cloud Elastic Compute Service.""" - - ALIBABA_CLOUD_FC = "alibaba_cloud_fc" - """Alibaba Cloud Function Compute.""" - - AWS_EC2 = "aws_ec2" - """AWS Elastic Compute Cloud.""" - - AWS_ECS = "aws_ecs" - """AWS Elastic Container Service.""" - - AWS_EKS = "aws_eks" - """AWS Elastic Kubernetes Service.""" - - AWS_LAMBDA = "aws_lambda" - """AWS Lambda.""" - - AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk" - """AWS Elastic Beanstalk.""" - - AWS_APP_RUNNER = "aws_app_runner" - """AWS App Runner.""" - - AZURE_VM = "azure_vm" - """Azure Virtual Machines.""" - - AZURE_CONTAINER_INSTANCES = "azure_container_instances" - """Azure Container Instances.""" - - AZURE_AKS = "azure_aks" - """Azure Kubernetes Service.""" - - AZURE_FUNCTIONS = "azure_functions" - """Azure Functions.""" - - AZURE_APP_SERVICE = "azure_app_service" - """Azure App Service.""" - - GCP_COMPUTE_ENGINE = "gcp_compute_engine" - """Google Cloud Compute Engine (GCE).""" - - GCP_CLOUD_RUN = "gcp_cloud_run" - """Google Cloud Run.""" - - GCP_KUBERNETES_ENGINE = "gcp_kubernetes_engine" - """Google Cloud Kubernetes Engine (GKE).""" - - GCP_CLOUD_FUNCTIONS = "gcp_cloud_functions" - """Google Cloud Functions (GCF).""" - - GCP_APP_ENGINE = "gcp_app_engine" - """Google Cloud App Engine (GAE).""" - - TENCENT_CLOUD_CVM = "tencent_cloud_cvm" - """Tencent Cloud Cloud Virtual Machine (CVM).""" - - TENCENT_CLOUD_EKS = "tencent_cloud_eks" - """Tencent Cloud Elastic Kubernetes Service (EKS).""" - - TENCENT_CLOUD_SCF = "tencent_cloud_scf" - """Tencent Cloud Serverless Cloud Function (SCF).""" - - -class AwsEcsLaunchtypeValues(Enum): - EC2 = "ec2" - """ec2.""" - - FARGATE = "fargate" - """fargate.""" - - -class HostArchValues(Enum): - AMD64 = "amd64" - """AMD64.""" - - ARM32 = "arm32" - """ARM32.""" - - ARM64 = "arm64" - """ARM64.""" - - IA64 = "ia64" - """Itanium.""" - - PPC32 = "ppc32" - """32-bit PowerPC.""" - - PPC64 = "ppc64" - """64-bit PowerPC.""" - - S390X = "s390x" - """IBM z/Architecture.""" - - X86 = "x86" - """32-bit x86.""" - - -class OsTypeValues(Enum): - WINDOWS = "windows" - """Microsoft Windows.""" - - LINUX = "linux" - """Linux.""" - - DARWIN = "darwin" - """Apple Darwin.""" - - FREEBSD = "freebsd" - """FreeBSD.""" - - NETBSD = "netbsd" - """NetBSD.""" - - OPENBSD = "openbsd" - """OpenBSD.""" - - DRAGONFLYBSD = "dragonflybsd" - """DragonFly BSD.""" - - HPUX = "hpux" - """HP-UX (Hewlett Packard Unix).""" - - AIX = "aix" - """AIX (Advanced Interactive eXecutive).""" - - SOLARIS = "solaris" - """SunOS, Oracle Solaris.""" - - Z_OS = "z_os" - """IBM z/OS.""" - - -class TelemetrySdkLanguageValues(Enum): - CPP = "cpp" - """cpp.""" - - DOTNET = "dotnet" - """dotnet.""" - - ERLANG = "erlang" - """erlang.""" - - GO = "go" - """go.""" - - JAVA = "java" - """java.""" - - NODEJS = "nodejs" - """nodejs.""" - - PHP = "php" - """php.""" - - PYTHON = "python" - """python.""" - - RUBY = "ruby" - """ruby.""" - - WEBJS = "webjs" - """webjs.""" - - SWIFT = "swift" - """swift.""" diff --git a/opensafely/_vendor/opentelemetry/semconv/trace/__init__.py b/opensafely/_vendor/opentelemetry/semconv/trace/__init__.py deleted file mode 100644 index 36bab3d1..00000000 --- a/opensafely/_vendor/opentelemetry/semconv/trace/__init__.py +++ /dev/null @@ -1,1268 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -# pylint: disable=too-many-lines - -from enum import Enum - - -class SpanAttributes: - AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" - """ - The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). - Note: This may be different from `faas.id` if an alias is involved. - """ - - CLOUDEVENTS_EVENT_ID = "cloudevents.event_id" - """ - The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event. - """ - - CLOUDEVENTS_EVENT_SOURCE = "cloudevents.event_source" - """ - The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened. - """ - - CLOUDEVENTS_EVENT_SPEC_VERSION = "cloudevents.event_spec_version" - """ - The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. - """ - - CLOUDEVENTS_EVENT_TYPE = "cloudevents.event_type" - """ - The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) contains a value describing the type of event related to the originating occurrence. - """ - - CLOUDEVENTS_EVENT_SUBJECT = "cloudevents.event_subject" - """ - The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) of the event in the context of the event producer (identified by source). - """ - - OPENTRACING_REF_TYPE = "opentracing.ref_type" - """ - Parent-child Reference type. - Note: The causal relationship between a child Span and a parent Span. - """ - - DB_SYSTEM = "db.system" - """ - An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. - """ - - DB_CONNECTION_STRING = "db.connection_string" - """ - The connection string used to connect to the database. It is recommended to remove embedded credentials. - """ - - DB_USER = "db.user" - """ - Username for accessing the database. - """ - - DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname" - """ - The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. - """ - - DB_NAME = "db.name" - """ - This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). - Note: In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name). - """ - - DB_STATEMENT = "db.statement" - """ - The database statement being executed. - Note: The value may be sanitized to exclude sensitive information. - """ - - DB_OPERATION = "db.operation" - """ - The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. - Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. - """ - - NET_PEER_NAME = "net.peer.name" - """ - Remote hostname or similar, see note below. - Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra DNS lookup. - """ - - NET_PEER_IP = "net.peer.ip" - """ - Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6). - """ - - NET_PEER_PORT = "net.peer.port" - """ - Remote port number. - """ - - NET_TRANSPORT = "net.transport" - """ - Transport protocol used. See note below. - """ - - DB_MSSQL_INSTANCE_NAME = "db.mssql.instance_name" - """ - The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance. - Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard). - """ - - DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" - """ - The fetch size used for paging, i.e. how many rows will be returned at once. - """ - - DB_CASSANDRA_CONSISTENCY_LEVEL = "db.cassandra.consistency_level" - """ - The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - """ - - DB_CASSANDRA_TABLE = "db.cassandra.table" - """ - The name of the primary table that the operation is acting upon, including the keyspace name (if applicable). - Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - """ - - DB_CASSANDRA_IDEMPOTENCE = "db.cassandra.idempotence" - """ - Whether or not the query is idempotent. - """ - - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( - "db.cassandra.speculative_execution_count" - ) - """ - The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. - """ - - DB_CASSANDRA_COORDINATOR_ID = "db.cassandra.coordinator.id" - """ - The ID of the coordinating node for a query. - """ - - DB_CASSANDRA_COORDINATOR_DC = "db.cassandra.coordinator.dc" - """ - The data center of the coordinating node for a query. - """ - - DB_REDIS_DATABASE_INDEX = "db.redis.database_index" - """ - The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. - """ - - DB_MONGODB_COLLECTION = "db.mongodb.collection" - """ - The collection being accessed within the database stated in `db.name`. - """ - - DB_SQL_TABLE = "db.sql.table" - """ - The name of the primary table that the operation is acting upon, including the database name (if applicable). - Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - """ - - EXCEPTION_TYPE = "exception.type" - """ - The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. - """ - - EXCEPTION_MESSAGE = "exception.message" - """ - The exception message. - """ - - EXCEPTION_STACKTRACE = "exception.stacktrace" - """ - A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. - """ - - EXCEPTION_ESCAPED = "exception.escaped" - """ - SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. - Note: An exception is considered to have escaped (or left) the scope of a span, -if that span is ended while the exception is still logically "in flight". -This may be actually "in flight" in some languages (e.g. if the exception -is passed to a Context manager's `__exit__` method in Python) but will -usually be caught at the point of recording the exception in most languages. - -It is usually not possible to determine at the point where an exception is thrown -whether it will escape the scope of a span. -However, it is trivial to know that an exception -will escape, if one checks for an active exception just before ending the span, -as done in the [example above](#recording-an-exception). - -It follows that an exception may still escape the scope of the span -even if the `exception.escaped` attribute was not set or set to false, -since the event might have been recorded at a time where it was not -clear whether the exception will escape. - """ - - FAAS_TRIGGER = "faas.trigger" - """ - Type of the trigger which caused this function execution. - Note: For the server/consumer span on the incoming side, -`faas.trigger` MUST be set. - -Clients invoking FaaS instances usually cannot set `faas.trigger`, -since they would typically need to look in the payload to determine -the event type. If clients set it, it should be the same as the -trigger that corresponding incoming would have (i.e., this has -nothing to do with the underlying transport used to make the API -call to invoke the lambda, which is often HTTP). - """ - - FAAS_EXECUTION = "faas.execution" - """ - The execution ID of the current function execution. - """ - - FAAS_DOCUMENT_COLLECTION = "faas.document.collection" - """ - The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. - """ - - FAAS_DOCUMENT_OPERATION = "faas.document.operation" - """ - Describes the type of the operation that was performed on the data. - """ - - FAAS_DOCUMENT_TIME = "faas.document.time" - """ - A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - """ - - FAAS_DOCUMENT_NAME = "faas.document.name" - """ - The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name. - """ - - HTTP_METHOD = "http.method" - """ - HTTP request method. - """ - - HTTP_URL = "http.url" - """ - Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. - Note: `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`. - """ - - HTTP_TARGET = "http.target" - """ - The full request target as passed in a HTTP request line or equivalent. - """ - - HTTP_HOST = "http.host" - """ - The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header should also be reported, see note. - Note: When the header is present but empty the attribute SHOULD be set to the empty string. Note that this is a valid situation that is expected in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set. - """ - - HTTP_SCHEME = "http.scheme" - """ - The URI scheme identifying the used protocol. - """ - - HTTP_STATUS_CODE = "http.status_code" - """ - [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). - """ - - HTTP_FLAVOR = "http.flavor" - """ - Kind of HTTP protocol used. - Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. - """ - - HTTP_USER_AGENT = "http.user_agent" - """ - Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. - """ - - HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" - """ - The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. - """ - - HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = ( - "http.request_content_length_uncompressed" - ) - """ - The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. - """ - - HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" - """ - The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. - """ - - HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( - "http.response_content_length_uncompressed" - ) - """ - The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. - """ - - HTTP_RETRY_COUNT = "http.retry_count" - """ - The ordinal number of request re-sending attempt. - """ - - HTTP_SERVER_NAME = "http.server_name" - """ - The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead). - Note: `http.url` is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. - """ - - HTTP_ROUTE = "http.route" - """ - The matched route (path template). - """ - - HTTP_CLIENT_IP = "http.client_ip" - """ - The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). - Note: This is not necessarily the same as `net.peer.ip`, which would -identify the network-level peer, which may be a proxy. - -This attribute should be set when a source of information different -from the one used for `net.peer.ip`, is available even if that other -source just confirms the same value as `net.peer.ip`. -Rationale: For `net.peer.ip`, one typically does not know if it -comes from a proxy, reverse proxy, or the actual client. Setting -`http.client_ip` when it's the same as `net.peer.ip` means that -one is at least somewhat confident that the address is not that of -the closest proxy. - """ - - NET_HOST_IP = "net.host.ip" - """ - Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. - """ - - NET_HOST_PORT = "net.host.port" - """ - Like `net.peer.port` but for the host port. - """ - - NET_HOST_NAME = "net.host.name" - """ - Local hostname or similar, see note below. - """ - - NET_HOST_CONNECTION_TYPE = "net.host.connection.type" - """ - The internet connection type currently being used by the host. - """ - - NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" - """ - This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. - """ - - NET_HOST_CARRIER_NAME = "net.host.carrier.name" - """ - The name of the mobile carrier. - """ - - NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" - """ - The mobile carrier country code. - """ - - NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" - """ - The mobile carrier network code. - """ - - NET_HOST_CARRIER_ICC = "net.host.carrier.icc" - """ - The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. - """ - - MESSAGING_SYSTEM = "messaging.system" - """ - A string identifying the messaging system. - """ - - MESSAGING_DESTINATION = "messaging.destination" - """ - The message destination name. This might be equal to the span name but is required nevertheless. - """ - - MESSAGING_DESTINATION_KIND = "messaging.destination_kind" - """ - The kind of message destination. - """ - - MESSAGING_TEMP_DESTINATION = "messaging.temp_destination" - """ - A boolean that is true if the message destination is temporary. - """ - - MESSAGING_PROTOCOL = "messaging.protocol" - """ - The name of the transport protocol. - """ - - MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" - """ - The version of the transport protocol. - """ - - MESSAGING_URL = "messaging.url" - """ - Connection string. - """ - - MESSAGING_MESSAGE_ID = "messaging.message_id" - """ - A value used by the messaging system as an identifier for the message, represented as a string. - """ - - MESSAGING_CONVERSATION_ID = "messaging.conversation_id" - """ - The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". - """ - - MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = ( - "messaging.message_payload_size_bytes" - ) - """ - The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. - """ - - MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = ( - "messaging.message_payload_compressed_size_bytes" - ) - """ - The compressed size of the message payload in bytes. - """ - - FAAS_TIME = "faas.time" - """ - A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - """ - - FAAS_CRON = "faas.cron" - """ - A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - """ - - FAAS_COLDSTART = "faas.coldstart" - """ - A boolean that is true if the serverless function is executed for the first time (aka cold-start). - """ - - FAAS_INVOKED_NAME = "faas.invoked_name" - """ - The name of the invoked function. - Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. - """ - - FAAS_INVOKED_PROVIDER = "faas.invoked_provider" - """ - The cloud provider of the invoked function. - Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. - """ - - FAAS_INVOKED_REGION = "faas.invoked_region" - """ - The cloud region of the invoked function. - Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. - """ - - PEER_SERVICE = "peer.service" - """ - The [`service.name`](../../resource/semantic_conventions/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. - """ - - ENDUSER_ID = "enduser.id" - """ - Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system. - """ - - ENDUSER_ROLE = "enduser.role" - """ - Actual/assumed role the client is making the request under extracted from token or application security context. - """ - - ENDUSER_SCOPE = "enduser.scope" - """ - Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). - """ - - THREAD_ID = "thread.id" - """ - Current "managed" thread ID (as opposed to OS thread ID). - """ - - THREAD_NAME = "thread.name" - """ - Current thread name. - """ - - CODE_FUNCTION = "code.function" - """ - The method or function name, or equivalent (usually rightmost part of the code unit's name). - """ - - CODE_NAMESPACE = "code.namespace" - """ - The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. - """ - - CODE_FILEPATH = "code.filepath" - """ - The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). - """ - - CODE_LINENO = "code.lineno" - """ - The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. - """ - - RPC_SYSTEM = "rpc.system" - """ - The value `aws-api`. - """ - - RPC_SERVICE = "rpc.service" - """ - The name of the service to which a request is made, as returned by the AWS SDK. - Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side). - """ - - RPC_METHOD = "rpc.method" - """ - The name of the operation corresponding to the request, as returned by the AWS SDK. - Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side). - """ - - AWS_DYNAMODB_TABLE_NAMES = "aws.dynamodb.table_names" - """ - The keys in the `RequestItems` object field. - """ - - AWS_DYNAMODB_CONSUMED_CAPACITY = "aws.dynamodb.consumed_capacity" - """ - The JSON-serialized value of each item in the `ConsumedCapacity` response field. - """ - - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( - "aws.dynamodb.item_collection_metrics" - ) - """ - The JSON-serialized value of the `ItemCollectionMetrics` response field. - """ - - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( - "aws.dynamodb.provisioned_read_capacity" - ) - """ - The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. - """ - - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( - "aws.dynamodb.provisioned_write_capacity" - ) - """ - The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. - """ - - AWS_DYNAMODB_CONSISTENT_READ = "aws.dynamodb.consistent_read" - """ - The value of the `ConsistentRead` request parameter. - """ - - AWS_DYNAMODB_PROJECTION = "aws.dynamodb.projection" - """ - The value of the `ProjectionExpression` request parameter. - """ - - AWS_DYNAMODB_LIMIT = "aws.dynamodb.limit" - """ - The value of the `Limit` request parameter. - """ - - AWS_DYNAMODB_ATTRIBUTES_TO_GET = "aws.dynamodb.attributes_to_get" - """ - The value of the `AttributesToGet` request parameter. - """ - - AWS_DYNAMODB_INDEX_NAME = "aws.dynamodb.index_name" - """ - The value of the `IndexName` request parameter. - """ - - AWS_DYNAMODB_SELECT = "aws.dynamodb.select" - """ - The value of the `Select` request parameter. - """ - - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( - "aws.dynamodb.global_secondary_indexes" - ) - """ - The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. - """ - - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( - "aws.dynamodb.local_secondary_indexes" - ) - """ - The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. - """ - - AWS_DYNAMODB_EXCLUSIVE_START_TABLE = "aws.dynamodb.exclusive_start_table" - """ - The value of the `ExclusiveStartTableName` request parameter. - """ - - AWS_DYNAMODB_TABLE_COUNT = "aws.dynamodb.table_count" - """ - The the number of items in the `TableNames` response parameter. - """ - - AWS_DYNAMODB_SCAN_FORWARD = "aws.dynamodb.scan_forward" - """ - The value of the `ScanIndexForward` request parameter. - """ - - AWS_DYNAMODB_SEGMENT = "aws.dynamodb.segment" - """ - The value of the `Segment` request parameter. - """ - - AWS_DYNAMODB_TOTAL_SEGMENTS = "aws.dynamodb.total_segments" - """ - The value of the `TotalSegments` request parameter. - """ - - AWS_DYNAMODB_COUNT = "aws.dynamodb.count" - """ - The value of the `Count` response parameter. - """ - - AWS_DYNAMODB_SCANNED_COUNT = "aws.dynamodb.scanned_count" - """ - The value of the `ScannedCount` response parameter. - """ - - AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = "aws.dynamodb.attribute_definitions" - """ - The JSON-serialized value of each item in the `AttributeDefinitions` request field. - """ - - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( - "aws.dynamodb.global_secondary_index_updates" - ) - """ - The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. - """ - - MESSAGING_OPERATION = "messaging.operation" - """ - A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. - """ - - MESSAGING_CONSUMER_ID = "messaging.consumer_id" - """ - The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. - """ - - MESSAGING_RABBITMQ_ROUTING_KEY = "messaging.rabbitmq.routing_key" - """ - RabbitMQ message routing key. - """ - - MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message_key" - """ - Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set. - Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. - """ - - MESSAGING_KAFKA_CONSUMER_GROUP = "messaging.kafka.consumer_group" - """ - Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. - """ - - MESSAGING_KAFKA_CLIENT_ID = "messaging.kafka.client_id" - """ - Client Id for the Consumer or Producer that is handling the message. - """ - - MESSAGING_KAFKA_PARTITION = "messaging.kafka.partition" - """ - Partition the message is sent to. - """ - - MESSAGING_KAFKA_TOMBSTONE = "messaging.kafka.tombstone" - """ - A boolean that is true if the message is a tombstone. - """ - - MESSAGING_ROCKETMQ_NAMESPACE = "messaging.rocketmq.namespace" - """ - Namespace of RocketMQ resources, resources in different namespaces are individual. - """ - - MESSAGING_ROCKETMQ_CLIENT_GROUP = "messaging.rocketmq.client_group" - """ - Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind. - """ - - MESSAGING_ROCKETMQ_CLIENT_ID = "messaging.rocketmq.client_id" - """ - The unique identifier for each client. - """ - - MESSAGING_ROCKETMQ_MESSAGE_TYPE = "messaging.rocketmq.message_type" - """ - Type of message. - """ - - MESSAGING_ROCKETMQ_MESSAGE_TAG = "messaging.rocketmq.message_tag" - """ - The secondary classifier of message besides topic. - """ - - MESSAGING_ROCKETMQ_MESSAGE_KEYS = "messaging.rocketmq.message_keys" - """ - Key(s) of message, another way to mark message besides message id. - """ - - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( - "messaging.rocketmq.consumption_model" - ) - """ - Model of message consumption. This only applies to consumer spans. - """ - - RPC_GRPC_STATUS_CODE = "rpc.grpc.status_code" - """ - The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. - """ - - RPC_JSONRPC_VERSION = "rpc.jsonrpc.version" - """ - Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted. - """ - - RPC_JSONRPC_REQUEST_ID = "rpc.jsonrpc.request_id" - """ - `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification. - """ - - RPC_JSONRPC_ERROR_CODE = "rpc.jsonrpc.error_code" - """ - `error.code` property of response if it is an error response. - """ - - RPC_JSONRPC_ERROR_MESSAGE = "rpc.jsonrpc.error_message" - """ - `error.message` property of response if it is an error response. - """ - - MESSAGE_TYPE = "message.type" - """ - Whether this is a received or sent message. - """ - - MESSAGE_ID = "message.id" - """ - MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. - Note: This way we guarantee that the values will be consistent between different implementations. - """ - - MESSAGE_COMPRESSED_SIZE = "message.compressed_size" - """ - Compressed size of the message in bytes. - """ - - MESSAGE_UNCOMPRESSED_SIZE = "message.uncompressed_size" - """ - Uncompressed size of the message in bytes. - """ - - -class OpentracingRefTypeValues(Enum): - CHILD_OF = "child_of" - """The parent Span depends on the child Span in some capacity.""" - - FOLLOWS_FROM = "follows_from" - """The parent Span does not depend in any way on the result of the child Span.""" - - -class DbSystemValues(Enum): - OTHER_SQL = "other_sql" - """Some other SQL database. Fallback only. See notes.""" - - MSSQL = "mssql" - """Microsoft SQL Server.""" - - MYSQL = "mysql" - """MySQL.""" - - ORACLE = "oracle" - """Oracle Database.""" - - DB2 = "db2" - """IBM Db2.""" - - POSTGRESQL = "postgresql" - """PostgreSQL.""" - - REDSHIFT = "redshift" - """Amazon Redshift.""" - - HIVE = "hive" - """Apache Hive.""" - - CLOUDSCAPE = "cloudscape" - """Cloudscape.""" - - HSQLDB = "hsqldb" - """HyperSQL DataBase.""" - - PROGRESS = "progress" - """Progress Database.""" - - MAXDB = "maxdb" - """SAP MaxDB.""" - - HANADB = "hanadb" - """SAP HANA.""" - - INGRES = "ingres" - """Ingres.""" - - FIRSTSQL = "firstsql" - """FirstSQL.""" - - EDB = "edb" - """EnterpriseDB.""" - - CACHE = "cache" - """InterSystems Caché.""" - - ADABAS = "adabas" - """Adabas (Adaptable Database System).""" - - FIREBIRD = "firebird" - """Firebird.""" - - DERBY = "derby" - """Apache Derby.""" - - FILEMAKER = "filemaker" - """FileMaker.""" - - INFORMIX = "informix" - """Informix.""" - - INSTANTDB = "instantdb" - """InstantDB.""" - - INTERBASE = "interbase" - """InterBase.""" - - MARIADB = "mariadb" - """MariaDB.""" - - NETEZZA = "netezza" - """Netezza.""" - - PERVASIVE = "pervasive" - """Pervasive PSQL.""" - - POINTBASE = "pointbase" - """PointBase.""" - - SQLITE = "sqlite" - """SQLite.""" - - SYBASE = "sybase" - """Sybase.""" - - TERADATA = "teradata" - """Teradata.""" - - VERTICA = "vertica" - """Vertica.""" - - H2 = "h2" - """H2.""" - - COLDFUSION = "coldfusion" - """ColdFusion IMQ.""" - - CASSANDRA = "cassandra" - """Apache Cassandra.""" - - HBASE = "hbase" - """Apache HBase.""" - - MONGODB = "mongodb" - """MongoDB.""" - - REDIS = "redis" - """Redis.""" - - COUCHBASE = "couchbase" - """Couchbase.""" - - COUCHDB = "couchdb" - """CouchDB.""" - - COSMOSDB = "cosmosdb" - """Microsoft Azure Cosmos DB.""" - - DYNAMODB = "dynamodb" - """Amazon DynamoDB.""" - - NEO4J = "neo4j" - """Neo4j.""" - - GEODE = "geode" - """Apache Geode.""" - - ELASTICSEARCH = "elasticsearch" - """Elasticsearch.""" - - MEMCACHED = "memcached" - """Memcached.""" - - COCKROACHDB = "cockroachdb" - """CockroachDB.""" - - -class NetTransportValues(Enum): - IP_TCP = "ip_tcp" - """ip_tcp.""" - - IP_UDP = "ip_udp" - """ip_udp.""" - - IP = "ip" - """Another IP-based protocol.""" - - UNIX = "unix" - """Unix Domain socket. See below.""" - - PIPE = "pipe" - """Named or anonymous pipe. See note below.""" - - INPROC = "inproc" - """In-process communication.""" - - OTHER = "other" - """Something else (non IP-based).""" - - -class DbCassandraConsistencyLevelValues(Enum): - ALL = "all" - """all.""" - - EACH_QUORUM = "each_quorum" - """each_quorum.""" - - QUORUM = "quorum" - """quorum.""" - - LOCAL_QUORUM = "local_quorum" - """local_quorum.""" - - ONE = "one" - """one.""" - - TWO = "two" - """two.""" - - THREE = "three" - """three.""" - - LOCAL_ONE = "local_one" - """local_one.""" - - ANY = "any" - """any.""" - - SERIAL = "serial" - """serial.""" - - LOCAL_SERIAL = "local_serial" - """local_serial.""" - - -class FaasTriggerValues(Enum): - DATASOURCE = "datasource" - """A response to some data source operation such as a database or filesystem read/write.""" - - HTTP = "http" - """To provide an answer to an inbound HTTP request.""" - - PUBSUB = "pubsub" - """A function is set to be executed when messages are sent to a messaging system.""" - - TIMER = "timer" - """A function is scheduled to be executed regularly.""" - - OTHER = "other" - """If none of the others apply.""" - - -class FaasDocumentOperationValues(Enum): - INSERT = "insert" - """When a new object is created.""" - - EDIT = "edit" - """When an object is modified.""" - - DELETE = "delete" - """When an object is deleted.""" - - -class HttpFlavorValues(Enum): - HTTP_1_0 = "1.0" - """HTTP/1.0.""" - - HTTP_1_1 = "1.1" - """HTTP/1.1.""" - - HTTP_2_0 = "2.0" - """HTTP/2.""" - - HTTP_3_0 = "3.0" - """HTTP/3.""" - - SPDY = "SPDY" - """SPDY protocol.""" - - QUIC = "QUIC" - """QUIC protocol.""" - - -class NetHostConnectionTypeValues(Enum): - WIFI = "wifi" - """wifi.""" - - WIRED = "wired" - """wired.""" - - CELL = "cell" - """cell.""" - - UNAVAILABLE = "unavailable" - """unavailable.""" - - UNKNOWN = "unknown" - """unknown.""" - - -class NetHostConnectionSubtypeValues(Enum): - GPRS = "gprs" - """GPRS.""" - - EDGE = "edge" - """EDGE.""" - - UMTS = "umts" - """UMTS.""" - - CDMA = "cdma" - """CDMA.""" - - EVDO_0 = "evdo_0" - """EVDO Rel. 0.""" - - EVDO_A = "evdo_a" - """EVDO Rev. A.""" - - CDMA2000_1XRTT = "cdma2000_1xrtt" - """CDMA2000 1XRTT.""" - - HSDPA = "hsdpa" - """HSDPA.""" - - HSUPA = "hsupa" - """HSUPA.""" - - HSPA = "hspa" - """HSPA.""" - - IDEN = "iden" - """IDEN.""" - - EVDO_B = "evdo_b" - """EVDO Rev. B.""" - - LTE = "lte" - """LTE.""" - - EHRPD = "ehrpd" - """EHRPD.""" - - HSPAP = "hspap" - """HSPAP.""" - - GSM = "gsm" - """GSM.""" - - TD_SCDMA = "td_scdma" - """TD-SCDMA.""" - - IWLAN = "iwlan" - """IWLAN.""" - - NR = "nr" - """5G NR (New Radio).""" - - NRNSA = "nrnsa" - """5G NRNSA (New Radio Non-Standalone).""" - - LTE_CA = "lte_ca" - """LTE CA.""" - - -class MessagingDestinationKindValues(Enum): - QUEUE = "queue" - """A message sent to a queue.""" - - TOPIC = "topic" - """A message sent to a topic.""" - - -class FaasInvokedProviderValues(Enum): - ALIBABA_CLOUD = "alibaba_cloud" - """Alibaba Cloud.""" - - AWS = "aws" - """Amazon Web Services.""" - - AZURE = "azure" - """Microsoft Azure.""" - - GCP = "gcp" - """Google Cloud Platform.""" - - TENCENT_CLOUD = "tencent_cloud" - """Tencent Cloud.""" - - -class RpcSystemValues(Enum): - GRPC = "grpc" - """gRPC.""" - - JAVA_RMI = "java_rmi" - """Java RMI.""" - - DOTNET_WCF = "dotnet_wcf" - """.NET WCF.""" - - APACHE_DUBBO = "apache_dubbo" - """Apache Dubbo.""" - - -class MessagingOperationValues(Enum): - RECEIVE = "receive" - """receive.""" - - PROCESS = "process" - """process.""" - - -class MessagingRocketmqMessageTypeValues(Enum): - NORMAL = "normal" - """Normal message.""" - - FIFO = "fifo" - """FIFO message.""" - - DELAY = "delay" - """Delay message.""" - - TRANSACTION = "transaction" - """Transaction message.""" - - -class MessagingRocketmqConsumptionModelValues(Enum): - CLUSTERING = "clustering" - """Clustering consumption model.""" - - BROADCASTING = "broadcasting" - """Broadcasting consumption model.""" - - -class RpcGrpcStatusCodeValues(Enum): - OK = 0 - """OK.""" - - CANCELLED = 1 - """CANCELLED.""" - - UNKNOWN = 2 - """UNKNOWN.""" - - INVALID_ARGUMENT = 3 - """INVALID_ARGUMENT.""" - - DEADLINE_EXCEEDED = 4 - """DEADLINE_EXCEEDED.""" - - NOT_FOUND = 5 - """NOT_FOUND.""" - - ALREADY_EXISTS = 6 - """ALREADY_EXISTS.""" - - PERMISSION_DENIED = 7 - """PERMISSION_DENIED.""" - - RESOURCE_EXHAUSTED = 8 - """RESOURCE_EXHAUSTED.""" - - FAILED_PRECONDITION = 9 - """FAILED_PRECONDITION.""" - - ABORTED = 10 - """ABORTED.""" - - OUT_OF_RANGE = 11 - """OUT_OF_RANGE.""" - - UNIMPLEMENTED = 12 - """UNIMPLEMENTED.""" - - INTERNAL = 13 - """INTERNAL.""" - - UNAVAILABLE = 14 - """UNAVAILABLE.""" - - DATA_LOSS = 15 - """DATA_LOSS.""" - - UNAUTHENTICATED = 16 - """UNAUTHENTICATED.""" - - -class MessageTypeValues(Enum): - SENT = "SENT" - """sent.""" - - RECEIVED = "RECEIVED" - """received.""" diff --git a/opensafely/_vendor/opentelemetry/semconv/version.py b/opensafely/_vendor/opentelemetry/semconv/version.py deleted file mode 100644 index 6b280156..00000000 --- a/opensafely/_vendor/opentelemetry/semconv/version.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# 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. - -__version__ = "0.33b0" diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info.pyi b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info.pyi deleted file mode 100644 index 3d416b14..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/INSTALLER b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/LICENSE b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/METADATA b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/METADATA deleted file mode 100644 index 9f2c6f7d..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/METADATA +++ /dev/null @@ -1,56 +0,0 @@ -Metadata-Version: 2.1 -Name: opentelemetry-exporter-otlp-proto-http -Version: 1.12.0 -Summary: OpenTelemetry Collector Protobuf over HTTP Exporter -Home-page: https://github.com/open-telemetry/opentelemetry-python/tree/main/exporter/opentelemetry-exporter-otlp-proto-http -Author: OpenTelemetry Authors -Author-email: cncf-opentelemetry-contributors@lists.cncf.io -License: Apache-2.0 -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Requires-Python: >=3.6 -Description-Content-Type: text/x-rst -License-File: LICENSE -Requires-Dist: requests (~=2.7) -Requires-Dist: googleapis-common-protos (~=1.52) -Requires-Dist: opentelemetry-api (~=1.3) -Requires-Dist: opentelemetry-sdk (~=1.11) -Requires-Dist: opentelemetry-proto (==1.12.0) -Requires-Dist: backoff (<2.0.0,>=1.10.0) ; python_version < "3.7" -Requires-Dist: backoff (<3.0.0,>=1.10.0) ; python_version >= "3.7" -Provides-Extra: test - -OpenTelemetry Collector Protobuf over HTTP Exporter -=================================================== - -|pypi| - -.. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-otlp-proto-http.svg - :target: https://pypi.org/project/opentelemetry-exporter-otlp-proto-http/ - -This library allows to export data to the OpenTelemetry Collector using the OpenTelemetry Protocol using Protobuf over HTTP. - -Installation ------------- - -:: - - pip install opentelemetry-exporter-otlp-proto-http - - -References ----------- - -* `OpenTelemetry Collector Exporter `_ -* `OpenTelemetry Collector `_ -* `OpenTelemetry `_ -* `OpenTelemetry Protocol Specification `_ diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/RECORD b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/RECORD deleted file mode 100644 index 6fb7dc1b..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/RECORD +++ /dev/null @@ -1,14 +0,0 @@ -opentelemetry/exporter/otlp/proto/http/__init__.py,sha256=7yAq15MLoxdbiTaw_Lc1uMInPv5zbaOCeL3nH74LE9Q,2513 -opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py,sha256=5rOMfBH2LlhixkWYVlG-1tb1ttWEYQe8HlOO-IyG7v4,5689 -opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py,sha256=vo--9E4ccSzKqQ39tv6LlOa6cIavRYYzEjrqCnCFwAY,3525 -opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py,sha256=uXseNMND2vUmyCzb2LnK4x_lTBRQnjYNALMXTP50nQA,6294 -opentelemetry/exporter/otlp/proto/http/trace_exporter/encoder/__init__.py,sha256=W-d5OCUnLLRNPvygyUDktEQVH0M6z72qiEIxDPjKpv8,9964 -opentelemetry/exporter/otlp/proto/http/version.py,sha256=yk1jvTkr9u44V9-UKXzc2yZoks579w8PMizujHde9S4,608 -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350 -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/METADATA,sha256=rZmIotoj1OBv0PxcUTTNHR0iUoLj1L6niMOcvZXH4Fg,2244 -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/RECORD,, -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/entry_points.txt,sha256=my4WVswTKy4Gpmj3rSXFHy1CBON2gcNSIt1cB-Vog30,121 -opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/top_level.txt,sha256=5p97iTMneNm1LAKDalzEVpYhvPZsaqJZzdLuD_upSaQ,14 diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/REQUESTED b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/WHEEL b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/WHEEL deleted file mode 100644 index becc9a66..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/entry_points.txt b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/entry_points.txt deleted file mode 100644 index ffba3490..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[opentelemetry_traces_exporter] -otlp_proto_http = opentelemetry.exporter.otlp.proto.http.trace_exporter:OTLPSpanExporter diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/top_level.txt b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/top_level.txt deleted file mode 100644 index 25138d19..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http-1.12.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -opentelemetry diff --git a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http.LICENSE b/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http.LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_exporter_otlp_proto_http.LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info.pyi b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info.pyi deleted file mode 100644 index d3afded9..00000000 --- a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from opentelemetry_proto-1.12.0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/INSTALLER b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/LICENSE b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/METADATA b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/METADATA deleted file mode 100644 index 6ab3a04c..00000000 --- a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/METADATA +++ /dev/null @@ -1,65 +0,0 @@ -Metadata-Version: 2.1 -Name: opentelemetry-proto -Version: 1.12.0 -Summary: OpenTelemetry Python Proto -Home-page: https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-proto -Author: OpenTelemetry Authors -Author-email: cncf-opentelemetry-contributors@lists.cncf.io -License: Apache-2.0 -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Requires-Python: >=3.6 -Description-Content-Type: text/x-rst -License-File: LICENSE -Requires-Dist: protobuf (~=3.13) -Provides-Extra: test - -OpenTelemetry Python Proto -========================== - -|pypi| - -.. |pypi| image:: https://badge.fury.io/py/opentelemetry-proto.svg - :target: https://pypi.org/project/opentelemetry-proto/ - -This library contains the generated code for OpenTelemetry protobuf data model. The code in the current -package was generated using the v0.17.0 release_ of opentelemetry-proto. - -.. _release: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.17.0 - -Installation ------------- - -:: - - pip install opentelemetry-proto - -Code Generation ---------------- - -These files were generated automatically from code in opentelemetry-proto_. -To regenerate the code, run ``../scripts/proto_codegen.sh``. - -To build against a new release or specific commit of opentelemetry-proto_, -update the ``PROTO_REPO_BRANCH_OR_COMMIT`` variable in -``../scripts/proto_codegen.sh``. Then run the script and commit the changes -as well as any fixes needed in the OTLP exporter. - -.. _opentelemetry-proto: https://github.com/open-telemetry/opentelemetry-proto - - -References ----------- - -* `OpenTelemetry Project `_ -* `OpenTelemetry Proto `_ -* `proto_codegen.sh script `_ diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/RECORD b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/RECORD deleted file mode 100644 index 8df65994..00000000 --- a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/RECORD +++ /dev/null @@ -1,46 +0,0 @@ -opentelemetry/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/collector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/collector/logs/v1/logs_service_pb2.py,sha256=MazcXAjdmjMu22bmo73SACuvtEu-SfrCtADZKro4Te0,5164 -opentelemetry/proto/collector/logs/v1/logs_service_pb2.pyi,sha256=3SfS5ZlUHI2W0NGvKHMJhhf07GN0kKHFlGLHNvhZF1o,1644 -opentelemetry/proto/collector/logs/v1/logs_service_pb2_grpc.py,sha256=Qt7xB0cimW1NTsg4x89Q-8Wa7EmIPzN-swTasdeSGHU,3667 -opentelemetry/proto/collector/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/collector/metrics/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py,sha256=eeQrrYi2u6oOmygMC1qergp8eTbM4iLwWh5da4NJLek,5411 -opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.pyi,sha256=TWLf-Fi-R88qAYWA140ZwWnbFry4xK2OKBOgXqq2T3s,1704 -opentelemetry/proto/collector/metrics/v1/metrics_service_pb2_grpc.py,sha256=FJCNnodvUvkzrnfdzuC0xRoVRQKKUBTcfuEa05My7Vw,3562 -opentelemetry/proto/collector/trace/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/collector/trace/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/collector/trace/v1/trace_service_pb2.py,sha256=u3fF9bTYwnbsy1O4h6S-pQyGJlt0W0wBrPe2ac1EPyA,5254 -opentelemetry/proto/collector/trace/v1/trace_service_pb2.pyi,sha256=akOOruhqO-yQUfPE7NCZsNa9-m0yATT80SeSldXLjXY,1664 -opentelemetry/proto/collector/trace/v1/trace_service_pb2_grpc.py,sha256=x_c-4mOkimH-4WUC-CQGZMTNjk3_6hpMcyhJHF0y0po,3699 -opentelemetry/proto/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/common/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/common/v1/common_pb2.py,sha256=HlItmb-c5rtv9nkqg4DEfCRJfAo2h7ZTseLgNe9TqO0,15744 -opentelemetry/proto/common/v1/common_pb2.pyi,sha256=ba2Br9E1xOY-2W15Eo9hqka14YH_ofV61Bzij9Kug4o,7014 -opentelemetry/proto/logs/v1/logs_pb2.py,sha256=xEAturKPh6QdEZDzv_ob15UjWv1-pxKLv24EmGSSKSs,26292 -opentelemetry/proto/logs/v1/logs_pb2.pyi,sha256=KvBo1BLuU1CUcGaAntBb3KnXN063xy1ZRAZfDFrkHTw,17700 -opentelemetry/proto/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py,sha256=2YvY3ktfpeQZ6I9dGacr-wBxQom2qwOa2TmyT5nW84k,13516 -opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi,sha256=EUM5wENPvxHrkaVmyLhm17ZnMpaf2VuCsANcz0lFQyw,7070 -opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py,sha256=aQysCkSI7e-OTeJqB-YHf7Gu9dcK0S9snUSgYsNYWwI,4255 -opentelemetry/proto/metrics/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/metrics/v1/metrics_pb2.py,sha256=tHxIy2E2Fjgy-JxR_SATxw7y8JuBZNtg8W_Bf4P6KEg,66452 -opentelemetry/proto/metrics/v1/metrics_pb2.pyi,sha256=YYxFizx_NSqvGZ3n-s0FK12hHO9-SVCw8ord8UkR6TE,55240 -opentelemetry/proto/resource/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/resource/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/resource/v1/resource_pb2.py,sha256=wBBC4dnXSZTPYW5jPkC42v7nTRliyzzuW1w1Dp45EaU,3386 -opentelemetry/proto/resource/v1/resource_pb2.pyi,sha256=oBa7JnVQP4_8-1lQcNgF4FQfFj4vQWeKYDmZp_asRM0,1545 -opentelemetry/proto/trace/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/trace/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/proto/trace/v1/trace_config_pb2.py,sha256=CTPnAs6cnS4U5WJvn4twD4EcX53FCVB4DVQrIA-yxuU,13061 -opentelemetry/proto/trace/v1/trace_config_pb2.pyi,sha256=sMvZNiU6mcr9tobtRHmwpH1dpruTkX5PaUg63fK0Fbg,6181 -opentelemetry/proto/trace/v1/trace_pb2.py,sha256=EgOX4z7wAzByoFSS8_SMX3JW82HSbleBNbcXd31eiEU,31612 -opentelemetry/proto/trace/v1/trace_pb2.pyi,sha256=rB8GcW4OUioKxnczgTs-qQqhVgfhrCxyx0cBF2nK5MM,26510 -opentelemetry/proto/version.py,sha256=yk1jvTkr9u44V9-UKXzc2yZoks579w8PMizujHde9S4,608 -opentelemetry_proto-1.12.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -opentelemetry_proto-1.12.0.dist-info/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350 -opentelemetry_proto-1.12.0.dist-info/METADATA,sha256=Byu99H0TQri5nk7VYOcwOAgQ8F_OTFTnGV-9nuD9XlQ,2275 -opentelemetry_proto-1.12.0.dist-info/RECORD,, -opentelemetry_proto-1.12.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry_proto-1.12.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -opentelemetry_proto-1.12.0.dist-info/top_level.txt,sha256=5p97iTMneNm1LAKDalzEVpYhvPZsaqJZzdLuD_upSaQ,14 diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/REQUESTED b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/WHEEL b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/WHEEL deleted file mode 100644 index becc9a66..00000000 --- a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/top_level.txt b/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/top_level.txt deleted file mode 100644 index 25138d19..00000000 --- a/opensafely/_vendor/opentelemetry_proto-1.12.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -opentelemetry diff --git a/opensafely/_vendor/opentelemetry_proto.LICENSE b/opensafely/_vendor/opentelemetry_proto.LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_proto.LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info.pyi b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info.pyi deleted file mode 100644 index d80c4d5c..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from opentelemetry_sdk-1.12.0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/INSTALLER b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/LICENSE b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/METADATA b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/METADATA deleted file mode 100644 index c43bbbfe..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/METADATA +++ /dev/null @@ -1,49 +0,0 @@ -Metadata-Version: 2.1 -Name: opentelemetry-sdk -Version: 1.12.0 -Summary: OpenTelemetry Python SDK -Home-page: https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-sdk -Author: OpenTelemetry Authors -Author-email: cncf-opentelemetry-contributors@lists.cncf.io -License: Apache-2.0 -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Typing :: Typed -Requires-Python: >=3.6 -Description-Content-Type: text/x-rst -License-File: LICENSE -Requires-Dist: opentelemetry-api (==1.12.0) -Requires-Dist: opentelemetry-semantic-conventions (==0.33b0) -Requires-Dist: setuptools (>=16.0) -Requires-Dist: typing-extensions (>=3.7.4) -Requires-Dist: dataclasses (==0.8) ; python_version < "3.7" -Provides-Extra: test - -OpenTelemetry Python SDK -============================================================================ - -|pypi| - -.. |pypi| image:: https://badge.fury.io/py/opentelemetry-sdk.svg - :target: https://pypi.org/project/opentelemetry-sdk/ - -Installation ------------- - -:: - - pip install opentelemetry-sdk - -References ----------- - -* `OpenTelemetry Project `_ diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/RECORD b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/RECORD deleted file mode 100644 index 25ef2363..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/RECORD +++ /dev/null @@ -1,42 +0,0 @@ -opentelemetry/sdk/__init__.pyi,sha256=kQMbMw8wLQtWJ1bVBm7XoI06B_4Fv0un5hv3FKwrgRQ,669 -opentelemetry/sdk/_configuration/__init__.py,sha256=obHX943CEsMOCoQAGOFkWcNmy0aOmLpeT8Knm9HQwM0,9868 -opentelemetry/sdk/_logs/__init__.py,sha256=mn4tT38l59gg6No5vMgVN0rjFOl4CrMbH_Im3qUwopQ,17241 -opentelemetry/sdk/_logs/export/__init__.py,sha256=mcJVG2XeaZUxRp5gQxzp9Gvn1RErubBw36v03vZvKPQ,10951 -opentelemetry/sdk/_logs/export/in_memory_log_exporter.py,sha256=bkVQmGnkkxX3wFDNM_6Aumjjpw7Jjnvfzel_59byIAU,1667 -opentelemetry/sdk/_logs/severity.py,sha256=EHQ4ze8Hn5z13BFTLUrsxyK65j35GHsO0TlxbhH4FVQ,3232 -opentelemetry/sdk/environment_variables.py,sha256=srDyn2LO0MXKFirYVgb5SPExmVrQOKHp9IwaTPnqriI,15072 -opentelemetry/sdk/error_handler/__init__.py,sha256=ZI9lV7zFkUNTKuOkRzvTigXTAw2u5yJ6537d1QwH4po,4553 -opentelemetry/sdk/metrics/__init__.py,sha256=XdboRpYWaaZQcYDdL-8Marm2fwZr4931MgkdDYdOneM,1167 -opentelemetry/sdk/metrics/_internal/__init__.py,sha256=rJg2YCA5XWw-qlx1XBJYSAOjdlav7VPHgq4hCnjcu2Q,17385 -opentelemetry/sdk/metrics/_internal/_view_instrument_match.py,sha256=wgN_I2JhFDg673bXv0NZSqlp1l17EY7K_YbaInHMRGc,5230 -opentelemetry/sdk/metrics/_internal/aggregation.py,sha256=EMYJinH7eMLhKG7Zlz6ZqqfJXiYfrz2Ik8Np3I1-0Uo,17068 -opentelemetry/sdk/metrics/_internal/exceptions.py,sha256=_0bPg3suYoIXKJ7eCqG3S_gUKVcUAHp11vwThwp_yAg,675 -opentelemetry/sdk/metrics/_internal/export/__init__.py,sha256=YXUgzDuOCacekJ541Oe0S124CqlDGqBo1Rir-N4NUco,18743 -opentelemetry/sdk/metrics/_internal/instrument.py,sha256=BG84n68dpvT4m2C3DlkmjQJSnmwviJjQR0N8KoGvDUY,7882 -opentelemetry/sdk/metrics/_internal/measurement.py,sha256=oFyLgrizpDBI4R8VCwPeBtlhZOK-C9Lxbr-PzgOF3ew,959 -opentelemetry/sdk/metrics/_internal/measurement_consumer.py,sha256=OOsD0Pla_zBuBeBK9D3LsDltj3pXDvYHBGz3crH2U8c,4366 -opentelemetry/sdk/metrics/_internal/metric_reader_storage.py,sha256=C7SbuN8xOT-_ynJOM6jB5K13afdJjyvUy0J6HuhpQL4,11303 -opentelemetry/sdk/metrics/_internal/point.py,sha256=YKFCHIspgbBOk5o0Rex7vlB2zd7aqOEzZ-yc9lAi6to,6107 -opentelemetry/sdk/metrics/_internal/sdk_configuration.py,sha256=JG77yWdEH_MHzUIbvS_W2PiXKlcwOSd5wTiWAM0ihJo,1020 -opentelemetry/sdk/metrics/_internal/view.py,sha256=JlOy-tNUzuToU09uTIbgpn9GfVZZpRS6ooyrJbvUZYE,5968 -opentelemetry/sdk/metrics/export/__init__.py,sha256=RXBqQCXCc8q8BXJke1Eem57c3Ew6kNB_Dflilortf1E,1535 -opentelemetry/sdk/metrics/view/__init__.py,sha256=xrGni20CriMAgR37zsJm44vsitH0tWOF0cyFHojs_Xc,1070 -opentelemetry/sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/sdk/resources/__init__.py,sha256=3I7kq5IARF5r0eFfAEzCYu2IqW4ejf0YRiGX42Smkm8,13410 -opentelemetry/sdk/trace/__init__.py,sha256=ICDN8XL9ZQTIPEp-1DJIIdEi623HZsdwBNQ-urPYR9s,42335 -opentelemetry/sdk/trace/export/__init__.py,sha256=wNfOFw8pP0i2TTO_3C6Aa4apbjOVUPKBDEOlRxmnEFs,14926 -opentelemetry/sdk/trace/export/in_memory_span_exporter.py,sha256=If8c5BfnfEfp50mJhKAY4Y1P-mg-CIoHpN3AjSP0iHo,1941 -opentelemetry/sdk/trace/id_generator.py,sha256=aW-YwsqTSXXNn4iQQFwhfp9M0D3AobxCqHlRW2KrjxI,1682 -opentelemetry/sdk/trace/sampling.py,sha256=RhxmYBInYmMz9SYsZERxKV29f6NhfvXJeor7yYFxMlk,14649 -opentelemetry/sdk/util/__init__.py,sha256=MGABQOB9Mtm82Uv8f0RIwX739nQJtQEGTgsfBV5TpM8,4386 -opentelemetry/sdk/util/__init__.pyi,sha256=RFOnfLwZeldVdlnlEzUJwjL8wqAUwHdJ4anf5P_oBoE,2227 -opentelemetry/sdk/util/instrumentation.py,sha256=M04crSpicNbaacSTxbT6szCHPIt0aw5qBHeMCdl0pPw,4144 -opentelemetry/sdk/version.py,sha256=yk1jvTkr9u44V9-UKXzc2yZoks579w8PMizujHde9S4,608 -opentelemetry_sdk-1.12.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -opentelemetry_sdk-1.12.0.dist-info/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350 -opentelemetry_sdk-1.12.0.dist-info/METADATA,sha256=Ldtn4_cwzAS4VV_2vLeHWqNgHcp9_DyjngbAVimYgSo,1571 -opentelemetry_sdk-1.12.0.dist-info/RECORD,, -opentelemetry_sdk-1.12.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry_sdk-1.12.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -opentelemetry_sdk-1.12.0.dist-info/entry_points.txt,sha256=Xlo39ks4dWfOgoMUt9U-FTTTp-iy-w_0ip8-UL00Pmo,757 -opentelemetry_sdk-1.12.0.dist-info/top_level.txt,sha256=5p97iTMneNm1LAKDalzEVpYhvPZsaqJZzdLuD_upSaQ,14 diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/REQUESTED b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/WHEEL b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/WHEEL deleted file mode 100644 index becc9a66..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/entry_points.txt b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/entry_points.txt deleted file mode 100644 index e1e9e2fc..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/entry_points.txt +++ /dev/null @@ -1,23 +0,0 @@ -[opentelemetry_environment_variables] -sdk = opentelemetry.sdk.environment_variables - -[opentelemetry_id_generator] -random = opentelemetry.sdk.trace.id_generator:RandomIdGenerator - -[opentelemetry_log_emitter_provider] -sdk_log_emitter_provider = opentelemetry.sdk._logs:LogEmitterProvider - -[opentelemetry_logs_exporter] -console = opentelemetry.sdk._logs.export:ConsoleLogExporter - -[opentelemetry_meter_provider] -sdk_meter_provider = opentelemetry.sdk.metrics:MeterProvider - -[opentelemetry_metrics_exporter] -console = opentelemetry.sdk.metrics.export:ConsoleMetricExporter - -[opentelemetry_tracer_provider] -sdk_tracer_provider = opentelemetry.sdk.trace:TracerProvider - -[opentelemetry_traces_exporter] -console = opentelemetry.sdk.trace.export:ConsoleSpanExporter diff --git a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/top_level.txt b/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/top_level.txt deleted file mode 100644 index 25138d19..00000000 --- a/opensafely/_vendor/opentelemetry_sdk-1.12.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -opentelemetry diff --git a/opensafely/_vendor/opentelemetry_sdk.LICENSE b/opensafely/_vendor/opentelemetry_sdk.LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_sdk.LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info.pyi b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info.pyi deleted file mode 100644 index b51b68fa..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from opentelemetry_semantic_conventions-0.33b0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/INSTALLER b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/LICENSE b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/METADATA b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/METADATA deleted file mode 100644 index 1da67af7..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/METADATA +++ /dev/null @@ -1,61 +0,0 @@ -Metadata-Version: 2.1 -Name: opentelemetry-semantic-conventions -Version: 0.33b0 -Summary: OpenTelemetry Semantic Conventions -Home-page: https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-semantic-conventions -Author: OpenTelemetry Authors -Author-email: cncf-opentelemetry-contributors@lists.cncf.io -License: Apache-2.0 -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Requires-Python: >=3.6 -Description-Content-Type: text/x-rst -License-File: LICENSE -Provides-Extra: test - -OpenTelemetry Semantic Conventions -================================== - -|pypi| - -.. |pypi| image:: https://badge.fury.io/py/opentelemetry-semantic-conventions.svg - :target: https://pypi.org/project/opentelemetry-semantic-conventions/ - -This library contains generated code for the semantic conventions defined by the OpenTelemetry specification. - -Installation ------------- - -:: - - pip install opentelemetry-semantic-conventions - -Code Generation ---------------- - -These files were generated automatically from code in semconv_. -To regenerate the code, run ``../scripts/semconv/generate.sh``. - -To build against a new release or specific commit of opentelemetry-specification_, -update the ``SPEC_VERSION`` variable in -``../scripts/semconv/generate.sh``. Then run the script and commit the changes. - -.. _opentelemetry-specification: https://github.com/open-telemetry/opentelemetry-specification -.. _semconv: https://github.com/open-telemetry/opentelemetry-python/tree/main/scripts/semconv - - -References ----------- - -* `OpenTelemetry Project `_ -* `OpenTelemetry Semantic Conventions YAML Definitions `_ -* `generate.sh script `_ diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/RECORD b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/RECORD deleted file mode 100644 index 65865dfe..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/RECORD +++ /dev/null @@ -1,11 +0,0 @@ -opentelemetry/semconv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/semconv/resource/__init__.py,sha256=wCFlk_4WDVbnzNSNbfLKOUxPDsgti1fLR0cuZK_i8Y8,21915 -opentelemetry/semconv/trace/__init__.py,sha256=r6agWFOT4XpeNLGVqgOnA5Jnnerbg07YyuMKycvtO_A,38732 -opentelemetry/semconv/version.py,sha256=AmoWQD5UWhG5JjlZjacII2YQ7Yn1z_3Si2crzr9RVi0,608 -opentelemetry_semantic_conventions-0.33b0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -opentelemetry_semantic_conventions-0.33b0.dist-info/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350 -opentelemetry_semantic_conventions-0.33b0.dist-info/METADATA,sha256=g5RQ0e6uJfQ3ZRkwGhyTmv6zR2zKVk31zHArwuFKwZI,2302 -opentelemetry_semantic_conventions-0.33b0.dist-info/RECORD,, -opentelemetry_semantic_conventions-0.33b0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry_semantic_conventions-0.33b0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -opentelemetry_semantic_conventions-0.33b0.dist-info/top_level.txt,sha256=5p97iTMneNm1LAKDalzEVpYhvPZsaqJZzdLuD_upSaQ,14 diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/REQUESTED b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/WHEEL b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/WHEEL deleted file mode 100644 index becc9a66..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/top_level.txt b/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/top_level.txt deleted file mode 100644 index 25138d19..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions-0.33b0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -opentelemetry diff --git a/opensafely/_vendor/opentelemetry_semantic_conventions.LICENSE b/opensafely/_vendor/opentelemetry_semantic_conventions.LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_semantic_conventions.LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info.pyi b/opensafely/_vendor/protobuf-3.20.2.dist-info.pyi deleted file mode 100644 index b528424d..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from protobuf-3.20.2.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/INSTALLER b/opensafely/_vendor/protobuf-3.20.2.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/LICENSE b/opensafely/_vendor/protobuf-3.20.2.dist-info/LICENSE deleted file mode 100644 index 19b305b0..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info/LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -Copyright 2008 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Code generated by the Protocol Buffer compiler is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/METADATA b/opensafely/_vendor/protobuf-3.20.2.dist-info/METADATA deleted file mode 100644 index 30b8a9e3..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info/METADATA +++ /dev/null @@ -1,21 +0,0 @@ -Metadata-Version: 2.1 -Name: protobuf -Version: 3.20.2 -Summary: Protocol Buffers -Home-page: https://developers.google.com/protocol-buffers/ -Maintainer: protobuf@googlegroups.com -Maintainer-email: protobuf@googlegroups.com -License: BSD-3-Clause -Download-URL: https://github.com/protocolbuffers/protobuf/releases -Platform: UNKNOWN -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Requires-Python: >=3.7 -License-File: LICENSE - -Protocol Buffers are Google's data interchange format - diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/RECORD b/opensafely/_vendor/protobuf-3.20.2.dist-info/RECORD deleted file mode 100644 index 9d322db1..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info/RECORD +++ /dev/null @@ -1,54 +0,0 @@ -google/protobuf/__init__.py,sha256=8QnyrqDHTLNEFNSB8XlDzl8oUMD7DbkuEBlodn1bBkg,1705 -google/protobuf/any_pb2.py,sha256=TdTaU8MPj7tqjilhMbIK8m3AIP7Yvd08R2LoXojwYaE,1355 -google/protobuf/api_pb2.py,sha256=PMh7xH6vsLCW-y1f_A_0Qnx3PtSx-g2UsS4AIswXrcM,2539 -google/protobuf/compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/protobuf/compiler/plugin_pb2.py,sha256=Bv73ahQkWnOx9XH8YF5TrrzSPjksbqelnDTl63q17v0,2740 -google/protobuf/descriptor.py,sha256=DiDxSej4W4dt3Y_bvv0uCa9YwdCaMCe-WYFigii3VaA,46474 -google/protobuf/descriptor_database.py,sha256=2hBUBbzWjTdyq0nLZ9HYKbqhMpouzZVk9srurERnLVo,6819 -google/protobuf/descriptor_pb2.py,sha256=o5c8FFMBHDxryibe_JCEYO5xi4AAm_Te4xZeWlJ8hlI,109072 -google/protobuf/descriptor_pool.py,sha256=yHiZzzFTuh_LGp-WNHzGe4MVDpThNI3mtjV1bpkSAoY,47281 -google/protobuf/duration_pb2.py,sha256=KmfAu5bQ4GhoeqH06nJ7tjRbtov3b0ktUHohhNIl2p0,1430 -google/protobuf/empty_pb2.py,sha256=d6CTe50gpFNlRuXXyL6R1PU8WuLg8qqLsye7tElunFU,1319 -google/protobuf/field_mask_pb2.py,sha256=nNXqeAZhmPOsez6D7V5eA9VQICbB5mXNe1um1jmH-tA,1401 -google/protobuf/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/protobuf/internal/api_implementation.py,sha256=rma5XlGOY6x35S55AS5bSOv0vq_211gjnL4Q9X74lpY,4562 -google/protobuf/internal/builder.py,sha256=wtugRgYbIMeo4txvGUlfFLD8nKZEDCxH3lkRtyVndbY,5188 -google/protobuf/internal/containers.py,sha256=RH6NkwSCLzQ5qTgsvM04jkRjgCDNHFRWZyfSCvvv_rk,23328 -google/protobuf/internal/decoder.py,sha256=XDqpaEzqavV4Ka7jx2jonxCEyuKClxzbWPS2M4OTe0I,37567 -google/protobuf/internal/encoder.py,sha256=6hXWsTHCB-cumgbAMi5Z3JIxab8E5LD9p_iPS2HohiA,28656 -google/protobuf/internal/enum_type_wrapper.py,sha256=PKWYYZRexjkl4KrMnGa6Csq2xbKFXoqsWbwYHvJ0yiM,4821 -google/protobuf/internal/extension_dict.py,sha256=3DbWhlrpGybuur1bjfGKhx2d8IVo7tVQUEcF8tPLTyo,8443 -google/protobuf/internal/message_listener.py,sha256=Qwc5gkifAvWzhm3b0v-nXJkozNTgL-L92XAslngFaow,3367 -google/protobuf/internal/python_message.py,sha256=MEDGdNsrBo8OKk92s87J9qjJCQN_lkZCJHJXaA1th8U,58146 -google/protobuf/internal/type_checkers.py,sha256=a3o2y-S9XSFEiPUau5faEz2fu2OIxYhTM9ZGiLPCXlM,16912 -google/protobuf/internal/well_known_types.py,sha256=yLtyfrZ3svShTNgMW-U0TLt77pHsewi6xILDgabd-BY,30014 -google/protobuf/internal/wire_format.py,sha256=7Wz8gV7QOvoTzLMWrwlWSg7hIJ_T8Pm1w8_WLhpieVw,8444 -google/protobuf/json_format.py,sha256=egKnvgSRn62HI6UMWw-COTPfheBFERSqMNixp2iJZF0,35664 -google/protobuf/message.py,sha256=Gyj0Yb6eWiI47QO4DnA2W2J0WlDiRVm83FlKfO_Isf8,14523 -google/protobuf/message_factory.py,sha256=LD18eAKZ_tZnDzIUc_gDmrkxuwiYkUh-f-BkfVW7Wko,7482 -google/protobuf/proto_builder.py,sha256=WcEmUDU26k_JSiUzXJ7bgthgR7jlTiOecV1np0zGyA8,5506 -google/protobuf/pyext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/protobuf/pyext/cpp_message.py,sha256=D0-bxtjf1Ri8b0GubL5xgkkEB_z_mIf847yrRvVqDBU,2851 -google/protobuf/reflection.py,sha256=f61wP6k-HMShRwLsfRomScGzG0ZpWULpyhYwvjuZMKQ,3779 -google/protobuf/service.py,sha256=MGWgoxTrSlmqWsgXvp1XaP5Sg-_pq8Sw2XJuY1m6MVM,9146 -google/protobuf/service_reflection.py,sha256=5hBr8Q4gTgg3MT4NZoTxRSjTaxzLtNSG-8cXa5nHXaQ,11417 -google/protobuf/source_context_pb2.py,sha256=9sFLqhUhkTHkdKMZCQPQQ3GClbDMtOSlAy4P9LjPEvg,1416 -google/protobuf/struct_pb2.py,sha256=J16zp6HU5P2TyHpmAOzTvPDN_nih9uLg-z18-3bnFp0,2477 -google/protobuf/symbol_database.py,sha256=aCPGE4N2slb6HFB4cHFJDA8zehgMy16XY8BMH_ebfhc,6944 -google/protobuf/text_encoding.py,sha256=IrfncP112lKMLnWhhjXoczxEv2RZ9kzlinzAzHstrlY,4728 -google/protobuf/text_format.py,sha256=6aYyfB-htl2za_waO6LV9JVTPbx5Qj2vf0uE-cZdC6M,60006 -google/protobuf/timestamp_pb2.py,sha256=PTClFsyHjuwKHv4h6Ho1-GcMOfU3Rhd3edANjTQEbJI,1439 -google/protobuf/type_pb2.py,sha256=Iifx3dIukGbRBdYaJPQJADJ-ZcBdjztB1JvplT7EiJo,4425 -google/protobuf/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -google/protobuf/util/json_format_pb2.py,sha256=NR9GMe0hgwdbDEW5PyquvwAYcsHkPsobrnGV4sIyiis,6124 -google/protobuf/util/json_format_proto3_pb2.py,sha256=Gy7gqXLUPfSQkhmP6epX0-xODDGdE6pY57Mn93f4EmA,14095 -google/protobuf/wrappers_pb2.py,sha256=7g8cp-WcEg0HWzx53KagbAr9a4cjXJHGMraSM2i4Kc4,2410 -protobuf-3.20.2-nspkg.pth,sha256=xH5gTxc4UipYP3qrbP-4CCHNGBV97eBR4QqhheCvBl4,539 -protobuf-3.20.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -protobuf-3.20.2.dist-info/LICENSE,sha256=bl4RcySv2UTc9n82zzKYQ7wakiKajNm7Vz16gxMP6n0,1732 -protobuf-3.20.2.dist-info/METADATA,sha256=oOR5nNTho4zABjQBmC5LczMv-kSfEpf0DEwGZo2YoSo,720 -protobuf-3.20.2.dist-info/RECORD,, -protobuf-3.20.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -protobuf-3.20.2.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110 -protobuf-3.20.2.dist-info/namespace_packages.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7 -protobuf-3.20.2.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7 diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/REQUESTED b/opensafely/_vendor/protobuf-3.20.2.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/WHEEL b/opensafely/_vendor/protobuf-3.20.2.dist-info/WHEEL deleted file mode 100644 index 0b18a281..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/namespace_packages.txt b/opensafely/_vendor/protobuf-3.20.2.dist-info/namespace_packages.txt deleted file mode 100644 index cb429113..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info/namespace_packages.txt +++ /dev/null @@ -1 +0,0 @@ -google diff --git a/opensafely/_vendor/protobuf-3.20.2.dist-info/top_level.txt b/opensafely/_vendor/protobuf-3.20.2.dist-info/top_level.txt deleted file mode 100644 index cb429113..00000000 --- a/opensafely/_vendor/protobuf-3.20.2.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -google diff --git a/opensafely/_vendor/protobuf.LICENSE b/opensafely/_vendor/protobuf.LICENSE deleted file mode 100644 index 19b305b0..00000000 --- a/opensafely/_vendor/protobuf.LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -Copyright 2008 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Code generated by the Protocol Buffer compiler is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. diff --git a/opensafely/_vendor/typing_extensions-4.7.1.dist-info.pyi b/opensafely/_vendor/typing_extensions-4.7.1.dist-info.pyi deleted file mode 100644 index 3b64e829..00000000 --- a/opensafely/_vendor/typing_extensions-4.7.1.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from typing_extensions-4.7.1.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/INSTALLER b/opensafely/_vendor/typing_extensions-4.7.1.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/LICENSE b/opensafely/_vendor/typing_extensions-4.7.1.dist-info/LICENSE deleted file mode 100644 index f26bcf4d..00000000 --- a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/LICENSE +++ /dev/null @@ -1,279 +0,0 @@ -A. HISTORY OF THE SOFTWARE -========================== - -Python was created in the early 1990s by Guido van Rossum at Stichting -Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands -as a successor of a language called ABC. Guido remains Python's -principal author, although it includes many contributions from others. - -In 1995, Guido continued his work on Python at the Corporation for -National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) -in Reston, Virginia where he released several versions of the -software. - -In May 2000, Guido and the Python core development team moved to -BeOpen.com to form the BeOpen PythonLabs team. In October of the same -year, the PythonLabs team moved to Digital Creations, which became -Zope Corporation. In 2001, the Python Software Foundation (PSF, see -https://www.python.org/psf/) was formed, a non-profit organization -created specifically to own Python-related Intellectual Property. -Zope Corporation was a sponsoring member of the PSF. - -All Python releases are Open Source (see https://opensource.org for -the Open Source Definition). Historically, most, but not all, Python -releases have also been GPL-compatible; the table below summarizes -the various releases. - - Release Derived Year Owner GPL- - from compatible? (1) - - 0.9.0 thru 1.2 1991-1995 CWI yes - 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes - 1.6 1.5.2 2000 CNRI no - 2.0 1.6 2000 BeOpen.com no - 1.6.1 1.6 2001 CNRI yes (2) - 2.1 2.0+1.6.1 2001 PSF no - 2.0.1 2.0+1.6.1 2001 PSF yes - 2.1.1 2.1+2.0.1 2001 PSF yes - 2.1.2 2.1.1 2002 PSF yes - 2.1.3 2.1.2 2002 PSF yes - 2.2 and above 2.1.1 2001-now PSF yes - -Footnotes: - -(1) GPL-compatible doesn't mean that we're distributing Python under - the GPL. All Python licenses, unlike the GPL, let you distribute - a modified version without making your changes open source. The - GPL-compatible licenses make it possible to combine Python with - other software that is released under the GPL; the others don't. - -(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, - because its license has a choice of law clause. According to - CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 - is "not incompatible" with the GPL. - -Thanks to the many outside volunteers who have worked under Guido's -direction to make these releases possible. - - -B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON -=============================================================== - -Python software and documentation are licensed under the -Python Software Foundation License Version 2. - -Starting with Python 3.8.6, examples, recipes, and other code in -the documentation are dual licensed under the PSF License Version 2 -and the Zero-Clause BSD license. - -Some software incorporated into Python is under different licenses. -The licenses are listed with code falling under that license. - - -PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 --------------------------------------------- - -1. This LICENSE AGREEMENT is between the Python Software Foundation -("PSF"), and the Individual or Organization ("Licensee") accessing and -otherwise using this software ("Python") in source or binary form and -its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, PSF hereby -grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, -analyze, test, perform and/or display publicly, prepare derivative works, -distribute, and otherwise use Python alone or in any derivative version, -provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation; -All Rights Reserved" are retained in Python alone or in any derivative version -prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python. - -4. PSF is making Python available to Licensee on an "AS IS" -basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between PSF and -Licensee. This License Agreement does not grant permission to use PSF -trademarks or trade name in a trademark sense to endorse or promote -products or services of Licensee, or any third party. - -8. By copying, installing or otherwise using Python, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 -------------------------------------------- - -BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 - -1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an -office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the -Individual or Organization ("Licensee") accessing and otherwise using -this software in source or binary form and its associated -documentation ("the Software"). - -2. Subject to the terms and conditions of this BeOpen Python License -Agreement, BeOpen hereby grants Licensee a non-exclusive, -royalty-free, world-wide license to reproduce, analyze, test, perform -and/or display publicly, prepare derivative works, distribute, and -otherwise use the Software alone or in any derivative version, -provided, however, that the BeOpen Python License is retained in the -Software, alone or in any derivative version prepared by Licensee. - -3. BeOpen is making the Software available to Licensee on an "AS IS" -basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE -SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -5. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -6. This License Agreement shall be governed by and interpreted in all -respects by the law of the State of California, excluding conflict of -law provisions. Nothing in this License Agreement shall be deemed to -create any relationship of agency, partnership, or joint venture -between BeOpen and Licensee. This License Agreement does not grant -permission to use BeOpen trademarks or trade names in a trademark -sense to endorse or promote products or services of Licensee, or any -third party. As an exception, the "BeOpen Python" logos available at -http://www.pythonlabs.com/logos.html may be used according to the -permissions granted on that web page. - -7. By copying, installing or otherwise using the software, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 ---------------------------------------- - -1. This LICENSE AGREEMENT is between the Corporation for National -Research Initiatives, having an office at 1895 Preston White Drive, -Reston, VA 20191 ("CNRI"), and the Individual or Organization -("Licensee") accessing and otherwise using Python 1.6.1 software in -source or binary form and its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, CNRI -hereby grants Licensee a nonexclusive, royalty-free, world-wide -license to reproduce, analyze, test, perform and/or display publicly, -prepare derivative works, distribute, and otherwise use Python 1.6.1 -alone or in any derivative version, provided, however, that CNRI's -License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) -1995-2001 Corporation for National Research Initiatives; All Rights -Reserved" are retained in Python 1.6.1 alone or in any derivative -version prepared by Licensee. Alternately, in lieu of CNRI's License -Agreement, Licensee may substitute the following text (omitting the -quotes): "Python 1.6.1 is made available subject to the terms and -conditions in CNRI's License Agreement. This Agreement together with -Python 1.6.1 may be located on the internet using the following -unique, persistent identifier (known as a handle): 1895.22/1013. This -Agreement may also be obtained from a proxy server on the internet -using the following URL: http://hdl.handle.net/1895.22/1013". - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python 1.6.1 or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python 1.6.1. - -4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" -basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. This License Agreement shall be governed by the federal -intellectual property law of the United States, including without -limitation the federal copyright law, and, to the extent such -U.S. federal law does not apply, by the law of the Commonwealth of -Virginia, excluding Virginia's conflict of law provisions. -Notwithstanding the foregoing, with regard to derivative works based -on Python 1.6.1 that incorporate non-separable material that was -previously distributed under the GNU General Public License (GPL), the -law of the Commonwealth of Virginia shall govern this License -Agreement only as to issues arising under or with respect to -Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this -License Agreement shall be deemed to create any relationship of -agency, partnership, or joint venture between CNRI and Licensee. This -License Agreement does not grant permission to use CNRI trademarks or -trade name in a trademark sense to endorse or promote products or -services of Licensee, or any third party. - -8. By clicking on the "ACCEPT" button where indicated, or by copying, -installing or otherwise using Python 1.6.1, Licensee agrees to be -bound by the terms and conditions of this License Agreement. - - ACCEPT - - -CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 --------------------------------------------------- - -Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, -The Netherlands. All rights reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Stichting Mathematisch -Centrum or CWI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE -FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION ----------------------------------------------------------------------- - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. diff --git a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/METADATA b/opensafely/_vendor/typing_extensions-4.7.1.dist-info/METADATA deleted file mode 100644 index 70e1d63c..00000000 --- a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/METADATA +++ /dev/null @@ -1,69 +0,0 @@ -Metadata-Version: 2.1 -Name: typing_extensions -Version: 4.7.1 -Summary: Backported and Experimental Type Hints for Python 3.7+ -Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing -Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" -Requires-Python: >=3.7 -Description-Content-Type: text/markdown -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Console -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Python Software Foundation License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Software Development -Project-URL: Bug Tracker, https://github.com/python/typing_extensions/issues -Project-URL: Changes, https://github.com/python/typing_extensions/blob/main/CHANGELOG.md -Project-URL: Documentation, https://typing-extensions.readthedocs.io/ -Project-URL: Home, https://github.com/python/typing_extensions -Project-URL: Q & A, https://github.com/python/typing/discussions -Project-URL: Repository, https://github.com/python/typing_extensions - -# Typing Extensions - -[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing) - -[Documentation](https://typing-extensions.readthedocs.io/en/latest/#) – -[PyPI](https://pypi.org/project/typing-extensions/) - -## Overview - -The `typing_extensions` module serves two related purposes: - -- Enable use of new type system features on older Python versions. For example, - `typing.TypeGuard` is new in Python 3.10, but `typing_extensions` allows - users on previous Python versions to use it too. -- Enable experimentation with new type system PEPs before they are accepted and - added to the `typing` module. - -`typing_extensions` is treated specially by static type checkers such as -mypy and pyright. Objects defined in `typing_extensions` are treated the same -way as equivalent forms in `typing`. - -`typing_extensions` uses -[Semantic Versioning](https://semver.org/). The -major version will be incremented only for backwards-incompatible changes. -Therefore, it's safe to depend -on `typing_extensions` like this: `typing_extensions >=x.y, <(x+1)`, -where `x.y` is the first version that includes all features you need. - -`typing_extensions` supports Python versions 3.7 and higher. - -## Included items - -See [the documentation](https://typing-extensions.readthedocs.io/en/latest/#) for a -complete listing of module contents. - -## Contributing - -See [CONTRIBUTING.md](https://github.com/python/typing_extensions/blob/main/CONTRIBUTING.md) -for how to contribute to `typing_extensions`. - diff --git a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/RECORD b/opensafely/_vendor/typing_extensions-4.7.1.dist-info/RECORD deleted file mode 100644 index 11c02cb7..00000000 --- a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/RECORD +++ /dev/null @@ -1,7 +0,0 @@ -typing_extensions-4.7.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -typing_extensions-4.7.1.dist-info/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936 -typing_extensions-4.7.1.dist-info/METADATA,sha256=0W71u6mC24oVYJzibNoq2l-bQnVoU_p25uiNhAq5OcA,3078 -typing_extensions-4.7.1.dist-info/RECORD,, -typing_extensions-4.7.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -typing_extensions-4.7.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 -typing_extensions.py,sha256=zkLXjhMMSmKvLLqj-MCunbScGMu7kPLZYUsLun38I00,111082 diff --git a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/REQUESTED b/opensafely/_vendor/typing_extensions-4.7.1.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/WHEEL b/opensafely/_vendor/typing_extensions-4.7.1.dist-info/WHEEL deleted file mode 100644 index 3b5e64b5..00000000 --- a/opensafely/_vendor/typing_extensions-4.7.1.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.9.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/opensafely/_vendor/typing_extensions.LICENSE b/opensafely/_vendor/typing_extensions.LICENSE deleted file mode 100644 index f26bcf4d..00000000 --- a/opensafely/_vendor/typing_extensions.LICENSE +++ /dev/null @@ -1,279 +0,0 @@ -A. HISTORY OF THE SOFTWARE -========================== - -Python was created in the early 1990s by Guido van Rossum at Stichting -Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands -as a successor of a language called ABC. Guido remains Python's -principal author, although it includes many contributions from others. - -In 1995, Guido continued his work on Python at the Corporation for -National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) -in Reston, Virginia where he released several versions of the -software. - -In May 2000, Guido and the Python core development team moved to -BeOpen.com to form the BeOpen PythonLabs team. In October of the same -year, the PythonLabs team moved to Digital Creations, which became -Zope Corporation. In 2001, the Python Software Foundation (PSF, see -https://www.python.org/psf/) was formed, a non-profit organization -created specifically to own Python-related Intellectual Property. -Zope Corporation was a sponsoring member of the PSF. - -All Python releases are Open Source (see https://opensource.org for -the Open Source Definition). Historically, most, but not all, Python -releases have also been GPL-compatible; the table below summarizes -the various releases. - - Release Derived Year Owner GPL- - from compatible? (1) - - 0.9.0 thru 1.2 1991-1995 CWI yes - 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes - 1.6 1.5.2 2000 CNRI no - 2.0 1.6 2000 BeOpen.com no - 1.6.1 1.6 2001 CNRI yes (2) - 2.1 2.0+1.6.1 2001 PSF no - 2.0.1 2.0+1.6.1 2001 PSF yes - 2.1.1 2.1+2.0.1 2001 PSF yes - 2.1.2 2.1.1 2002 PSF yes - 2.1.3 2.1.2 2002 PSF yes - 2.2 and above 2.1.1 2001-now PSF yes - -Footnotes: - -(1) GPL-compatible doesn't mean that we're distributing Python under - the GPL. All Python licenses, unlike the GPL, let you distribute - a modified version without making your changes open source. The - GPL-compatible licenses make it possible to combine Python with - other software that is released under the GPL; the others don't. - -(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, - because its license has a choice of law clause. According to - CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 - is "not incompatible" with the GPL. - -Thanks to the many outside volunteers who have worked under Guido's -direction to make these releases possible. - - -B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON -=============================================================== - -Python software and documentation are licensed under the -Python Software Foundation License Version 2. - -Starting with Python 3.8.6, examples, recipes, and other code in -the documentation are dual licensed under the PSF License Version 2 -and the Zero-Clause BSD license. - -Some software incorporated into Python is under different licenses. -The licenses are listed with code falling under that license. - - -PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 --------------------------------------------- - -1. This LICENSE AGREEMENT is between the Python Software Foundation -("PSF"), and the Individual or Organization ("Licensee") accessing and -otherwise using this software ("Python") in source or binary form and -its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, PSF hereby -grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, -analyze, test, perform and/or display publicly, prepare derivative works, -distribute, and otherwise use Python alone or in any derivative version, -provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation; -All Rights Reserved" are retained in Python alone or in any derivative version -prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python. - -4. PSF is making Python available to Licensee on an "AS IS" -basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between PSF and -Licensee. This License Agreement does not grant permission to use PSF -trademarks or trade name in a trademark sense to endorse or promote -products or services of Licensee, or any third party. - -8. By copying, installing or otherwise using Python, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 -------------------------------------------- - -BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 - -1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an -office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the -Individual or Organization ("Licensee") accessing and otherwise using -this software in source or binary form and its associated -documentation ("the Software"). - -2. Subject to the terms and conditions of this BeOpen Python License -Agreement, BeOpen hereby grants Licensee a non-exclusive, -royalty-free, world-wide license to reproduce, analyze, test, perform -and/or display publicly, prepare derivative works, distribute, and -otherwise use the Software alone or in any derivative version, -provided, however, that the BeOpen Python License is retained in the -Software, alone or in any derivative version prepared by Licensee. - -3. BeOpen is making the Software available to Licensee on an "AS IS" -basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE -SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -5. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -6. This License Agreement shall be governed by and interpreted in all -respects by the law of the State of California, excluding conflict of -law provisions. Nothing in this License Agreement shall be deemed to -create any relationship of agency, partnership, or joint venture -between BeOpen and Licensee. This License Agreement does not grant -permission to use BeOpen trademarks or trade names in a trademark -sense to endorse or promote products or services of Licensee, or any -third party. As an exception, the "BeOpen Python" logos available at -http://www.pythonlabs.com/logos.html may be used according to the -permissions granted on that web page. - -7. By copying, installing or otherwise using the software, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 ---------------------------------------- - -1. This LICENSE AGREEMENT is between the Corporation for National -Research Initiatives, having an office at 1895 Preston White Drive, -Reston, VA 20191 ("CNRI"), and the Individual or Organization -("Licensee") accessing and otherwise using Python 1.6.1 software in -source or binary form and its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, CNRI -hereby grants Licensee a nonexclusive, royalty-free, world-wide -license to reproduce, analyze, test, perform and/or display publicly, -prepare derivative works, distribute, and otherwise use Python 1.6.1 -alone or in any derivative version, provided, however, that CNRI's -License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) -1995-2001 Corporation for National Research Initiatives; All Rights -Reserved" are retained in Python 1.6.1 alone or in any derivative -version prepared by Licensee. Alternately, in lieu of CNRI's License -Agreement, Licensee may substitute the following text (omitting the -quotes): "Python 1.6.1 is made available subject to the terms and -conditions in CNRI's License Agreement. This Agreement together with -Python 1.6.1 may be located on the internet using the following -unique, persistent identifier (known as a handle): 1895.22/1013. This -Agreement may also be obtained from a proxy server on the internet -using the following URL: http://hdl.handle.net/1895.22/1013". - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python 1.6.1 or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python 1.6.1. - -4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" -basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. This License Agreement shall be governed by the federal -intellectual property law of the United States, including without -limitation the federal copyright law, and, to the extent such -U.S. federal law does not apply, by the law of the Commonwealth of -Virginia, excluding Virginia's conflict of law provisions. -Notwithstanding the foregoing, with regard to derivative works based -on Python 1.6.1 that incorporate non-separable material that was -previously distributed under the GNU General Public License (GPL), the -law of the Commonwealth of Virginia shall govern this License -Agreement only as to issues arising under or with respect to -Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this -License Agreement shall be deemed to create any relationship of -agency, partnership, or joint venture between CNRI and Licensee. This -License Agreement does not grant permission to use CNRI trademarks or -trade name in a trademark sense to endorse or promote products or -services of Licensee, or any third party. - -8. By clicking on the "ACCEPT" button where indicated, or by copying, -installing or otherwise using Python 1.6.1, Licensee agrees to be -bound by the terms and conditions of this License Agreement. - - ACCEPT - - -CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 --------------------------------------------------- - -Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, -The Netherlands. All rights reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Stichting Mathematisch -Centrum or CWI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE -FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION ----------------------------------------------------------------------- - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. diff --git a/opensafely/_vendor/typing_extensions.py b/opensafely/_vendor/typing_extensions.py deleted file mode 100644 index 220e2541..00000000 --- a/opensafely/_vendor/typing_extensions.py +++ /dev/null @@ -1,3072 +0,0 @@ -import abc -import collections -import collections.abc -import functools -import inspect -import operator -import sys -import types as _types -import typing -import warnings - -__all__ = [ - # Super-special typing primitives. - 'Any', - 'ClassVar', - 'Concatenate', - 'Final', - 'LiteralString', - 'ParamSpec', - 'ParamSpecArgs', - 'ParamSpecKwargs', - 'Self', - 'Type', - 'TypeVar', - 'TypeVarTuple', - 'Unpack', - - # ABCs (from collections.abc). - 'Awaitable', - 'AsyncIterator', - 'AsyncIterable', - 'Coroutine', - 'AsyncGenerator', - 'AsyncContextManager', - 'Buffer', - 'ChainMap', - - # Concrete collection types. - 'ContextManager', - 'Counter', - 'Deque', - 'DefaultDict', - 'NamedTuple', - 'OrderedDict', - 'TypedDict', - - # Structural checks, a.k.a. protocols. - 'SupportsAbs', - 'SupportsBytes', - 'SupportsComplex', - 'SupportsFloat', - 'SupportsIndex', - 'SupportsInt', - 'SupportsRound', - - # One-off things. - 'Annotated', - 'assert_never', - 'assert_type', - 'clear_overloads', - 'dataclass_transform', - 'deprecated', - 'get_overloads', - 'final', - 'get_args', - 'get_origin', - 'get_original_bases', - 'get_protocol_members', - 'get_type_hints', - 'IntVar', - 'is_protocol', - 'is_typeddict', - 'Literal', - 'NewType', - 'overload', - 'override', - 'Protocol', - 'reveal_type', - 'runtime', - 'runtime_checkable', - 'Text', - 'TypeAlias', - 'TypeAliasType', - 'TypeGuard', - 'TYPE_CHECKING', - 'Never', - 'NoReturn', - 'Required', - 'NotRequired', - - # Pure aliases, have always been in typing - 'AbstractSet', - 'AnyStr', - 'BinaryIO', - 'Callable', - 'Collection', - 'Container', - 'Dict', - 'ForwardRef', - 'FrozenSet', - 'Generator', - 'Generic', - 'Hashable', - 'IO', - 'ItemsView', - 'Iterable', - 'Iterator', - 'KeysView', - 'List', - 'Mapping', - 'MappingView', - 'Match', - 'MutableMapping', - 'MutableSequence', - 'MutableSet', - 'Optional', - 'Pattern', - 'Reversible', - 'Sequence', - 'Set', - 'Sized', - 'TextIO', - 'Tuple', - 'Union', - 'ValuesView', - 'cast', - 'no_type_check', - 'no_type_check_decorator', -] - -# for backward compatibility -PEP_560 = True -GenericMeta = type - -# The functions below are modified copies of typing internal helpers. -# They are needed by _ProtocolMeta and they provide support for PEP 646. - - -class _Sentinel: - def __repr__(self): - return "" - - -_marker = _Sentinel() - - -def _check_generic(cls, parameters, elen=_marker): - """Check correct count for parameters of a generic cls (internal helper). - This gives a nice error message in case of count mismatch. - """ - if not elen: - raise TypeError(f"{cls} is not a generic class") - if elen is _marker: - if not hasattr(cls, "__parameters__") or not cls.__parameters__: - raise TypeError(f"{cls} is not a generic class") - elen = len(cls.__parameters__) - alen = len(parameters) - if alen != elen: - if hasattr(cls, "__parameters__"): - parameters = [p for p in cls.__parameters__ if not _is_unpack(p)] - num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in parameters) - if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples): - return - raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for {cls};" - f" actual {alen}, expected {elen}") - - -if sys.version_info >= (3, 10): - def _should_collect_from_parameters(t): - return isinstance( - t, (typing._GenericAlias, _types.GenericAlias, _types.UnionType) - ) -elif sys.version_info >= (3, 9): - def _should_collect_from_parameters(t): - return isinstance(t, (typing._GenericAlias, _types.GenericAlias)) -else: - def _should_collect_from_parameters(t): - return isinstance(t, typing._GenericAlias) and not t._special - - -def _collect_type_vars(types, typevar_types=None): - """Collect all type variable contained in types in order of - first appearance (lexicographic order). For example:: - - _collect_type_vars((T, List[S, T])) == (T, S) - """ - if typevar_types is None: - typevar_types = typing.TypeVar - tvars = [] - for t in types: - if ( - isinstance(t, typevar_types) and - t not in tvars and - not _is_unpack(t) - ): - tvars.append(t) - if _should_collect_from_parameters(t): - tvars.extend([t for t in t.__parameters__ if t not in tvars]) - return tuple(tvars) - - -NoReturn = typing.NoReturn - -# Some unconstrained type variables. These are used by the container types. -# (These are not for export.) -T = typing.TypeVar('T') # Any type. -KT = typing.TypeVar('KT') # Key type. -VT = typing.TypeVar('VT') # Value type. -T_co = typing.TypeVar('T_co', covariant=True) # Any type covariant containers. -T_contra = typing.TypeVar('T_contra', contravariant=True) # Ditto contravariant. - - -if sys.version_info >= (3, 11): - from typing import Any -else: - - class _AnyMeta(type): - def __instancecheck__(self, obj): - if self is Any: - raise TypeError("typing_extensions.Any cannot be used with isinstance()") - return super().__instancecheck__(obj) - - def __repr__(self): - if self is Any: - return "typing_extensions.Any" - return super().__repr__() - - class Any(metaclass=_AnyMeta): - """Special type indicating an unconstrained type. - - Any is compatible with every type. - - Any assumed to have all methods. - - All values assumed to be instances of Any. - Note that all the above statements are true from the point of view of - static type checkers. At runtime, Any should not be used with instance - checks. - """ - def __new__(cls, *args, **kwargs): - if cls is Any: - raise TypeError("Any cannot be instantiated") - return super().__new__(cls, *args, **kwargs) - - -ClassVar = typing.ClassVar - - -class _ExtensionsSpecialForm(typing._SpecialForm, _root=True): - def __repr__(self): - return 'typing_extensions.' + self._name - - -# On older versions of typing there is an internal class named "Final". -# 3.8+ -if hasattr(typing, 'Final') and sys.version_info[:2] >= (3, 7): - Final = typing.Final -# 3.7 -else: - class _FinalForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - item = typing._type_check(parameters, - f'{self._name} accepts only a single type.') - return typing._GenericAlias(self, (item,)) - - Final = _FinalForm('Final', - doc="""A special typing construct to indicate that a name - cannot be re-assigned or overridden in a subclass. - For example: - - MAX_SIZE: Final = 9000 - MAX_SIZE += 1 # Error reported by type checker - - class Connection: - TIMEOUT: Final[int] = 10 - class FastConnector(Connection): - TIMEOUT = 1 # Error reported by type checker - - There is no runtime checking of these properties.""") - -if sys.version_info >= (3, 11): - final = typing.final -else: - # @final exists in 3.8+, but we backport it for all versions - # before 3.11 to keep support for the __final__ attribute. - # See https://bugs.python.org/issue46342 - def final(f): - """This decorator can be used to indicate to type checkers that - the decorated method cannot be overridden, and decorated class - cannot be subclassed. For example: - - class Base: - @final - def done(self) -> None: - ... - class Sub(Base): - def done(self) -> None: # Error reported by type checker - ... - @final - class Leaf: - ... - class Other(Leaf): # Error reported by type checker - ... - - There is no runtime checking of these properties. The decorator - sets the ``__final__`` attribute to ``True`` on the decorated object - to allow runtime introspection. - """ - try: - f.__final__ = True - except (AttributeError, TypeError): - # Skip the attribute silently if it is not writable. - # AttributeError happens if the object has __slots__ or a - # read-only property, TypeError if it's a builtin class. - pass - return f - - -def IntVar(name): - return typing.TypeVar(name) - - -# A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8 -if sys.version_info >= (3, 10, 1): - Literal = typing.Literal -else: - def _flatten_literal_params(parameters): - """An internal helper for Literal creation: flatten Literals among parameters""" - params = [] - for p in parameters: - if isinstance(p, _LiteralGenericAlias): - params.extend(p.__args__) - else: - params.append(p) - return tuple(params) - - def _value_and_type_iter(params): - for p in params: - yield p, type(p) - - class _LiteralGenericAlias(typing._GenericAlias, _root=True): - def __eq__(self, other): - if not isinstance(other, _LiteralGenericAlias): - return NotImplemented - these_args_deduped = set(_value_and_type_iter(self.__args__)) - other_args_deduped = set(_value_and_type_iter(other.__args__)) - return these_args_deduped == other_args_deduped - - def __hash__(self): - return hash(frozenset(_value_and_type_iter(self.__args__))) - - class _LiteralForm(_ExtensionsSpecialForm, _root=True): - def __init__(self, doc: str): - self._name = 'Literal' - self._doc = self.__doc__ = doc - - def __getitem__(self, parameters): - if not isinstance(parameters, tuple): - parameters = (parameters,) - - parameters = _flatten_literal_params(parameters) - - val_type_pairs = list(_value_and_type_iter(parameters)) - try: - deduped_pairs = set(val_type_pairs) - except TypeError: - # unhashable parameters - pass - else: - # similar logic to typing._deduplicate on Python 3.9+ - if len(deduped_pairs) < len(val_type_pairs): - new_parameters = [] - for pair in val_type_pairs: - if pair in deduped_pairs: - new_parameters.append(pair[0]) - deduped_pairs.remove(pair) - assert not deduped_pairs, deduped_pairs - parameters = tuple(new_parameters) - - return _LiteralGenericAlias(self, parameters) - - Literal = _LiteralForm(doc="""\ - A type that can be used to indicate to type checkers - that the corresponding value has a value literally equivalent - to the provided parameter. For example: - - var: Literal[4] = 4 - - The type checker understands that 'var' is literally equal to - the value 4 and no other value. - - Literal[...] cannot be subclassed. There is no runtime - checking verifying that the parameter is actually a value - instead of a type.""") - - -_overload_dummy = typing._overload_dummy - - -if hasattr(typing, "get_overloads"): # 3.11+ - overload = typing.overload - get_overloads = typing.get_overloads - clear_overloads = typing.clear_overloads -else: - # {module: {qualname: {firstlineno: func}}} - _overload_registry = collections.defaultdict( - functools.partial(collections.defaultdict, dict) - ) - - def overload(func): - """Decorator for overloaded functions/methods. - - In a stub file, place two or more stub definitions for the same - function in a row, each decorated with @overload. For example: - - @overload - def utf8(value: None) -> None: ... - @overload - def utf8(value: bytes) -> bytes: ... - @overload - def utf8(value: str) -> bytes: ... - - In a non-stub file (i.e. a regular .py file), do the same but - follow it with an implementation. The implementation should *not* - be decorated with @overload. For example: - - @overload - def utf8(value: None) -> None: ... - @overload - def utf8(value: bytes) -> bytes: ... - @overload - def utf8(value: str) -> bytes: ... - def utf8(value): - # implementation goes here - - The overloads for a function can be retrieved at runtime using the - get_overloads() function. - """ - # classmethod and staticmethod - f = getattr(func, "__func__", func) - try: - _overload_registry[f.__module__][f.__qualname__][ - f.__code__.co_firstlineno - ] = func - except AttributeError: - # Not a normal function; ignore. - pass - return _overload_dummy - - def get_overloads(func): - """Return all defined overloads for *func* as a sequence.""" - # classmethod and staticmethod - f = getattr(func, "__func__", func) - if f.__module__ not in _overload_registry: - return [] - mod_dict = _overload_registry[f.__module__] - if f.__qualname__ not in mod_dict: - return [] - return list(mod_dict[f.__qualname__].values()) - - def clear_overloads(): - """Clear all overloads in the registry.""" - _overload_registry.clear() - - -# This is not a real generic class. Don't use outside annotations. -Type = typing.Type - -# Various ABCs mimicking those in collections.abc. -# A few are simply re-exported for completeness. - - -Awaitable = typing.Awaitable -Coroutine = typing.Coroutine -AsyncIterable = typing.AsyncIterable -AsyncIterator = typing.AsyncIterator -Deque = typing.Deque -ContextManager = typing.ContextManager -AsyncContextManager = typing.AsyncContextManager -DefaultDict = typing.DefaultDict - -# 3.7.2+ -if hasattr(typing, 'OrderedDict'): - OrderedDict = typing.OrderedDict -# 3.7.0-3.7.2 -else: - OrderedDict = typing._alias(collections.OrderedDict, (KT, VT)) - -Counter = typing.Counter -ChainMap = typing.ChainMap -AsyncGenerator = typing.AsyncGenerator -Text = typing.Text -TYPE_CHECKING = typing.TYPE_CHECKING - - -_PROTO_ALLOWLIST = { - 'collections.abc': [ - 'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable', - 'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', 'Buffer', - ], - 'contextlib': ['AbstractContextManager', 'AbstractAsyncContextManager'], - 'typing_extensions': ['Buffer'], -} - - -_EXCLUDED_ATTRS = { - "__abstractmethods__", "__annotations__", "__weakref__", "_is_protocol", - "_is_runtime_protocol", "__dict__", "__slots__", "__parameters__", - "__orig_bases__", "__module__", "_MutableMapping__marker", "__doc__", - "__subclasshook__", "__orig_class__", "__init__", "__new__", - "__protocol_attrs__", "__callable_proto_members_only__", -} - -if sys.version_info < (3, 8): - _EXCLUDED_ATTRS |= { - "_gorg", "__next_in_mro__", "__extra__", "__tree_hash__", "__args__", - "__origin__" - } - -if sys.version_info >= (3, 9): - _EXCLUDED_ATTRS.add("__class_getitem__") - -if sys.version_info >= (3, 12): - _EXCLUDED_ATTRS.add("__type_params__") - -_EXCLUDED_ATTRS = frozenset(_EXCLUDED_ATTRS) - - -def _get_protocol_attrs(cls): - attrs = set() - for base in cls.__mro__[:-1]: # without object - if base.__name__ in {'Protocol', 'Generic'}: - continue - annotations = getattr(base, '__annotations__', {}) - for attr in (*base.__dict__, *annotations): - if (not attr.startswith('_abc_') and attr not in _EXCLUDED_ATTRS): - attrs.add(attr) - return attrs - - -def _maybe_adjust_parameters(cls): - """Helper function used in Protocol.__init_subclass__ and _TypedDictMeta.__new__. - - The contents of this function are very similar - to logic found in typing.Generic.__init_subclass__ - on the CPython main branch. - """ - tvars = [] - if '__orig_bases__' in cls.__dict__: - tvars = _collect_type_vars(cls.__orig_bases__) - # Look for Generic[T1, ..., Tn] or Protocol[T1, ..., Tn]. - # If found, tvars must be a subset of it. - # If not found, tvars is it. - # Also check for and reject plain Generic, - # and reject multiple Generic[...] and/or Protocol[...]. - gvars = None - for base in cls.__orig_bases__: - if (isinstance(base, typing._GenericAlias) and - base.__origin__ in (typing.Generic, Protocol)): - # for error messages - the_base = base.__origin__.__name__ - if gvars is not None: - raise TypeError( - "Cannot inherit from Generic[...]" - " and/or Protocol[...] multiple types.") - gvars = base.__parameters__ - if gvars is None: - gvars = tvars - else: - tvarset = set(tvars) - gvarset = set(gvars) - if not tvarset <= gvarset: - s_vars = ', '.join(str(t) for t in tvars if t not in gvarset) - s_args = ', '.join(str(g) for g in gvars) - raise TypeError(f"Some type variables ({s_vars}) are" - f" not listed in {the_base}[{s_args}]") - tvars = gvars - cls.__parameters__ = tuple(tvars) - - -def _caller(depth=2): - try: - return sys._getframe(depth).f_globals.get('__name__', '__main__') - except (AttributeError, ValueError): # For platforms without _getframe() - return None - - -# The performance of runtime-checkable protocols is significantly improved on Python 3.12, -# so we backport the 3.12 version of Protocol to Python <=3.11 -if sys.version_info >= (3, 12): - Protocol = typing.Protocol -else: - def _allow_reckless_class_checks(depth=3): - """Allow instance and class checks for special stdlib modules. - The abc and functools modules indiscriminately call isinstance() and - issubclass() on the whole MRO of a user class, which may contain protocols. - """ - return _caller(depth) in {'abc', 'functools', None} - - def _no_init(self, *args, **kwargs): - if type(self)._is_protocol: - raise TypeError('Protocols cannot be instantiated') - - if sys.version_info >= (3, 8): - # Inheriting from typing._ProtocolMeta isn't actually desirable, - # but is necessary to allow typing.Protocol and typing_extensions.Protocol - # to mix without getting TypeErrors about "metaclass conflict" - _typing_Protocol = typing.Protocol - _ProtocolMetaBase = type(_typing_Protocol) - else: - _typing_Protocol = _marker - _ProtocolMetaBase = abc.ABCMeta - - class _ProtocolMeta(_ProtocolMetaBase): - # This metaclass is somewhat unfortunate, - # but is necessary for several reasons... - # - # NOTE: DO NOT call super() in any methods in this class - # That would call the methods on typing._ProtocolMeta on Python 3.8-3.11 - # and those are slow - def __new__(mcls, name, bases, namespace, **kwargs): - if name == "Protocol" and len(bases) < 2: - pass - elif {Protocol, _typing_Protocol} & set(bases): - for base in bases: - if not ( - base in {object, typing.Generic, Protocol, _typing_Protocol} - or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__, []) - or is_protocol(base) - ): - raise TypeError( - f"Protocols can only inherit from other protocols, " - f"got {base!r}" - ) - return abc.ABCMeta.__new__(mcls, name, bases, namespace, **kwargs) - - def __init__(cls, *args, **kwargs): - abc.ABCMeta.__init__(cls, *args, **kwargs) - if getattr(cls, "_is_protocol", False): - cls.__protocol_attrs__ = _get_protocol_attrs(cls) - # PEP 544 prohibits using issubclass() - # with protocols that have non-method members. - cls.__callable_proto_members_only__ = all( - callable(getattr(cls, attr, None)) for attr in cls.__protocol_attrs__ - ) - - def __subclasscheck__(cls, other): - if cls is Protocol: - return type.__subclasscheck__(cls, other) - if ( - getattr(cls, '_is_protocol', False) - and not _allow_reckless_class_checks() - ): - if not isinstance(other, type): - # Same error message as for issubclass(1, int). - raise TypeError('issubclass() arg 1 must be a class') - if ( - not cls.__callable_proto_members_only__ - and cls.__dict__.get("__subclasshook__") is _proto_hook - ): - raise TypeError( - "Protocols with non-method members don't support issubclass()" - ) - if not getattr(cls, '_is_runtime_protocol', False): - raise TypeError( - "Instance and class checks can only be used with " - "@runtime_checkable protocols" - ) - return abc.ABCMeta.__subclasscheck__(cls, other) - - def __instancecheck__(cls, instance): - # We need this method for situations where attributes are - # assigned in __init__. - if cls is Protocol: - return type.__instancecheck__(cls, instance) - if not getattr(cls, "_is_protocol", False): - # i.e., it's a concrete subclass of a protocol - return abc.ABCMeta.__instancecheck__(cls, instance) - - if ( - not getattr(cls, '_is_runtime_protocol', False) and - not _allow_reckless_class_checks() - ): - raise TypeError("Instance and class checks can only be used with" - " @runtime_checkable protocols") - - if abc.ABCMeta.__instancecheck__(cls, instance): - return True - - for attr in cls.__protocol_attrs__: - try: - val = inspect.getattr_static(instance, attr) - except AttributeError: - break - if val is None and callable(getattr(cls, attr, None)): - break - else: - return True - - return False - - def __eq__(cls, other): - # Hack so that typing.Generic.__class_getitem__ - # treats typing_extensions.Protocol - # as equivalent to typing.Protocol on Python 3.8+ - if abc.ABCMeta.__eq__(cls, other) is True: - return True - return ( - cls is Protocol and other is getattr(typing, "Protocol", object()) - ) - - # This has to be defined, or the abc-module cache - # complains about classes with this metaclass being unhashable, - # if we define only __eq__! - def __hash__(cls) -> int: - return type.__hash__(cls) - - @classmethod - def _proto_hook(cls, other): - if not cls.__dict__.get('_is_protocol', False): - return NotImplemented - - for attr in cls.__protocol_attrs__: - for base in other.__mro__: - # Check if the members appears in the class dictionary... - if attr in base.__dict__: - if base.__dict__[attr] is None: - return NotImplemented - break - - # ...or in annotations, if it is a sub-protocol. - annotations = getattr(base, '__annotations__', {}) - if ( - isinstance(annotations, collections.abc.Mapping) - and attr in annotations - and is_protocol(other) - ): - break - else: - return NotImplemented - return True - - if sys.version_info >= (3, 8): - class Protocol(typing.Generic, metaclass=_ProtocolMeta): - __doc__ = typing.Protocol.__doc__ - __slots__ = () - _is_protocol = True - _is_runtime_protocol = False - - def __init_subclass__(cls, *args, **kwargs): - super().__init_subclass__(*args, **kwargs) - - # Determine if this is a protocol or a concrete subclass. - if not cls.__dict__.get('_is_protocol', False): - cls._is_protocol = any(b is Protocol for b in cls.__bases__) - - # Set (or override) the protocol subclass hook. - if '__subclasshook__' not in cls.__dict__: - cls.__subclasshook__ = _proto_hook - - # Prohibit instantiation for protocol classes - if cls._is_protocol and cls.__init__ is Protocol.__init__: - cls.__init__ = _no_init - - else: - class Protocol(metaclass=_ProtocolMeta): - # There is quite a lot of overlapping code with typing.Generic. - # Unfortunately it is hard to avoid this on Python <3.8, - # as the typing module on Python 3.7 doesn't let us subclass typing.Generic! - """Base class for protocol classes. Protocol classes are defined as:: - - class Proto(Protocol): - def meth(self) -> int: - ... - - Such classes are primarily used with static type checkers that recognize - structural subtyping (static duck-typing), for example:: - - class C: - def meth(self) -> int: - return 0 - - def func(x: Proto) -> int: - return x.meth() - - func(C()) # Passes static type check - - See PEP 544 for details. Protocol classes decorated with - @typing_extensions.runtime_checkable act - as simple-minded runtime-checkable protocols that check - only the presence of given attributes, ignoring their type signatures. - - Protocol classes can be generic, they are defined as:: - - class GenProto(Protocol[T]): - def meth(self) -> T: - ... - """ - __slots__ = () - _is_protocol = True - _is_runtime_protocol = False - - def __new__(cls, *args, **kwds): - if cls is Protocol: - raise TypeError("Type Protocol cannot be instantiated; " - "it can only be used as a base class") - return super().__new__(cls) - - @typing._tp_cache - def __class_getitem__(cls, params): - if not isinstance(params, tuple): - params = (params,) - if not params and cls is not typing.Tuple: - raise TypeError( - f"Parameter list to {cls.__qualname__}[...] cannot be empty") - msg = "Parameters to generic types must be types." - params = tuple(typing._type_check(p, msg) for p in params) - if cls is Protocol: - # Generic can only be subscripted with unique type variables. - if not all(isinstance(p, typing.TypeVar) for p in params): - i = 0 - while isinstance(params[i], typing.TypeVar): - i += 1 - raise TypeError( - "Parameters to Protocol[...] must all be type variables." - f" Parameter {i + 1} is {params[i]}") - if len(set(params)) != len(params): - raise TypeError( - "Parameters to Protocol[...] must all be unique") - else: - # Subscripting a regular Generic subclass. - _check_generic(cls, params, len(cls.__parameters__)) - return typing._GenericAlias(cls, params) - - def __init_subclass__(cls, *args, **kwargs): - if '__orig_bases__' in cls.__dict__: - error = typing.Generic in cls.__orig_bases__ - else: - error = typing.Generic in cls.__bases__ - if error: - raise TypeError("Cannot inherit from plain Generic") - _maybe_adjust_parameters(cls) - - # Determine if this is a protocol or a concrete subclass. - if not cls.__dict__.get('_is_protocol', None): - cls._is_protocol = any(b is Protocol for b in cls.__bases__) - - # Set (or override) the protocol subclass hook. - if '__subclasshook__' not in cls.__dict__: - cls.__subclasshook__ = _proto_hook - - # Prohibit instantiation for protocol classes - if cls._is_protocol and cls.__init__ is Protocol.__init__: - cls.__init__ = _no_init - - -if sys.version_info >= (3, 8): - runtime_checkable = typing.runtime_checkable -else: - def runtime_checkable(cls): - """Mark a protocol class as a runtime protocol, so that it - can be used with isinstance() and issubclass(). Raise TypeError - if applied to a non-protocol class. - - This allows a simple-minded structural check very similar to the - one-offs in collections.abc such as Hashable. - """ - if not ( - (isinstance(cls, _ProtocolMeta) or issubclass(cls, typing.Generic)) - and getattr(cls, "_is_protocol", False) - ): - raise TypeError('@runtime_checkable can be only applied to protocol classes,' - f' got {cls!r}') - cls._is_runtime_protocol = True - return cls - - -# Exists for backwards compatibility. -runtime = runtime_checkable - - -# Our version of runtime-checkable protocols is faster on Python 3.7-3.11 -if sys.version_info >= (3, 12): - SupportsInt = typing.SupportsInt - SupportsFloat = typing.SupportsFloat - SupportsComplex = typing.SupportsComplex - SupportsBytes = typing.SupportsBytes - SupportsIndex = typing.SupportsIndex - SupportsAbs = typing.SupportsAbs - SupportsRound = typing.SupportsRound -else: - @runtime_checkable - class SupportsInt(Protocol): - """An ABC with one abstract method __int__.""" - __slots__ = () - - @abc.abstractmethod - def __int__(self) -> int: - pass - - @runtime_checkable - class SupportsFloat(Protocol): - """An ABC with one abstract method __float__.""" - __slots__ = () - - @abc.abstractmethod - def __float__(self) -> float: - pass - - @runtime_checkable - class SupportsComplex(Protocol): - """An ABC with one abstract method __complex__.""" - __slots__ = () - - @abc.abstractmethod - def __complex__(self) -> complex: - pass - - @runtime_checkable - class SupportsBytes(Protocol): - """An ABC with one abstract method __bytes__.""" - __slots__ = () - - @abc.abstractmethod - def __bytes__(self) -> bytes: - pass - - @runtime_checkable - class SupportsIndex(Protocol): - __slots__ = () - - @abc.abstractmethod - def __index__(self) -> int: - pass - - @runtime_checkable - class SupportsAbs(Protocol[T_co]): - """ - An ABC with one abstract method __abs__ that is covariant in its return type. - """ - __slots__ = () - - @abc.abstractmethod - def __abs__(self) -> T_co: - pass - - @runtime_checkable - class SupportsRound(Protocol[T_co]): - """ - An ABC with one abstract method __round__ that is covariant in its return type. - """ - __slots__ = () - - @abc.abstractmethod - def __round__(self, ndigits: int = 0) -> T_co: - pass - - -def _ensure_subclassable(mro_entries): - def inner(func): - if sys.implementation.name == "pypy" and sys.version_info < (3, 9): - cls_dict = { - "__call__": staticmethod(func), - "__mro_entries__": staticmethod(mro_entries) - } - t = type(func.__name__, (), cls_dict) - return functools.update_wrapper(t(), func) - else: - func.__mro_entries__ = mro_entries - return func - return inner - - -if sys.version_info >= (3, 13): - # The standard library TypedDict in Python 3.8 does not store runtime information - # about which (if any) keys are optional. See https://bugs.python.org/issue38834 - # The standard library TypedDict in Python 3.9.0/1 does not honour the "total" - # keyword with old-style TypedDict(). See https://bugs.python.org/issue42059 - # The standard library TypedDict below Python 3.11 does not store runtime - # information about optional and required keys when using Required or NotRequired. - # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11. - # Aaaand on 3.12 we add __orig_bases__ to TypedDict - # to enable better runtime introspection. - # On 3.13 we deprecate some odd ways of creating TypedDicts. - TypedDict = typing.TypedDict - _TypedDictMeta = typing._TypedDictMeta - is_typeddict = typing.is_typeddict -else: - # 3.10.0 and later - _TAKES_MODULE = "module" in inspect.signature(typing._type_check).parameters - - if sys.version_info >= (3, 8): - _fake_name = "Protocol" - else: - _fake_name = "_Protocol" - - class _TypedDictMeta(type): - def __new__(cls, name, bases, ns, total=True): - """Create new typed dict class object. - - This method is called when TypedDict is subclassed, - or when TypedDict is instantiated. This way - TypedDict supports all three syntax forms described in its docstring. - Subclasses and instances of TypedDict return actual dictionaries. - """ - for base in bases: - if type(base) is not _TypedDictMeta and base is not typing.Generic: - raise TypeError('cannot inherit from both a TypedDict type ' - 'and a non-TypedDict base class') - - if any(issubclass(b, typing.Generic) for b in bases): - generic_base = (typing.Generic,) - else: - generic_base = () - - # typing.py generally doesn't let you inherit from plain Generic, unless - # the name of the class happens to be "Protocol" (or "_Protocol" on 3.7). - tp_dict = type.__new__(_TypedDictMeta, _fake_name, (*generic_base, dict), ns) - tp_dict.__name__ = name - if tp_dict.__qualname__ == _fake_name: - tp_dict.__qualname__ = name - - if not hasattr(tp_dict, '__orig_bases__'): - tp_dict.__orig_bases__ = bases - - annotations = {} - own_annotations = ns.get('__annotations__', {}) - msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type" - if _TAKES_MODULE: - own_annotations = { - n: typing._type_check(tp, msg, module=tp_dict.__module__) - for n, tp in own_annotations.items() - } - else: - own_annotations = { - n: typing._type_check(tp, msg) - for n, tp in own_annotations.items() - } - required_keys = set() - optional_keys = set() - - for base in bases: - annotations.update(base.__dict__.get('__annotations__', {})) - required_keys.update(base.__dict__.get('__required_keys__', ())) - optional_keys.update(base.__dict__.get('__optional_keys__', ())) - - annotations.update(own_annotations) - for annotation_key, annotation_type in own_annotations.items(): - annotation_origin = get_origin(annotation_type) - if annotation_origin is Annotated: - annotation_args = get_args(annotation_type) - if annotation_args: - annotation_type = annotation_args[0] - annotation_origin = get_origin(annotation_type) - - if annotation_origin is Required: - required_keys.add(annotation_key) - elif annotation_origin is NotRequired: - optional_keys.add(annotation_key) - elif total: - required_keys.add(annotation_key) - else: - optional_keys.add(annotation_key) - - tp_dict.__annotations__ = annotations - tp_dict.__required_keys__ = frozenset(required_keys) - tp_dict.__optional_keys__ = frozenset(optional_keys) - if not hasattr(tp_dict, '__total__'): - tp_dict.__total__ = total - return tp_dict - - __call__ = dict # static method - - def __subclasscheck__(cls, other): - # Typed dicts are only for static structural subtyping. - raise TypeError('TypedDict does not support instance and class checks') - - __instancecheck__ = __subclasscheck__ - - _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {}) - - @_ensure_subclassable(lambda bases: (_TypedDict,)) - def TypedDict(__typename, __fields=_marker, *, total=True, **kwargs): - """A simple typed namespace. At runtime it is equivalent to a plain dict. - - TypedDict creates a dictionary type such that a type checker will expect all - instances to have a certain set of keys, where each key is - associated with a value of a consistent type. This expectation - is not checked at runtime. - - Usage:: - - class Point2D(TypedDict): - x: int - y: int - label: str - - a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK - b: Point2D = {'z': 3, 'label': 'bad'} # Fails type check - - assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first') - - The type info can be accessed via the Point2D.__annotations__ dict, and - the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets. - TypedDict supports an additional equivalent form:: - - Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str}) - - By default, all keys must be present in a TypedDict. It is possible - to override this by specifying totality:: - - class Point2D(TypedDict, total=False): - x: int - y: int - - This means that a Point2D TypedDict can have any of the keys omitted. A type - checker is only expected to support a literal False or True as the value of - the total argument. True is the default, and makes all items defined in the - class body be required. - - The Required and NotRequired special forms can also be used to mark - individual keys as being required or not required:: - - class Point2D(TypedDict): - x: int # the "x" key must always be present (Required is the default) - y: NotRequired[int] # the "y" key can be omitted - - See PEP 655 for more details on Required and NotRequired. - """ - if __fields is _marker or __fields is None: - if __fields is _marker: - deprecated_thing = "Failing to pass a value for the 'fields' parameter" - else: - deprecated_thing = "Passing `None` as the 'fields' parameter" - - example = f"`{__typename} = TypedDict({__typename!r}, {{}})`" - deprecation_msg = ( - f"{deprecated_thing} is deprecated and will be disallowed in " - "Python 3.15. To create a TypedDict class with 0 fields " - "using the functional syntax, pass an empty dictionary, e.g. " - ) + example + "." - warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2) - __fields = kwargs - elif kwargs: - raise TypeError("TypedDict takes either a dict or keyword arguments," - " but not both") - if kwargs: - warnings.warn( - "The kwargs-based syntax for TypedDict definitions is deprecated " - "in Python 3.11, will be removed in Python 3.13, and may not be " - "understood by third-party type checkers.", - DeprecationWarning, - stacklevel=2, - ) - - ns = {'__annotations__': dict(__fields)} - module = _caller() - if module is not None: - # Setting correct module is necessary to make typed dict classes pickleable. - ns['__module__'] = module - - td = _TypedDictMeta(__typename, (), ns, total=total) - td.__orig_bases__ = (TypedDict,) - return td - - if hasattr(typing, "_TypedDictMeta"): - _TYPEDDICT_TYPES = (typing._TypedDictMeta, _TypedDictMeta) - else: - _TYPEDDICT_TYPES = (_TypedDictMeta,) - - def is_typeddict(tp): - """Check if an annotation is a TypedDict class - - For example:: - class Film(TypedDict): - title: str - year: int - - is_typeddict(Film) # => True - is_typeddict(Union[list, str]) # => False - """ - # On 3.8, this would otherwise return True - if hasattr(typing, "TypedDict") and tp is typing.TypedDict: - return False - return isinstance(tp, _TYPEDDICT_TYPES) - - -if hasattr(typing, "assert_type"): - assert_type = typing.assert_type - -else: - def assert_type(__val, __typ): - """Assert (to the type checker) that the value is of the given type. - - When the type checker encounters a call to assert_type(), it - emits an error if the value is not of the specified type:: - - def greet(name: str) -> None: - assert_type(name, str) # ok - assert_type(name, int) # type checker error - - At runtime this returns the first argument unchanged and otherwise - does nothing. - """ - return __val - - -if hasattr(typing, "Required"): - get_type_hints = typing.get_type_hints -else: - # replaces _strip_annotations() - def _strip_extras(t): - """Strips Annotated, Required and NotRequired from a given type.""" - if isinstance(t, _AnnotatedAlias): - return _strip_extras(t.__origin__) - if hasattr(t, "__origin__") and t.__origin__ in (Required, NotRequired): - return _strip_extras(t.__args__[0]) - if isinstance(t, typing._GenericAlias): - stripped_args = tuple(_strip_extras(a) for a in t.__args__) - if stripped_args == t.__args__: - return t - return t.copy_with(stripped_args) - if hasattr(_types, "GenericAlias") and isinstance(t, _types.GenericAlias): - stripped_args = tuple(_strip_extras(a) for a in t.__args__) - if stripped_args == t.__args__: - return t - return _types.GenericAlias(t.__origin__, stripped_args) - if hasattr(_types, "UnionType") and isinstance(t, _types.UnionType): - stripped_args = tuple(_strip_extras(a) for a in t.__args__) - if stripped_args == t.__args__: - return t - return functools.reduce(operator.or_, stripped_args) - - return t - - def get_type_hints(obj, globalns=None, localns=None, include_extras=False): - """Return type hints for an object. - - This is often the same as obj.__annotations__, but it handles - forward references encoded as string literals, adds Optional[t] if a - default value equal to None is set and recursively replaces all - 'Annotated[T, ...]', 'Required[T]' or 'NotRequired[T]' with 'T' - (unless 'include_extras=True'). - - The argument may be a module, class, method, or function. The annotations - are returned as a dictionary. For classes, annotations include also - inherited members. - - TypeError is raised if the argument is not of a type that can contain - annotations, and an empty dictionary is returned if no annotations are - present. - - BEWARE -- the behavior of globalns and localns is counterintuitive - (unless you are familiar with how eval() and exec() work). The - search order is locals first, then globals. - - - If no dict arguments are passed, an attempt is made to use the - globals from obj (or the respective module's globals for classes), - and these are also used as the locals. If the object does not appear - to have globals, an empty dictionary is used. - - - If one dict argument is passed, it is used for both globals and - locals. - - - If two dict arguments are passed, they specify globals and - locals, respectively. - """ - if hasattr(typing, "Annotated"): - hint = typing.get_type_hints( - obj, globalns=globalns, localns=localns, include_extras=True - ) - else: - hint = typing.get_type_hints(obj, globalns=globalns, localns=localns) - if include_extras: - return hint - return {k: _strip_extras(t) for k, t in hint.items()} - - -# Python 3.9+ has PEP 593 (Annotated) -if hasattr(typing, 'Annotated'): - Annotated = typing.Annotated - # Not exported and not a public API, but needed for get_origin() and get_args() - # to work. - _AnnotatedAlias = typing._AnnotatedAlias -# 3.7-3.8 -else: - class _AnnotatedAlias(typing._GenericAlias, _root=True): - """Runtime representation of an annotated type. - - At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't' - with extra annotations. The alias behaves like a normal typing alias, - instantiating is the same as instantiating the underlying type, binding - it to types is also the same. - """ - def __init__(self, origin, metadata): - if isinstance(origin, _AnnotatedAlias): - metadata = origin.__metadata__ + metadata - origin = origin.__origin__ - super().__init__(origin, origin) - self.__metadata__ = metadata - - def copy_with(self, params): - assert len(params) == 1 - new_type = params[0] - return _AnnotatedAlias(new_type, self.__metadata__) - - def __repr__(self): - return (f"typing_extensions.Annotated[{typing._type_repr(self.__origin__)}, " - f"{', '.join(repr(a) for a in self.__metadata__)}]") - - def __reduce__(self): - return operator.getitem, ( - Annotated, (self.__origin__,) + self.__metadata__ - ) - - def __eq__(self, other): - if not isinstance(other, _AnnotatedAlias): - return NotImplemented - if self.__origin__ != other.__origin__: - return False - return self.__metadata__ == other.__metadata__ - - def __hash__(self): - return hash((self.__origin__, self.__metadata__)) - - class Annotated: - """Add context specific metadata to a type. - - Example: Annotated[int, runtime_check.Unsigned] indicates to the - hypothetical runtime_check module that this type is an unsigned int. - Every other consumer of this type can ignore this metadata and treat - this type as int. - - The first argument to Annotated must be a valid type (and will be in - the __origin__ field), the remaining arguments are kept as a tuple in - the __extra__ field. - - Details: - - - It's an error to call `Annotated` with less than two arguments. - - Nested Annotated are flattened:: - - Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3] - - - Instantiating an annotated type is equivalent to instantiating the - underlying type:: - - Annotated[C, Ann1](5) == C(5) - - - Annotated can be used as a generic type alias:: - - Optimized = Annotated[T, runtime.Optimize()] - Optimized[int] == Annotated[int, runtime.Optimize()] - - OptimizedList = Annotated[List[T], runtime.Optimize()] - OptimizedList[int] == Annotated[List[int], runtime.Optimize()] - """ - - __slots__ = () - - def __new__(cls, *args, **kwargs): - raise TypeError("Type Annotated cannot be instantiated.") - - @typing._tp_cache - def __class_getitem__(cls, params): - if not isinstance(params, tuple) or len(params) < 2: - raise TypeError("Annotated[...] should be used " - "with at least two arguments (a type and an " - "annotation).") - allowed_special_forms = (ClassVar, Final) - if get_origin(params[0]) in allowed_special_forms: - origin = params[0] - else: - msg = "Annotated[t, ...]: t must be a type." - origin = typing._type_check(params[0], msg) - metadata = tuple(params[1:]) - return _AnnotatedAlias(origin, metadata) - - def __init_subclass__(cls, *args, **kwargs): - raise TypeError( - f"Cannot subclass {cls.__module__}.Annotated" - ) - -# Python 3.8 has get_origin() and get_args() but those implementations aren't -# Annotated-aware, so we can't use those. Python 3.9's versions don't support -# ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do. -if sys.version_info[:2] >= (3, 10): - get_origin = typing.get_origin - get_args = typing.get_args -# 3.7-3.9 -else: - try: - # 3.9+ - from typing import _BaseGenericAlias - except ImportError: - _BaseGenericAlias = typing._GenericAlias - try: - # 3.9+ - from typing import GenericAlias as _typing_GenericAlias - except ImportError: - _typing_GenericAlias = typing._GenericAlias - - def get_origin(tp): - """Get the unsubscripted version of a type. - - This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar - and Annotated. Return None for unsupported types. Examples:: - - get_origin(Literal[42]) is Literal - get_origin(int) is None - get_origin(ClassVar[int]) is ClassVar - get_origin(Generic) is Generic - get_origin(Generic[T]) is Generic - get_origin(Union[T, int]) is Union - get_origin(List[Tuple[T, T]][int]) == list - get_origin(P.args) is P - """ - if isinstance(tp, _AnnotatedAlias): - return Annotated - if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias, _BaseGenericAlias, - ParamSpecArgs, ParamSpecKwargs)): - return tp.__origin__ - if tp is typing.Generic: - return typing.Generic - return None - - def get_args(tp): - """Get type arguments with all substitutions performed. - - For unions, basic simplifications used by Union constructor are performed. - Examples:: - get_args(Dict[str, int]) == (str, int) - get_args(int) == () - get_args(Union[int, Union[T, int], str][int]) == (int, str) - get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int]) - get_args(Callable[[], T][int]) == ([], int) - """ - if isinstance(tp, _AnnotatedAlias): - return (tp.__origin__,) + tp.__metadata__ - if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias)): - if getattr(tp, "_special", False): - return () - res = tp.__args__ - if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis: - res = (list(res[:-1]), res[-1]) - return res - return () - - -# 3.10+ -if hasattr(typing, 'TypeAlias'): - TypeAlias = typing.TypeAlias -# 3.9 -elif sys.version_info[:2] >= (3, 9): - @_ExtensionsSpecialForm - def TypeAlias(self, parameters): - """Special marker indicating that an assignment should - be recognized as a proper type alias definition by type - checkers. - - For example:: - - Predicate: TypeAlias = Callable[..., bool] - - It's invalid when used anywhere except as in the example above. - """ - raise TypeError(f"{self} is not subscriptable") -# 3.7-3.8 -else: - TypeAlias = _ExtensionsSpecialForm( - 'TypeAlias', - doc="""Special marker indicating that an assignment should - be recognized as a proper type alias definition by type - checkers. - - For example:: - - Predicate: TypeAlias = Callable[..., bool] - - It's invalid when used anywhere except as in the example - above.""" - ) - - -def _set_default(type_param, default): - if isinstance(default, (tuple, list)): - type_param.__default__ = tuple((typing._type_check(d, "Default must be a type") - for d in default)) - elif default != _marker: - type_param.__default__ = typing._type_check(default, "Default must be a type") - else: - type_param.__default__ = None - - -def _set_module(typevarlike): - # for pickling: - def_mod = _caller(depth=3) - if def_mod != 'typing_extensions': - typevarlike.__module__ = def_mod - - -class _DefaultMixin: - """Mixin for TypeVarLike defaults.""" - - __slots__ = () - __init__ = _set_default - - -# Classes using this metaclass must provide a _backported_typevarlike ClassVar -class _TypeVarLikeMeta(type): - def __instancecheck__(cls, __instance: Any) -> bool: - return isinstance(__instance, cls._backported_typevarlike) - - -# Add default and infer_variance parameters from PEP 696 and 695 -class TypeVar(metaclass=_TypeVarLikeMeta): - """Type variable.""" - - _backported_typevarlike = typing.TypeVar - - def __new__(cls, name, *constraints, bound=None, - covariant=False, contravariant=False, - default=_marker, infer_variance=False): - if hasattr(typing, "TypeAliasType"): - # PEP 695 implemented, can pass infer_variance to typing.TypeVar - typevar = typing.TypeVar(name, *constraints, bound=bound, - covariant=covariant, contravariant=contravariant, - infer_variance=infer_variance) - else: - typevar = typing.TypeVar(name, *constraints, bound=bound, - covariant=covariant, contravariant=contravariant) - if infer_variance and (covariant or contravariant): - raise ValueError("Variance cannot be specified with infer_variance.") - typevar.__infer_variance__ = infer_variance - _set_default(typevar, default) - _set_module(typevar) - return typevar - - def __init_subclass__(cls) -> None: - raise TypeError(f"type '{__name__}.TypeVar' is not an acceptable base type") - - -# Python 3.10+ has PEP 612 -if hasattr(typing, 'ParamSpecArgs'): - ParamSpecArgs = typing.ParamSpecArgs - ParamSpecKwargs = typing.ParamSpecKwargs -# 3.7-3.9 -else: - class _Immutable: - """Mixin to indicate that object should not be copied.""" - __slots__ = () - - def __copy__(self): - return self - - def __deepcopy__(self, memo): - return self - - class ParamSpecArgs(_Immutable): - """The args for a ParamSpec object. - - Given a ParamSpec object P, P.args is an instance of ParamSpecArgs. - - ParamSpecArgs objects have a reference back to their ParamSpec: - - P.args.__origin__ is P - - This type is meant for runtime introspection and has no special meaning to - static type checkers. - """ - def __init__(self, origin): - self.__origin__ = origin - - def __repr__(self): - return f"{self.__origin__.__name__}.args" - - def __eq__(self, other): - if not isinstance(other, ParamSpecArgs): - return NotImplemented - return self.__origin__ == other.__origin__ - - class ParamSpecKwargs(_Immutable): - """The kwargs for a ParamSpec object. - - Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs. - - ParamSpecKwargs objects have a reference back to their ParamSpec: - - P.kwargs.__origin__ is P - - This type is meant for runtime introspection and has no special meaning to - static type checkers. - """ - def __init__(self, origin): - self.__origin__ = origin - - def __repr__(self): - return f"{self.__origin__.__name__}.kwargs" - - def __eq__(self, other): - if not isinstance(other, ParamSpecKwargs): - return NotImplemented - return self.__origin__ == other.__origin__ - -# 3.10+ -if hasattr(typing, 'ParamSpec'): - - # Add default parameter - PEP 696 - class ParamSpec(metaclass=_TypeVarLikeMeta): - """Parameter specification.""" - - _backported_typevarlike = typing.ParamSpec - - def __new__(cls, name, *, bound=None, - covariant=False, contravariant=False, - infer_variance=False, default=_marker): - if hasattr(typing, "TypeAliasType"): - # PEP 695 implemented, can pass infer_variance to typing.TypeVar - paramspec = typing.ParamSpec(name, bound=bound, - covariant=covariant, - contravariant=contravariant, - infer_variance=infer_variance) - else: - paramspec = typing.ParamSpec(name, bound=bound, - covariant=covariant, - contravariant=contravariant) - paramspec.__infer_variance__ = infer_variance - - _set_default(paramspec, default) - _set_module(paramspec) - return paramspec - - def __init_subclass__(cls) -> None: - raise TypeError(f"type '{__name__}.ParamSpec' is not an acceptable base type") - -# 3.7-3.9 -else: - - # Inherits from list as a workaround for Callable checks in Python < 3.9.2. - class ParamSpec(list, _DefaultMixin): - """Parameter specification variable. - - Usage:: - - P = ParamSpec('P') - - Parameter specification variables exist primarily for the benefit of static - type checkers. They are used to forward the parameter types of one - callable to another callable, a pattern commonly found in higher order - functions and decorators. They are only valid when used in ``Concatenate``, - or s the first argument to ``Callable``. In Python 3.10 and higher, - they are also supported in user-defined Generics at runtime. - See class Generic for more information on generic types. An - example for annotating a decorator:: - - T = TypeVar('T') - P = ParamSpec('P') - - def add_logging(f: Callable[P, T]) -> Callable[P, T]: - '''A type-safe decorator to add logging to a function.''' - def inner(*args: P.args, **kwargs: P.kwargs) -> T: - logging.info(f'{f.__name__} was called') - return f(*args, **kwargs) - return inner - - @add_logging - def add_two(x: float, y: float) -> float: - '''Add two numbers together.''' - return x + y - - Parameter specification variables defined with covariant=True or - contravariant=True can be used to declare covariant or contravariant - generic types. These keyword arguments are valid, but their actual semantics - are yet to be decided. See PEP 612 for details. - - Parameter specification variables can be introspected. e.g.: - - P.__name__ == 'T' - P.__bound__ == None - P.__covariant__ == False - P.__contravariant__ == False - - Note that only parameter specification variables defined in global scope can - be pickled. - """ - - # Trick Generic __parameters__. - __class__ = typing.TypeVar - - @property - def args(self): - return ParamSpecArgs(self) - - @property - def kwargs(self): - return ParamSpecKwargs(self) - - def __init__(self, name, *, bound=None, covariant=False, contravariant=False, - infer_variance=False, default=_marker): - super().__init__([self]) - self.__name__ = name - self.__covariant__ = bool(covariant) - self.__contravariant__ = bool(contravariant) - self.__infer_variance__ = bool(infer_variance) - if bound: - self.__bound__ = typing._type_check(bound, 'Bound must be a type.') - else: - self.__bound__ = None - _DefaultMixin.__init__(self, default) - - # for pickling: - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - - def __repr__(self): - if self.__infer_variance__: - prefix = '' - elif self.__covariant__: - prefix = '+' - elif self.__contravariant__: - prefix = '-' - else: - prefix = '~' - return prefix + self.__name__ - - def __hash__(self): - return object.__hash__(self) - - def __eq__(self, other): - return self is other - - def __reduce__(self): - return self.__name__ - - # Hack to get typing._type_check to pass. - def __call__(self, *args, **kwargs): - pass - - -# 3.7-3.9 -if not hasattr(typing, 'Concatenate'): - # Inherits from list as a workaround for Callable checks in Python < 3.9.2. - class _ConcatenateGenericAlias(list): - - # Trick Generic into looking into this for __parameters__. - __class__ = typing._GenericAlias - - # Flag in 3.8. - _special = False - - def __init__(self, origin, args): - super().__init__(args) - self.__origin__ = origin - self.__args__ = args - - def __repr__(self): - _type_repr = typing._type_repr - return (f'{_type_repr(self.__origin__)}' - f'[{", ".join(_type_repr(arg) for arg in self.__args__)}]') - - def __hash__(self): - return hash((self.__origin__, self.__args__)) - - # Hack to get typing._type_check to pass in Generic. - def __call__(self, *args, **kwargs): - pass - - @property - def __parameters__(self): - return tuple( - tp for tp in self.__args__ if isinstance(tp, (typing.TypeVar, ParamSpec)) - ) - - -# 3.7-3.9 -@typing._tp_cache -def _concatenate_getitem(self, parameters): - if parameters == (): - raise TypeError("Cannot take a Concatenate of no types.") - if not isinstance(parameters, tuple): - parameters = (parameters,) - if not isinstance(parameters[-1], ParamSpec): - raise TypeError("The last parameter to Concatenate should be a " - "ParamSpec variable.") - msg = "Concatenate[arg, ...]: each arg must be a type." - parameters = tuple(typing._type_check(p, msg) for p in parameters) - return _ConcatenateGenericAlias(self, parameters) - - -# 3.10+ -if hasattr(typing, 'Concatenate'): - Concatenate = typing.Concatenate - _ConcatenateGenericAlias = typing._ConcatenateGenericAlias # noqa: F811 -# 3.9 -elif sys.version_info[:2] >= (3, 9): - @_ExtensionsSpecialForm - def Concatenate(self, parameters): - """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a - higher order function which adds, removes or transforms parameters of a - callable. - - For example:: - - Callable[Concatenate[int, P], int] - - See PEP 612 for detailed information. - """ - return _concatenate_getitem(self, parameters) -# 3.7-8 -else: - class _ConcatenateForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - return _concatenate_getitem(self, parameters) - - Concatenate = _ConcatenateForm( - 'Concatenate', - doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a - higher order function which adds, removes or transforms parameters of a - callable. - - For example:: - - Callable[Concatenate[int, P], int] - - See PEP 612 for detailed information. - """) - -# 3.10+ -if hasattr(typing, 'TypeGuard'): - TypeGuard = typing.TypeGuard -# 3.9 -elif sys.version_info[:2] >= (3, 9): - @_ExtensionsSpecialForm - def TypeGuard(self, parameters): - """Special typing form used to annotate the return type of a user-defined - type guard function. ``TypeGuard`` only accepts a single type argument. - At runtime, functions marked this way should return a boolean. - - ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static - type checkers to determine a more precise type of an expression within a - program's code flow. Usually type narrowing is done by analyzing - conditional code flow and applying the narrowing to a block of code. The - conditional expression here is sometimes referred to as a "type guard". - - Sometimes it would be convenient to use a user-defined boolean function - as a type guard. Such a function should use ``TypeGuard[...]`` as its - return type to alert static type checkers to this intention. - - Using ``-> TypeGuard`` tells the static type checker that for a given - function: - - 1. The return value is a boolean. - 2. If the return value is ``True``, the type of its argument - is the type inside ``TypeGuard``. - - For example:: - - def is_str(val: Union[str, float]): - # "isinstance" type guard - if isinstance(val, str): - # Type of ``val`` is narrowed to ``str`` - ... - else: - # Else, type of ``val`` is narrowed to ``float``. - ... - - Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower - form of ``TypeA`` (it can even be a wider form) and this may lead to - type-unsafe results. The main reason is to allow for things like - narrowing ``List[object]`` to ``List[str]`` even though the latter is not - a subtype of the former, since ``List`` is invariant. The responsibility of - writing type-safe type guards is left to the user. - - ``TypeGuard`` also works with type variables. For more information, see - PEP 647 (User-Defined Type Guards). - """ - item = typing._type_check(parameters, f'{self} accepts only a single type.') - return typing._GenericAlias(self, (item,)) -# 3.7-3.8 -else: - class _TypeGuardForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - item = typing._type_check(parameters, - f'{self._name} accepts only a single type') - return typing._GenericAlias(self, (item,)) - - TypeGuard = _TypeGuardForm( - 'TypeGuard', - doc="""Special typing form used to annotate the return type of a user-defined - type guard function. ``TypeGuard`` only accepts a single type argument. - At runtime, functions marked this way should return a boolean. - - ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static - type checkers to determine a more precise type of an expression within a - program's code flow. Usually type narrowing is done by analyzing - conditional code flow and applying the narrowing to a block of code. The - conditional expression here is sometimes referred to as a "type guard". - - Sometimes it would be convenient to use a user-defined boolean function - as a type guard. Such a function should use ``TypeGuard[...]`` as its - return type to alert static type checkers to this intention. - - Using ``-> TypeGuard`` tells the static type checker that for a given - function: - - 1. The return value is a boolean. - 2. If the return value is ``True``, the type of its argument - is the type inside ``TypeGuard``. - - For example:: - - def is_str(val: Union[str, float]): - # "isinstance" type guard - if isinstance(val, str): - # Type of ``val`` is narrowed to ``str`` - ... - else: - # Else, type of ``val`` is narrowed to ``float``. - ... - - Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower - form of ``TypeA`` (it can even be a wider form) and this may lead to - type-unsafe results. The main reason is to allow for things like - narrowing ``List[object]`` to ``List[str]`` even though the latter is not - a subtype of the former, since ``List`` is invariant. The responsibility of - writing type-safe type guards is left to the user. - - ``TypeGuard`` also works with type variables. For more information, see - PEP 647 (User-Defined Type Guards). - """) - - -# Vendored from cpython typing._SpecialFrom -class _SpecialForm(typing._Final, _root=True): - __slots__ = ('_name', '__doc__', '_getitem') - - def __init__(self, getitem): - self._getitem = getitem - self._name = getitem.__name__ - self.__doc__ = getitem.__doc__ - - def __getattr__(self, item): - if item in {'__name__', '__qualname__'}: - return self._name - - raise AttributeError(item) - - def __mro_entries__(self, bases): - raise TypeError(f"Cannot subclass {self!r}") - - def __repr__(self): - return f'typing_extensions.{self._name}' - - def __reduce__(self): - return self._name - - def __call__(self, *args, **kwds): - raise TypeError(f"Cannot instantiate {self!r}") - - def __or__(self, other): - return typing.Union[self, other] - - def __ror__(self, other): - return typing.Union[other, self] - - def __instancecheck__(self, obj): - raise TypeError(f"{self} cannot be used with isinstance()") - - def __subclasscheck__(self, cls): - raise TypeError(f"{self} cannot be used with issubclass()") - - @typing._tp_cache - def __getitem__(self, parameters): - return self._getitem(self, parameters) - - -if hasattr(typing, "LiteralString"): - LiteralString = typing.LiteralString -else: - @_SpecialForm - def LiteralString(self, params): - """Represents an arbitrary literal string. - - Example:: - - from opensafely._vendor.typing_extensions import LiteralString - - def query(sql: LiteralString) -> ...: - ... - - query("SELECT * FROM table") # ok - query(f"SELECT * FROM {input()}") # not ok - - See PEP 675 for details. - - """ - raise TypeError(f"{self} is not subscriptable") - - -if hasattr(typing, "Self"): - Self = typing.Self -else: - @_SpecialForm - def Self(self, params): - """Used to spell the type of "self" in classes. - - Example:: - - from typing import Self - - class ReturnsSelf: - def parse(self, data: bytes) -> Self: - ... - return self - - """ - - raise TypeError(f"{self} is not subscriptable") - - -if hasattr(typing, "Never"): - Never = typing.Never -else: - @_SpecialForm - def Never(self, params): - """The bottom type, a type that has no members. - - This can be used to define a function that should never be - called, or a function that never returns:: - - from opensafely._vendor.typing_extensions import Never - - def never_call_me(arg: Never) -> None: - pass - - def int_or_str(arg: int | str) -> None: - never_call_me(arg) # type checker error - match arg: - case int(): - print("It's an int") - case str(): - print("It's a str") - case _: - never_call_me(arg) # ok, arg is of type Never - - """ - - raise TypeError(f"{self} is not subscriptable") - - -if hasattr(typing, 'Required'): - Required = typing.Required - NotRequired = typing.NotRequired -elif sys.version_info[:2] >= (3, 9): - @_ExtensionsSpecialForm - def Required(self, parameters): - """A special typing construct to mark a key of a total=False TypedDict - as required. For example: - - class Movie(TypedDict, total=False): - title: Required[str] - year: int - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - - There is no runtime checking that a required key is actually provided - when instantiating a related TypedDict. - """ - item = typing._type_check(parameters, f'{self._name} accepts only a single type.') - return typing._GenericAlias(self, (item,)) - - @_ExtensionsSpecialForm - def NotRequired(self, parameters): - """A special typing construct to mark a key of a TypedDict as - potentially missing. For example: - - class Movie(TypedDict): - title: str - year: NotRequired[int] - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - """ - item = typing._type_check(parameters, f'{self._name} accepts only a single type.') - return typing._GenericAlias(self, (item,)) - -else: - class _RequiredForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - item = typing._type_check(parameters, - f'{self._name} accepts only a single type.') - return typing._GenericAlias(self, (item,)) - - Required = _RequiredForm( - 'Required', - doc="""A special typing construct to mark a key of a total=False TypedDict - as required. For example: - - class Movie(TypedDict, total=False): - title: Required[str] - year: int - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - - There is no runtime checking that a required key is actually provided - when instantiating a related TypedDict. - """) - NotRequired = _RequiredForm( - 'NotRequired', - doc="""A special typing construct to mark a key of a TypedDict as - potentially missing. For example: - - class Movie(TypedDict): - title: str - year: NotRequired[int] - - m = Movie( - title='The Matrix', # typechecker error if key is omitted - year=1999, - ) - """) - - -_UNPACK_DOC = """\ -Type unpack operator. - -The type unpack operator takes the child types from some container type, -such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For -example: - - # For some generic class `Foo`: - Foo[Unpack[tuple[int, str]]] # Equivalent to Foo[int, str] - - Ts = TypeVarTuple('Ts') - # Specifies that `Bar` is generic in an arbitrary number of types. - # (Think of `Ts` as a tuple of an arbitrary number of individual - # `TypeVar`s, which the `Unpack` is 'pulling out' directly into the - # `Generic[]`.) - class Bar(Generic[Unpack[Ts]]): ... - Bar[int] # Valid - Bar[int, str] # Also valid - -From Python 3.11, this can also be done using the `*` operator: - - Foo[*tuple[int, str]] - class Bar(Generic[*Ts]): ... - -The operator can also be used along with a `TypedDict` to annotate -`**kwargs` in a function signature. For instance: - - class Movie(TypedDict): - name: str - year: int - - # This function expects two keyword arguments - *name* of type `str` and - # *year* of type `int`. - def foo(**kwargs: Unpack[Movie]): ... - -Note that there is only some runtime checking of this operator. Not -everything the runtime allows may be accepted by static type checkers. - -For more information, see PEP 646 and PEP 692. -""" - - -if sys.version_info >= (3, 12): # PEP 692 changed the repr of Unpack[] - Unpack = typing.Unpack - - def _is_unpack(obj): - return get_origin(obj) is Unpack - -elif sys.version_info[:2] >= (3, 9): - class _UnpackSpecialForm(_ExtensionsSpecialForm, _root=True): - def __init__(self, getitem): - super().__init__(getitem) - self.__doc__ = _UNPACK_DOC - - class _UnpackAlias(typing._GenericAlias, _root=True): - __class__ = typing.TypeVar - - @_UnpackSpecialForm - def Unpack(self, parameters): - item = typing._type_check(parameters, f'{self._name} accepts only a single type.') - return _UnpackAlias(self, (item,)) - - def _is_unpack(obj): - return isinstance(obj, _UnpackAlias) - -else: - class _UnpackAlias(typing._GenericAlias, _root=True): - __class__ = typing.TypeVar - - class _UnpackForm(_ExtensionsSpecialForm, _root=True): - def __getitem__(self, parameters): - item = typing._type_check(parameters, - f'{self._name} accepts only a single type.') - return _UnpackAlias(self, (item,)) - - Unpack = _UnpackForm('Unpack', doc=_UNPACK_DOC) - - def _is_unpack(obj): - return isinstance(obj, _UnpackAlias) - - -if hasattr(typing, "TypeVarTuple"): # 3.11+ - - # Add default parameter - PEP 696 - class TypeVarTuple(metaclass=_TypeVarLikeMeta): - """Type variable tuple.""" - - _backported_typevarlike = typing.TypeVarTuple - - def __new__(cls, name, *, default=_marker): - tvt = typing.TypeVarTuple(name) - _set_default(tvt, default) - _set_module(tvt) - return tvt - - def __init_subclass__(self, *args, **kwds): - raise TypeError("Cannot subclass special typing classes") - -else: - class TypeVarTuple(_DefaultMixin): - """Type variable tuple. - - Usage:: - - Ts = TypeVarTuple('Ts') - - In the same way that a normal type variable is a stand-in for a single - type such as ``int``, a type variable *tuple* is a stand-in for a *tuple* - type such as ``Tuple[int, str]``. - - Type variable tuples can be used in ``Generic`` declarations. - Consider the following example:: - - class Array(Generic[*Ts]): ... - - The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``, - where ``T1`` and ``T2`` are type variables. To use these type variables - as type parameters of ``Array``, we must *unpack* the type variable tuple using - the star operator: ``*Ts``. The signature of ``Array`` then behaves - as if we had simply written ``class Array(Generic[T1, T2]): ...``. - In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows - us to parameterise the class with an *arbitrary* number of type parameters. - - Type variable tuples can be used anywhere a normal ``TypeVar`` can. - This includes class definitions, as shown above, as well as function - signatures and variable annotations:: - - class Array(Generic[*Ts]): - - def __init__(self, shape: Tuple[*Ts]): - self._shape: Tuple[*Ts] = shape - - def get_shape(self) -> Tuple[*Ts]: - return self._shape - - shape = (Height(480), Width(640)) - x: Array[Height, Width] = Array(shape) - y = abs(x) # Inferred type is Array[Height, Width] - z = x + x # ... is Array[Height, Width] - x.get_shape() # ... is tuple[Height, Width] - - """ - - # Trick Generic __parameters__. - __class__ = typing.TypeVar - - def __iter__(self): - yield self.__unpacked__ - - def __init__(self, name, *, default=_marker): - self.__name__ = name - _DefaultMixin.__init__(self, default) - - # for pickling: - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - - self.__unpacked__ = Unpack[self] - - def __repr__(self): - return self.__name__ - - def __hash__(self): - return object.__hash__(self) - - def __eq__(self, other): - return self is other - - def __reduce__(self): - return self.__name__ - - def __init_subclass__(self, *args, **kwds): - if '_root' not in kwds: - raise TypeError("Cannot subclass special typing classes") - - -if hasattr(typing, "reveal_type"): - reveal_type = typing.reveal_type -else: - def reveal_type(__obj: T) -> T: - """Reveal the inferred type of a variable. - - When a static type checker encounters a call to ``reveal_type()``, - it will emit the inferred type of the argument:: - - x: int = 1 - reveal_type(x) - - Running a static type checker (e.g., ``mypy``) on this example - will produce output similar to 'Revealed type is "builtins.int"'. - - At runtime, the function prints the runtime type of the - argument and returns it unchanged. - - """ - print(f"Runtime type is {type(__obj).__name__!r}", file=sys.stderr) - return __obj - - -if hasattr(typing, "assert_never"): - assert_never = typing.assert_never -else: - def assert_never(__arg: Never) -> Never: - """Assert to the type checker that a line of code is unreachable. - - Example:: - - def int_or_str(arg: int | str) -> None: - match arg: - case int(): - print("It's an int") - case str(): - print("It's a str") - case _: - assert_never(arg) - - If a type checker finds that a call to assert_never() is - reachable, it will emit an error. - - At runtime, this throws an exception when called. - - """ - raise AssertionError("Expected code to be unreachable") - - -if sys.version_info >= (3, 12): - # dataclass_transform exists in 3.11 but lacks the frozen_default parameter - dataclass_transform = typing.dataclass_transform -else: - def dataclass_transform( - *, - eq_default: bool = True, - order_default: bool = False, - kw_only_default: bool = False, - frozen_default: bool = False, - field_specifiers: typing.Tuple[ - typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]], - ... - ] = (), - **kwargs: typing.Any, - ) -> typing.Callable[[T], T]: - """Decorator that marks a function, class, or metaclass as providing - dataclass-like behavior. - - Example: - - from opensafely._vendor.typing_extensions import dataclass_transform - - _T = TypeVar("_T") - - # Used on a decorator function - @dataclass_transform() - def create_model(cls: type[_T]) -> type[_T]: - ... - return cls - - @create_model - class CustomerModel: - id: int - name: str - - # Used on a base class - @dataclass_transform() - class ModelBase: ... - - class CustomerModel(ModelBase): - id: int - name: str - - # Used on a metaclass - @dataclass_transform() - class ModelMeta(type): ... - - class ModelBase(metaclass=ModelMeta): ... - - class CustomerModel(ModelBase): - id: int - name: str - - Each of the ``CustomerModel`` classes defined in this example will now - behave similarly to a dataclass created with the ``@dataclasses.dataclass`` - decorator. For example, the type checker will synthesize an ``__init__`` - method. - - The arguments to this decorator can be used to customize this behavior: - - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be - True or False if it is omitted by the caller. - - ``order_default`` indicates whether the ``order`` parameter is - assumed to be True or False if it is omitted by the caller. - - ``kw_only_default`` indicates whether the ``kw_only`` parameter is - assumed to be True or False if it is omitted by the caller. - - ``frozen_default`` indicates whether the ``frozen`` parameter is - assumed to be True or False if it is omitted by the caller. - - ``field_specifiers`` specifies a static list of supported classes - or functions that describe fields, similar to ``dataclasses.field()``. - - At runtime, this decorator records its arguments in the - ``__dataclass_transform__`` attribute on the decorated object. - - See PEP 681 for details. - - """ - def decorator(cls_or_fn): - cls_or_fn.__dataclass_transform__ = { - "eq_default": eq_default, - "order_default": order_default, - "kw_only_default": kw_only_default, - "frozen_default": frozen_default, - "field_specifiers": field_specifiers, - "kwargs": kwargs, - } - return cls_or_fn - return decorator - - -if hasattr(typing, "override"): - override = typing.override -else: - _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any]) - - def override(__arg: _F) -> _F: - """Indicate that a method is intended to override a method in a base class. - - Usage: - - class Base: - def method(self) -> None: ... - pass - - class Child(Base): - @override - def method(self) -> None: - super().method() - - When this decorator is applied to a method, the type checker will - validate that it overrides a method with the same name on a base class. - This helps prevent bugs that may occur when a base class is changed - without an equivalent change to a child class. - - There is no runtime checking of these properties. The decorator - sets the ``__override__`` attribute to ``True`` on the decorated object - to allow runtime introspection. - - See PEP 698 for details. - - """ - try: - __arg.__override__ = True - except (AttributeError, TypeError): - # Skip the attribute silently if it is not writable. - # AttributeError happens if the object has __slots__ or a - # read-only property, TypeError if it's a builtin class. - pass - return __arg - - -if hasattr(typing, "deprecated"): - deprecated = typing.deprecated -else: - _T = typing.TypeVar("_T") - - def deprecated( - __msg: str, - *, - category: typing.Optional[typing.Type[Warning]] = DeprecationWarning, - stacklevel: int = 1, - ) -> typing.Callable[[_T], _T]: - """Indicate that a class, function or overload is deprecated. - - Usage: - - @deprecated("Use B instead") - class A: - pass - - @deprecated("Use g instead") - def f(): - pass - - @overload - @deprecated("int support is deprecated") - def g(x: int) -> int: ... - @overload - def g(x: str) -> int: ... - - When this decorator is applied to an object, the type checker - will generate a diagnostic on usage of the deprecated object. - - The warning specified by ``category`` will be emitted on use - of deprecated objects. For functions, that happens on calls; - for classes, on instantiation. If the ``category`` is ``None``, - no warning is emitted. The ``stacklevel`` determines where the - warning is emitted. If it is ``1`` (the default), the warning - is emitted at the direct caller of the deprecated object; if it - is higher, it is emitted further up the stack. - - The decorator sets the ``__deprecated__`` - attribute on the decorated object to the deprecation message - passed to the decorator. If applied to an overload, the decorator - must be after the ``@overload`` decorator for the attribute to - exist on the overload as returned by ``get_overloads()``. - - See PEP 702 for details. - - """ - def decorator(__arg: _T) -> _T: - if category is None: - __arg.__deprecated__ = __msg - return __arg - elif isinstance(__arg, type): - original_new = __arg.__new__ - has_init = __arg.__init__ is not object.__init__ - - @functools.wraps(original_new) - def __new__(cls, *args, **kwargs): - warnings.warn(__msg, category=category, stacklevel=stacklevel + 1) - if original_new is not object.__new__: - return original_new(cls, *args, **kwargs) - # Mirrors a similar check in object.__new__. - elif not has_init and (args or kwargs): - raise TypeError(f"{cls.__name__}() takes no arguments") - else: - return original_new(cls) - - __arg.__new__ = staticmethod(__new__) - __arg.__deprecated__ = __new__.__deprecated__ = __msg - return __arg - elif callable(__arg): - @functools.wraps(__arg) - def wrapper(*args, **kwargs): - warnings.warn(__msg, category=category, stacklevel=stacklevel + 1) - return __arg(*args, **kwargs) - - __arg.__deprecated__ = wrapper.__deprecated__ = __msg - return wrapper - else: - raise TypeError( - "@deprecated decorator with non-None category must be applied to " - f"a class or callable, not {__arg!r}" - ) - - return decorator - - -# We have to do some monkey patching to deal with the dual nature of -# Unpack/TypeVarTuple: -# - We want Unpack to be a kind of TypeVar so it gets accepted in -# Generic[Unpack[Ts]] -# - We want it to *not* be treated as a TypeVar for the purposes of -# counting generic parameters, so that when we subscript a generic, -# the runtime doesn't try to substitute the Unpack with the subscripted type. -if not hasattr(typing, "TypeVarTuple"): - typing._collect_type_vars = _collect_type_vars - typing._check_generic = _check_generic - - -# Backport typing.NamedTuple as it exists in Python 3.12. -# In 3.11, the ability to define generic `NamedTuple`s was supported. -# This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8. -# On 3.12, we added __orig_bases__ to call-based NamedTuples -# On 3.13, we deprecated kwargs-based NamedTuples -if sys.version_info >= (3, 13): - NamedTuple = typing.NamedTuple -else: - def _make_nmtuple(name, types, module, defaults=()): - fields = [n for n, t in types] - annotations = {n: typing._type_check(t, f"field {n} annotation must be a type") - for n, t in types} - nm_tpl = collections.namedtuple(name, fields, - defaults=defaults, module=module) - nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations - # The `_field_types` attribute was removed in 3.9; - # in earlier versions, it is the same as the `__annotations__` attribute - if sys.version_info < (3, 9): - nm_tpl._field_types = annotations - return nm_tpl - - _prohibited_namedtuple_fields = typing._prohibited - _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'}) - - class _NamedTupleMeta(type): - def __new__(cls, typename, bases, ns): - assert _NamedTuple in bases - for base in bases: - if base is not _NamedTuple and base is not typing.Generic: - raise TypeError( - 'can only inherit from a NamedTuple type and Generic') - bases = tuple(tuple if base is _NamedTuple else base for base in bases) - types = ns.get('__annotations__', {}) - default_names = [] - for field_name in types: - if field_name in ns: - default_names.append(field_name) - elif default_names: - raise TypeError(f"Non-default namedtuple field {field_name} " - f"cannot follow default field" - f"{'s' if len(default_names) > 1 else ''} " - f"{', '.join(default_names)}") - nm_tpl = _make_nmtuple( - typename, types.items(), - defaults=[ns[n] for n in default_names], - module=ns['__module__'] - ) - nm_tpl.__bases__ = bases - if typing.Generic in bases: - if hasattr(typing, '_generic_class_getitem'): # 3.12+ - nm_tpl.__class_getitem__ = classmethod(typing._generic_class_getitem) - else: - class_getitem = typing.Generic.__class_getitem__.__func__ - nm_tpl.__class_getitem__ = classmethod(class_getitem) - # update from user namespace without overriding special namedtuple attributes - for key in ns: - if key in _prohibited_namedtuple_fields: - raise AttributeError("Cannot overwrite NamedTuple attribute " + key) - elif key not in _special_namedtuple_fields and key not in nm_tpl._fields: - setattr(nm_tpl, key, ns[key]) - if typing.Generic in bases: - nm_tpl.__init_subclass__() - return nm_tpl - - _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {}) - - def _namedtuple_mro_entries(bases): - assert NamedTuple in bases - return (_NamedTuple,) - - @_ensure_subclassable(_namedtuple_mro_entries) - def NamedTuple(__typename, __fields=_marker, **kwargs): - """Typed version of namedtuple. - - Usage:: - - class Employee(NamedTuple): - name: str - id: int - - This is equivalent to:: - - Employee = collections.namedtuple('Employee', ['name', 'id']) - - The resulting class has an extra __annotations__ attribute, giving a - dict that maps field names to types. (The field names are also in - the _fields attribute, which is part of the namedtuple API.) - An alternative equivalent functional syntax is also accepted:: - - Employee = NamedTuple('Employee', [('name', str), ('id', int)]) - """ - if __fields is _marker: - if kwargs: - deprecated_thing = "Creating NamedTuple classes using keyword arguments" - deprecation_msg = ( - "{name} is deprecated and will be disallowed in Python {remove}. " - "Use the class-based or functional syntax instead." - ) - else: - deprecated_thing = "Failing to pass a value for the 'fields' parameter" - example = f"`{__typename} = NamedTuple({__typename!r}, [])`" - deprecation_msg = ( - "{name} is deprecated and will be disallowed in Python {remove}. " - "To create a NamedTuple class with 0 fields " - "using the functional syntax, " - "pass an empty list, e.g. " - ) + example + "." - elif __fields is None: - if kwargs: - raise TypeError( - "Cannot pass `None` as the 'fields' parameter " - "and also specify fields using keyword arguments" - ) - else: - deprecated_thing = "Passing `None` as the 'fields' parameter" - example = f"`{__typename} = NamedTuple({__typename!r}, [])`" - deprecation_msg = ( - "{name} is deprecated and will be disallowed in Python {remove}. " - "To create a NamedTuple class with 0 fields " - "using the functional syntax, " - "pass an empty list, e.g. " - ) + example + "." - elif kwargs: - raise TypeError("Either list of fields or keywords" - " can be provided to NamedTuple, not both") - if __fields is _marker or __fields is None: - warnings.warn( - deprecation_msg.format(name=deprecated_thing, remove="3.15"), - DeprecationWarning, - stacklevel=2, - ) - __fields = kwargs.items() - nt = _make_nmtuple(__typename, __fields, module=_caller()) - nt.__orig_bases__ = (NamedTuple,) - return nt - - # On 3.8+, alter the signature so that it matches typing.NamedTuple. - # The signature of typing.NamedTuple on >=3.8 is invalid syntax in Python 3.7, - # so just leave the signature as it is on 3.7. - if sys.version_info >= (3, 8): - _new_signature = '(typename, fields=None, /, **kwargs)' - if isinstance(NamedTuple, _types.FunctionType): - NamedTuple.__text_signature__ = _new_signature - else: - NamedTuple.__call__.__text_signature__ = _new_signature - - -if hasattr(collections.abc, "Buffer"): - Buffer = collections.abc.Buffer -else: - class Buffer(abc.ABC): - """Base class for classes that implement the buffer protocol. - - The buffer protocol allows Python objects to expose a low-level - memory buffer interface. Before Python 3.12, it is not possible - to implement the buffer protocol in pure Python code, or even - to check whether a class implements the buffer protocol. In - Python 3.12 and higher, the ``__buffer__`` method allows access - to the buffer protocol from Python code, and the - ``collections.abc.Buffer`` ABC allows checking whether a class - implements the buffer protocol. - - To indicate support for the buffer protocol in earlier versions, - inherit from this ABC, either in a stub file or at runtime, - or use ABC registration. This ABC provides no methods, because - there is no Python-accessible methods shared by pre-3.12 buffer - classes. It is useful primarily for static checks. - - """ - - # As a courtesy, register the most common stdlib buffer classes. - Buffer.register(memoryview) - Buffer.register(bytearray) - Buffer.register(bytes) - - -# Backport of types.get_original_bases, available on 3.12+ in CPython -if hasattr(_types, "get_original_bases"): - get_original_bases = _types.get_original_bases -else: - def get_original_bases(__cls): - """Return the class's "original" bases prior to modification by `__mro_entries__`. - - Examples:: - - from typing import TypeVar, Generic - from opensafely._vendor.typing_extensions import NamedTuple, TypedDict - - T = TypeVar("T") - class Foo(Generic[T]): ... - class Bar(Foo[int], float): ... - class Baz(list[str]): ... - Eggs = NamedTuple("Eggs", [("a", int), ("b", str)]) - Spam = TypedDict("Spam", {"a": int, "b": str}) - - assert get_original_bases(Bar) == (Foo[int], float) - assert get_original_bases(Baz) == (list[str],) - assert get_original_bases(Eggs) == (NamedTuple,) - assert get_original_bases(Spam) == (TypedDict,) - assert get_original_bases(int) == (object,) - """ - try: - return __cls.__orig_bases__ - except AttributeError: - try: - return __cls.__bases__ - except AttributeError: - raise TypeError( - f'Expected an instance of type, not {type(__cls).__name__!r}' - ) from None - - -# NewType is a class on Python 3.10+, making it pickleable -# The error message for subclassing instances of NewType was improved on 3.11+ -if sys.version_info >= (3, 11): - NewType = typing.NewType -else: - class NewType: - """NewType creates simple unique types with almost zero - runtime overhead. NewType(name, tp) is considered a subtype of tp - by static type checkers. At runtime, NewType(name, tp) returns - a dummy callable that simply returns its argument. Usage:: - UserId = NewType('UserId', int) - def name_by_id(user_id: UserId) -> str: - ... - UserId('user') # Fails type check - name_by_id(42) # Fails type check - name_by_id(UserId(42)) # OK - num = UserId(5) + 1 # type: int - """ - - def __call__(self, obj): - return obj - - def __init__(self, name, tp): - self.__qualname__ = name - if '.' in name: - name = name.rpartition('.')[-1] - self.__name__ = name - self.__supertype__ = tp - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - - def __mro_entries__(self, bases): - # We defined __mro_entries__ to get a better error message - # if a user attempts to subclass a NewType instance. bpo-46170 - supercls_name = self.__name__ - - class Dummy: - def __init_subclass__(cls): - subcls_name = cls.__name__ - raise TypeError( - f"Cannot subclass an instance of NewType. " - f"Perhaps you were looking for: " - f"`{subcls_name} = NewType({subcls_name!r}, {supercls_name})`" - ) - - return (Dummy,) - - def __repr__(self): - return f'{self.__module__}.{self.__qualname__}' - - def __reduce__(self): - return self.__qualname__ - - if sys.version_info >= (3, 10): - # PEP 604 methods - # It doesn't make sense to have these methods on Python <3.10 - - def __or__(self, other): - return typing.Union[self, other] - - def __ror__(self, other): - return typing.Union[other, self] - - -if hasattr(typing, "TypeAliasType"): - TypeAliasType = typing.TypeAliasType -else: - def _is_unionable(obj): - """Corresponds to is_unionable() in unionobject.c in CPython.""" - return obj is None or isinstance(obj, ( - type, - _types.GenericAlias, - _types.UnionType, - TypeAliasType, - )) - - class TypeAliasType: - """Create named, parameterized type aliases. - - This provides a backport of the new `type` statement in Python 3.12: - - type ListOrSet[T] = list[T] | set[T] - - is equivalent to: - - T = TypeVar("T") - ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,)) - - The name ListOrSet can then be used as an alias for the type it refers to. - - The type_params argument should contain all the type parameters used - in the value of the type alias. If the alias is not generic, this - argument is omitted. - - Static type checkers should only support type aliases declared using - TypeAliasType that follow these rules: - - - The first argument (the name) must be a string literal. - - The TypeAliasType instance must be immediately assigned to a variable - of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid, - as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)'). - - """ - - def __init__(self, name: str, value, *, type_params=()): - if not isinstance(name, str): - raise TypeError("TypeAliasType name must be a string") - self.__value__ = value - self.__type_params__ = type_params - - parameters = [] - for type_param in type_params: - if isinstance(type_param, TypeVarTuple): - parameters.extend(type_param) - else: - parameters.append(type_param) - self.__parameters__ = tuple(parameters) - def_mod = _caller() - if def_mod != 'typing_extensions': - self.__module__ = def_mod - # Setting this attribute closes the TypeAliasType from further modification - self.__name__ = name - - def __setattr__(self, __name: str, __value: object) -> None: - if hasattr(self, "__name__"): - self._raise_attribute_error(__name) - super().__setattr__(__name, __value) - - def __delattr__(self, __name: str) -> Never: - self._raise_attribute_error(__name) - - def _raise_attribute_error(self, name: str) -> Never: - # Match the Python 3.12 error messages exactly - if name == "__name__": - raise AttributeError("readonly attribute") - elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}: - raise AttributeError( - f"attribute '{name}' of 'typing.TypeAliasType' objects " - "is not writable" - ) - else: - raise AttributeError( - f"'typing.TypeAliasType' object has no attribute '{name}'" - ) - - def __repr__(self) -> str: - return self.__name__ - - def __getitem__(self, parameters): - if not isinstance(parameters, tuple): - parameters = (parameters,) - parameters = [ - typing._type_check( - item, f'Subscripting {self.__name__} requires a type.' - ) - for item in parameters - ] - return typing._GenericAlias(self, tuple(parameters)) - - def __reduce__(self): - return self.__name__ - - def __init_subclass__(cls, *args, **kwargs): - raise TypeError( - "type 'typing_extensions.TypeAliasType' is not an acceptable base type" - ) - - # The presence of this method convinces typing._type_check - # that TypeAliasTypes are types. - def __call__(self): - raise TypeError("Type alias is not callable") - - if sys.version_info >= (3, 10): - def __or__(self, right): - # For forward compatibility with 3.12, reject Unions - # that are not accepted by the built-in Union. - if not _is_unionable(right): - return NotImplemented - return typing.Union[self, right] - - def __ror__(self, left): - if not _is_unionable(left): - return NotImplemented - return typing.Union[left, self] - - -if hasattr(typing, "is_protocol"): - is_protocol = typing.is_protocol - get_protocol_members = typing.get_protocol_members -else: - def is_protocol(__tp: type) -> bool: - """Return True if the given type is a Protocol. - - Example:: - - >>> from typing_extensions import Protocol, is_protocol - >>> class P(Protocol): - ... def a(self) -> str: ... - ... b: int - >>> is_protocol(P) - True - >>> is_protocol(int) - False - """ - return ( - isinstance(__tp, type) - and getattr(__tp, '_is_protocol', False) - and __tp is not Protocol - and __tp is not getattr(typing, "Protocol", object()) - ) - - def get_protocol_members(__tp: type) -> typing.FrozenSet[str]: - """Return the set of members defined in a Protocol. - - Example:: - - >>> from typing_extensions import Protocol, get_protocol_members - >>> class P(Protocol): - ... def a(self) -> str: ... - ... b: int - >>> get_protocol_members(P) - frozenset({'a', 'b'}) - - Raise a TypeError for arguments that are not Protocols. - """ - if not is_protocol(__tp): - raise TypeError(f'{__tp!r} is not a Protocol') - if hasattr(__tp, '__protocol_attrs__'): - return frozenset(__tp.__protocol_attrs__) - return frozenset(_get_protocol_attrs(__tp)) - - -# Aliases for items that have always been in typing. -# Explicitly assign these (rather than using `from typing import *` at the top), -# so that we get a CI error if one of these is deleted from typing.py -# in a future version of Python -AbstractSet = typing.AbstractSet -AnyStr = typing.AnyStr -BinaryIO = typing.BinaryIO -Callable = typing.Callable -Collection = typing.Collection -Container = typing.Container -Dict = typing.Dict -ForwardRef = typing.ForwardRef -FrozenSet = typing.FrozenSet -Generator = typing.Generator -Generic = typing.Generic -Hashable = typing.Hashable -IO = typing.IO -ItemsView = typing.ItemsView -Iterable = typing.Iterable -Iterator = typing.Iterator -KeysView = typing.KeysView -List = typing.List -Mapping = typing.Mapping -MappingView = typing.MappingView -Match = typing.Match -MutableMapping = typing.MutableMapping -MutableSequence = typing.MutableSequence -MutableSet = typing.MutableSet -Optional = typing.Optional -Pattern = typing.Pattern -Reversible = typing.Reversible -Sequence = typing.Sequence -Set = typing.Set -Sized = typing.Sized -TextIO = typing.TextIO -Tuple = typing.Tuple -Union = typing.Union -ValuesView = typing.ValuesView -cast = typing.cast -no_type_check = typing.no_type_check -no_type_check_decorator = typing.no_type_check_decorator diff --git a/opensafely/_vendor/typing_extensions.pyi b/opensafely/_vendor/typing_extensions.pyi deleted file mode 100644 index 547f7a1b..00000000 --- a/opensafely/_vendor/typing_extensions.pyi +++ /dev/null @@ -1 +0,0 @@ -from typing_extensions import * \ No newline at end of file diff --git a/opensafely/_vendor/urllib3/contrib/appengine.py b/opensafely/_vendor/urllib3/contrib/appengine.py index 8c2abc70..7afcc73b 100644 --- a/opensafely/_vendor/urllib3/contrib/appengine.py +++ b/opensafely/_vendor/urllib3/contrib/appengine.py @@ -60,7 +60,7 @@ from . import _appengine_environ try: - from opensafely._vendor.google.appengine.api import urlfetch + from google.appengine.api import urlfetch except ImportError: urlfetch = None diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD b/opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD index fb60ace0..dd9d8d9c 100644 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD +++ b/opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD @@ -6,7 +6,6 @@ wrapt-1.14.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS wrapt-1.14.1.dist-info/WHEEL,sha256=xEtKyBmnO4eihUCAFoP53pvKisYAC7Qcs_GX_OtLyLQ,103 wrapt-1.14.1.dist-info/top_level.txt,sha256=Jf7kcuXtwjUJMwOL0QzALDg2WiSiXiH9ThKMjN64DW0,6 wrapt/__init__.py,sha256=Bh0h33Iapc_qaoLWsWfaXK5xJz9KJExF7gQKIWYdSsg,1200 -wrapt/_wrappers.cpython-38-x86_64-linux-gnu.so,sha256=Ssp3TCSFXy913ybqhWaWglIgf_sdWWhPU2hQG7PlufM,153880 wrapt/arguments.py,sha256=RF0nTEdPzPIewJ-jnSY42i4JSzK3ctjPABV1SJxLymg,1746 wrapt/decorators.py,sha256=gNy1PVq9NNVDAB9tujaAVhb0xtVKSSzqT-hdGFeWM34,21332 wrapt/importer.py,sha256=yxFgVg6-lRTbSVJ2oZbw1TPCtB98fIF4A_qi_Dh2JRc,9981 From e84beaaf2c533c7d456ac08b2f57bf829863907c Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 13:22:48 +0100 Subject: [PATCH 02/12] Formally remove the otel deps from prod dependencies All except opentelemetry-api, which is still vendored. The actual code has already been deleted - this commit has the changes that effected that removal, for easier understanding. The setuptools package cannot be vendored, which is why it is our only formal dependency. We needed to tweak the new requirements-prod just method to not try to add it, by passing `--no-allow-unsafe`. We cannot get rid of a runtime setup tools dependency just yet, but we maybe can in future by upgrading otel libraries. This meant we can also remove the pkg_resources hack we needed for otel deps to work when vendored. --- justfile | 6 +++--- opensafely/__init__.py | 8 -------- pyproject.toml | 2 -- requirements.prod.in | 2 +- requirements.prod.txt | 32 +++----------------------------- tests/conftest.py | 9 --------- 6 files changed, 7 insertions(+), 52 deletions(-) diff --git a/justfile b/justfile index aafecc0d..0198b589 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ export VIRTUAL_ENV := `echo ${VIRTUAL_ENV:-.venv}` export BIN := VIRTUAL_ENV + if os_family() == "unix" { "/bin" } else { "/Scripts" } export PIP := BIN + if os_family() == "unix" { "/python -m pip" } else { "/python.exe -m pip" } # enforce our chosen pip compile flags -export COMPILE := BIN + "/pip-compile --allow-unsafe" +export COMPILE := BIN + "/pip-compile" # list available commands @@ -46,12 +46,12 @@ _compile src dst *args: virtualenv # update *vendored* production dependencies. See DEVELOPERS.md. requirements-prod *args: - just _compile requirements.prod.in requirements.prod.txt {{ args }} + just _compile requirements.prod.in requirements.prod.txt --no-allow-unsafe {{ args }} # update requirements.dev.txt if requirements.dev.in has changed requirements-dev *args: virtualenv - just _compile requirements.dev.in requirements.dev.txt {{ args }} + just _compile requirements.dev.in requirements.dev.txt --allow-unsafe {{ args }} # ensure prod requirements installed and up to date diff --git a/opensafely/__init__.py b/opensafely/__init__.py index 7dcbd6b1..b2a5bc03 100644 --- a/opensafely/__init__.py +++ b/opensafely/__init__.py @@ -6,14 +6,6 @@ from datetime import datetime, timedelta from pathlib import Path -# ensure pkg_resources can find the package metadata we have included, as the -# opentelemetry packages need it -import pkg_resources - - -opensafely_module_dir = Path(__file__).parent -pkg_resources.working_set.add_entry(f"{opensafely_module_dir}/_vendor") - from opensafely import ( # noqa: E402 check, clean, diff --git a/pyproject.toml b/pyproject.toml index d1866c9e..f277737e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,6 @@ substitute = [ { match='wrapt._wrappers', replace='opensafely._vendor.wrapt._wrappers'}, { match='pydantic.color', replace='opensafely._vendor.pydantic.color'}, { match='pydantic.types', replace='opensafely._vendor.pydantic.types'}, - { match='opentelemetry.sdk.metrics', replace='opensafely._vendor.opentelemetry.sdk.metrics'}, - { match='opentelemetry.sdk.resources', replace='opensafely._vendor.opentelemetry.sdk.resources'}, { match='urllib3.contrib.securetransport', replace='opensafely._vendor.urllib3.contrib.securetransport'}, { match='urllib3.contrib.pyopenssl', replace='opensafely._vendor.urllib3.contrib.pyopenssl'}, ] diff --git a/requirements.prod.in b/requirements.prod.in index 4ebcc7e9..a49ae3d6 100644 --- a/requirements.prod.in +++ b/requirements.prod.in @@ -1,4 +1,4 @@ opensafely-pipeline@https://github.com/opensafely-core/pipeline/archive/refs/tags/v2025.03.06.161237.zip ruyaml requests -opentelemetry-exporter-otlp-proto-http +opentelemetry-api diff --git a/requirements.prod.txt b/requirements.prod.txt index 2408cad2..ccd5d1a5 100644 --- a/requirements.prod.txt +++ b/requirements.prod.txt @@ -2,10 +2,8 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --allow-unsafe --output-file=requirements.prod.txt requirements.prod.in +# pip-compile --output-file=requirements.prod.txt requirements.prod.in # -backoff==2.1.2 - # via opentelemetry-exporter-otlp-proto-http certifi==2020.11.8 # via requests chardet==3.0.4 @@ -14,46 +12,22 @@ deprecated==1.2.13 # via opentelemetry-api distro==1.8.0 # via ruyaml -googleapis-common-protos==1.56.4 - # via opentelemetry-exporter-otlp-proto-http idna==2.10 # via requests opensafely-pipeline @ https://github.com/opensafely-core/pipeline/archive/refs/tags/v2025.03.06.161237.zip # via -r requirements.prod.in opentelemetry-api==1.12.0 - # via - # opentelemetry-exporter-otlp-proto-http - # opentelemetry-sdk -opentelemetry-exporter-otlp-proto-http==1.12.0 # via -r requirements.prod.in -opentelemetry-proto==1.12.0 - # via opentelemetry-exporter-otlp-proto-http -opentelemetry-sdk==1.12.0 - # via opentelemetry-exporter-otlp-proto-http -opentelemetry-semantic-conventions==0.33b0 - # via opentelemetry-sdk -protobuf==3.20.2 - # via - # googleapis-common-protos - # opentelemetry-proto requests==2.25.0 - # via - # -r requirements.prod.in - # opentelemetry-exporter-otlp-proto-http + # via -r requirements.prod.in ruyaml==0.91.0 # via # -r requirements.prod.in # opensafely-pipeline -typing-extensions==4.7.1 - # via opentelemetry-sdk urllib3==1.26.5 # via requests wrapt==1.14.1 # via deprecated # The following packages are considered to be unsafe in a requirements file: -setuptools==75.3.2 - # via - # opentelemetry-api - # opentelemetry-sdk - # ruyaml +# setuptools diff --git a/tests/conftest.py b/tests/conftest.py index 7add38a9..9ff0efb3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,15 +2,6 @@ import shlex import subprocess import sys -from pathlib import Path - -# ensure pkg_resources can find the package metadata we have included, as the -# opentelemetry packages need it -import pkg_resources - - -opensafely_module_dir = Path(__file__).parent -pkg_resources.working_set.add_entry(f"{opensafely_module_dir}/_vendor") import pytest # noqa: E402 from opensafely._vendor import requests # noqa: E402 From 752de2270f20b745a59cce7324fc3c50aac83d0c Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 13:28:40 +0100 Subject: [PATCH 03/12] nit: remove old manual test script and clean up imports --- opensafely/jobrunner/tracing.py | 46 ++------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/opensafely/jobrunner/tracing.py b/opensafely/jobrunner/tracing.py index 151ffa3d..5b4a858b 100644 --- a/opensafely/jobrunner/tracing.py +++ b/opensafely/jobrunner/tracing.py @@ -17,9 +17,8 @@ TraceContextTextMapPropagator, ) -from opensafely.jobrunner import config +from opensafely.jobrunner import config, models from opensafely.jobrunner.lib import database, warn_assertions -from opensafely.jobrunner.models import Job, SavedJobRequest, State, StatusCode logger = logging.getLogger(__name__) @@ -289,7 +288,7 @@ def trace_attributes(job, results=None): if job._job_request is None: try: job._job_request = database.find_one( - SavedJobRequest, id=job.job_request_id + models.SavedJobRequest, id=job.job_request_id ).original except ValueError: job._job_request = {} @@ -337,44 +336,3 @@ def trace_attributes(job, results=None): attrs["base_created"] = results.base_created return attrs - - -if __name__ == "__main__": - # local testing utility for tracing - import time - - from opensafely.jobrunner.run import set_code - - setup_default_tracing() - - timestamp = int(time.time()) - job = Job( - id="job_id", - state=State.PENDING, - status_code=StatusCode.CREATED, - status_code_updated_at=int(timestamp * 1e9), - job_request_id="request_id", - workspace="workspace", - action="action name", - run_command="cohortextractor:latest cmd opt", - commit="commit", - created_at=timestamp, - ) - initialise_trace(job) - - states = [ - StatusCode.WAITING_ON_DEPENDENCIES, - StatusCode.PREPARING, - StatusCode.PREPARED, - StatusCode.EXECUTING, - StatusCode.EXECUTED, - StatusCode.FINALIZING, - StatusCode.FINALIZED, - ] - - for state in states: - time.sleep(1.1) - set_code(job, state, "test") - - time.sleep(1.1) - set_code(job, StatusCode.SUCCEEDED, "success") From 9f8ae9063af09994d86331065aff7c16a2bf1b53 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 14:03:34 +0100 Subject: [PATCH 04/12] Add optional otel deps to dev dependencies This ensures we can have telemetry during our tests --- requirements.dev.in | 1 + requirements.dev.txt | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/requirements.dev.in b/requirements.dev.in index 497e5884..9dc32ef9 100644 --- a/requirements.dev.in +++ b/requirements.dev.in @@ -10,6 +10,7 @@ wheel pre-commit coverage ruff +opentelemetry-exporter-otlp-proto-http # diff --git a/requirements.dev.txt b/requirements.dev.txt index bb05881d..1020c4e8 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -8,6 +8,8 @@ attrs==23.1.0 # via # jsonschema # referencing +backoff==2.2.1 + # via opentelemetry-exporter-otlp-proto-http black==24.3.0 # via -r requirements.dev.in build==1.0.3 @@ -27,6 +29,8 @@ coverage[toml]==7.3.2 # via # -r requirements.dev.in # pytest-cov +deprecated==1.2.18 + # via opentelemetry-api distlib==0.3.7 # via virtualenv exceptiongroup==1.1.3 @@ -35,13 +39,15 @@ filelock==3.13.1 # via virtualenv freezegun==1.5.5 # via pytest-freezer +googleapis-common-protos==1.70.0 + # via opentelemetry-exporter-otlp-proto-http identify==2.5.31 # via pre-commit idna==3.7 # via requests -importlib-metadata==6.8.0 +importlib-metadata==8.5.0 # via build -importlib-resources==6.1.1 +importlib-resources==6.4.5 # via # jsonschema # jsonschema-specifications @@ -59,6 +65,18 @@ mypy-extensions==1.0.0 # via black nodeenv==1.8.0 # via pre-commit +opentelemetry-api==1.12.0 + # via + # opentelemetry-exporter-otlp-proto-http + # opentelemetry-sdk +opentelemetry-exporter-otlp-proto-http==1.12.0 + # via -r requirements.dev.in +opentelemetry-proto==1.12.0 + # via opentelemetry-exporter-otlp-proto-http +opentelemetry-sdk==1.12.0 + # via opentelemetry-exporter-otlp-proto-http +opentelemetry-semantic-conventions==0.33b0 + # via opentelemetry-sdk packaging==23.2 # via # black @@ -79,6 +97,10 @@ pluggy==1.3.0 # via pytest pre-commit==3.5.0 # via -r requirements.dev.in +protobuf==3.20.3 + # via + # googleapis-common-protos + # opentelemetry-proto pygments==2.16.1 # via rich pyproject-hooks==1.0.0 @@ -102,6 +124,7 @@ referencing==0.31.0 # jsonschema-specifications requests==2.32.0 # via + # opentelemetry-exporter-otlp-proto-http # requests-mock # vendoring requests-mock==1.11.0 @@ -130,6 +153,7 @@ tomli==2.0.1 typing-extensions==4.8.0 # via # black + # opentelemetry-sdk # rich urllib3==2.2.2 # via requests @@ -141,7 +165,9 @@ wheel==0.41.3 # via # -r requirements.dev.in # pip-tools -zipp==3.19.1 +wrapt==1.17.3 + # via deprecated +zipp==3.20.2 # via # importlib-metadata # importlib-resources @@ -152,4 +178,6 @@ pip==23.3.1 setuptools==70.0.0 # via # nodeenv + # opentelemetry-api + # opentelemetry-sdk # pip-tools From 74164aa3ac733f85586f8c91eb0c8a52cef415ee Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 14:20:06 +0100 Subject: [PATCH 05/12] Fix jobrunner and tests to work with the new dependency reality This tries to import the optional dependencies, and ensures the code handles when they are not available. It adds an explict TRACING_AVAILABLE flag, and if it's False, does no-ops in our manual tracing functions. It turns out we cannot mix and match otel libraries imported from our vendored lib and globally in pip. This is an unfortunante implementation detail of the otel implementation, the module path affects some internal identity checks on objects. So, we have our tracing module provide an abstraction. It either imports the whole otel stack from the global namespace, if found (like in dev and when installed with opensafely[tracing], but falls back to importing the core `trace` module from `opensafely._vendor.opentelemetry` if they are not found. The rest of our code imports the `trace` module from jobrunner.tracing, so it is always consistent in which version it uses. This actually resulted in a much clearer api usage. --- opensafely/jobrunner/run.py | 3 +- opensafely/jobrunner/tracing.py | 48 ++++++++++++------- tests/jobrunner/conftest.py | 2 +- tests/jobrunner/test_create_or_update_jobs.py | 2 +- tests/jobrunner/test_run.py | 2 +- tests/jobrunner/test_tracing.py | 6 +-- 6 files changed, 39 insertions(+), 24 deletions(-) diff --git a/opensafely/jobrunner/run.py b/opensafely/jobrunner/run.py index 1d8b2710..5fe8162f 100644 --- a/opensafely/jobrunner/run.py +++ b/opensafely/jobrunner/run.py @@ -12,8 +12,6 @@ import time from typing import Optional -from opensafely._vendor.opentelemetry import trace - from opensafely.jobrunner import config, tracing from opensafely.jobrunner.executors import get_executor_api from opensafely.jobrunner.job_executor import ( @@ -29,6 +27,7 @@ from opensafely.jobrunner.lib.log_utils import configure_logging, set_log_context from opensafely.jobrunner.models import Job, State, StatusCode from opensafely.jobrunner.queries import calculate_workspace_state, get_flag_value +from opensafely.jobrunner.tracing import trace log = logging.getLogger(__name__) diff --git a/opensafely/jobrunner/tracing.py b/opensafely/jobrunner/tracing.py index 5b4a858b..c7cfaa3e 100644 --- a/opensafely/jobrunner/tracing.py +++ b/opensafely/jobrunner/tracing.py @@ -2,20 +2,28 @@ import os from datetime import datetime -from opensafely._vendor.opentelemetry import trace -from opensafely._vendor.opentelemetry.exporter.otlp.proto.http.trace_exporter import ( - OTLPSpanExporter, -) -from opensafely._vendor.opentelemetry.sdk.resources import Resource -from opensafely._vendor.opentelemetry.sdk.trace import TracerProvider -from opensafely._vendor.opentelemetry.sdk.trace.export import ( - BatchSpanProcessor, - ConsoleSpanExporter, -) -from opensafely._vendor.opentelemetry.trace import propagation -from opensafely._vendor.opentelemetry.trace.propagation.tracecontext import ( - TraceContextTextMapPropagator, -) + +# we attempt to import the full otel machinery, which is present in dev, and if +# you install the opensafely[tracing] extra +try: + from opentelemetry import trace + from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( + OTLPSpanExporter, + ) + from opentelemetry.sdk.resources import Resource + from opentelemetry.sdk.trace import TracerProvider, export + from opentelemetry.trace import propagation + from opentelemetry.trace.propagation.tracecontext import ( + TraceContextTextMapPropagator, + ) + + TRACING_AVAILABLE = True +except ImportError: + # if we cannot import it, we fallback to the vendored opentelemtry-api, + # which provides a no-op tracing api. + from opensafely._vendor.opentelemetry import trace + + TRACING_AVAILABLE = False from opensafely.jobrunner import config, models from opensafely.jobrunner.lib import database, warn_assertions @@ -25,6 +33,8 @@ def get_provider(): + assert TRACING_AVAILABLE, "tracing packages not installed" + # https://github.com/open-telemetry/semantic-conventions/tree/main/docs/resource#service resource = Resource.create( attributes={ @@ -36,7 +46,7 @@ def get_provider(): return TracerProvider(resource=resource) -def add_exporter(provider, exporter, processor=BatchSpanProcessor): +def add_exporter(provider, exporter, processor=None): """Utility method to add an exporter. We use the BatchSpanProcessor by default, which is the default for @@ -45,6 +55,9 @@ def add_exporter(provider, exporter, processor=BatchSpanProcessor): In testing, we insteads use SimpleSpanProcessor, which is synchronous and easy to inspect the output of within a test. """ + assert TRACING_AVAILABLE, "tracing packages not installed" + if processor is None: + processor = export.BatchSpanProcessor # Note: BatchSpanProcessor is configured via env vars: # https://opentelemetry-python.readthedocs.io/en/latest/sdk/trace.export.html#opentelemetry.sdk.trace.export.BatchSpanProcessor provider.add_span_processor(processor(exporter)) @@ -53,6 +66,9 @@ def add_exporter(provider, exporter, processor=BatchSpanProcessor): def setup_default_tracing(set_global=True): """Inspect environment variables and set up exporters accordingly.""" + if not TRACING_AVAILABLE: + return + provider = get_provider() if "OTEL_EXPORTER_OTLP_HEADERS" in os.environ: @@ -68,7 +84,7 @@ def setup_default_tracing(set_global=True): add_exporter(provider, OTLPSpanExporter()) if "OTEL_EXPORTER_CONSOLE" in os.environ: - add_exporter(provider, ConsoleSpanExporter()) + add_exporter(provider, export.ConsoleSpanExporter()) if set_global: trace.set_tracer_provider(provider) diff --git a/tests/jobrunner/conftest.py b/tests/jobrunner/conftest.py index 3d21a2f0..f72db2fe 100644 --- a/tests/jobrunner/conftest.py +++ b/tests/jobrunner/conftest.py @@ -8,7 +8,7 @@ from unittest import mock import pytest -from opensafely._vendor.opentelemetry.sdk.trace.export import SimpleSpanProcessor +from opentelemetry.sdk.trace.export import SimpleSpanProcessor import opensafely.jobrunner from opensafely.jobrunner import config, tracing diff --git a/tests/jobrunner/test_create_or_update_jobs.py b/tests/jobrunner/test_create_or_update_jobs.py index 52b6d9eb..55d72014 100644 --- a/tests/jobrunner/test_create_or_update_jobs.py +++ b/tests/jobrunner/test_create_or_update_jobs.py @@ -4,7 +4,6 @@ from unittest import mock import pytest -from opensafely._vendor.opentelemetry import trace from opensafely.jobrunner.create_or_update_jobs import ( JobRequestError, @@ -17,6 +16,7 @@ ) from opensafely.jobrunner.lib.database import find_one, update_where from opensafely.jobrunner.models import Job, JobRequest, State, StatusCode +from opensafely.jobrunner.tracing import trace from tests.jobrunner.factories import get_trace, job_request_factory_raw diff --git a/tests/jobrunner/test_run.py b/tests/jobrunner/test_run.py index 7807d72f..c89d4102 100644 --- a/tests/jobrunner/test_run.py +++ b/tests/jobrunner/test_run.py @@ -1,11 +1,11 @@ import time import pytest -from opensafely._vendor.opentelemetry import trace from opensafely.jobrunner import config, run from opensafely.jobrunner.job_executor import ExecutorState, JobStatus, Privacy from opensafely.jobrunner.models import State, StatusCode +from opensafely.jobrunner.tracing import trace from tests.jobrunner.factories import StubExecutorAPI, get_trace, job_factory from tests.jobrunner.fakes import RecordingExecutor diff --git a/tests/jobrunner/test_tracing.py b/tests/jobrunner/test_tracing.py index e210579c..ce678b00 100644 --- a/tests/jobrunner/test_tracing.py +++ b/tests/jobrunner/test_tracing.py @@ -1,11 +1,11 @@ import os import time -from opensafely._vendor.opentelemetry import trace -from opensafely._vendor.opentelemetry.exporter.otlp.proto.http import trace_exporter -from opensafely._vendor.opentelemetry.sdk.trace.export import ConsoleSpanExporter +from opentelemetry.exporter.otlp.proto.http import trace_exporter +from opentelemetry.sdk.trace.export import ConsoleSpanExporter from opensafely.jobrunner import config, models, tracing +from opensafely.jobrunner.tracing import trace from tests.jobrunner.factories import ( get_trace, job_factory, From 8d249f00c8deba482649030a8ee75c02bcb45a03 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 14:22:04 +0100 Subject: [PATCH 06/12] nit: rename tracing service.name to opensafely-run --- opensafely/jobrunner/tracing.py | 3 +-- tests/jobrunner/test_tracing.py | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/opensafely/jobrunner/tracing.py b/opensafely/jobrunner/tracing.py index c7cfaa3e..98890b4c 100644 --- a/opensafely/jobrunner/tracing.py +++ b/opensafely/jobrunner/tracing.py @@ -38,8 +38,7 @@ def get_provider(): # https://github.com/open-telemetry/semantic-conventions/tree/main/docs/resource#service resource = Resource.create( attributes={ - "service.name": os.environ.get("OTEL_SERVICE_NAME", "jobrunner"), - "service.namespace": os.environ.get("BACKEND", "unknown"), + "service.name": os.environ.get("OTEL_SERVICE_NAME", "opensafely-run"), "service.version": config.VERSION, } ) diff --git a/tests/jobrunner/test_tracing.py b/tests/jobrunner/test_tracing.py index ce678b00..83fd2e09 100644 --- a/tests/jobrunner/test_tracing.py +++ b/tests/jobrunner/test_tracing.py @@ -35,7 +35,7 @@ def test_setup_default_tracing_otlp_defaults(monkeypatch): monkeypatch.setattr(os, "environ", env) monkeypatch.setattr(trace_exporter, "environ", env) provider = tracing.setup_default_tracing(set_global=False) - assert provider.resource.attributes["service.name"] == "jobrunner" + assert provider.resource.attributes["service.name"] == "opensafely-run" exporter = provider._active_span_processor._span_processors[0].span_exporter assert isinstance(exporter, trace_exporter.OTLPSpanExporter) @@ -167,10 +167,7 @@ def test_tracing_resource_config(): pass span = get_trace("test")[0] - assert span.resource.attributes["service.name"] == "jobrunner" - assert span.resource.attributes["service.namespace"] == os.environ.get( - "BACKEND", "unknown" - ) + assert span.resource.attributes["service.name"] == "opensafely-run" assert span.resource.attributes["service.version"] == config.VERSION From 4cf278b4efb292b09ad404f6e1eaabd7d26668b1 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 14:23:10 +0100 Subject: [PATCH 07/12] Handle logging when tracing is disabled, as NonRecordingSpan has no .name attr --- opensafely/jobrunner/tracing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensafely/jobrunner/tracing.py b/opensafely/jobrunner/tracing.py index 98890b4c..d00020ef 100644 --- a/opensafely/jobrunner/tracing.py +++ b/opensafely/jobrunner/tracing.py @@ -280,7 +280,7 @@ def set_span_metadata(span, job, error=None, results=None, **attrs): if not isinstance(v, OTEL_ATTR_TYPES): # log to help us notice this logger.info( - f"Trace span {span.name} attribute {k} was set invalid type: {v}, type {type(v)}" + f"Trace span {getattr(span, 'name', 'unknown')} attribute {k} was set invalid type: {v}, type {type(v)}" ) # coerce to string so we preserve some information v = str(v) From 9d6695b54858c9367a73adc26c3b1ca6cb70f9fa Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 16:15:51 +0100 Subject: [PATCH 08/12] Add otel dependencies as a package extra and test This modifies the package metadata with an extra called "tracing", which installs the right packages. It adds a functional test that installs into a virtualenv using this extra, and that if you run a job with tracing configured, tracing does work. Also, I expanded the existing installation test, that now effectively installs without the dependencies, with a similar functional test to ensure that jobs still run in a normal installation. This caught a bug, which is fixed by adding another no-op when TRACING_AVAILABLE is False. --- opensafely/jobrunner/tracing.py | 13 +++--- setup.py | 7 ++++ tests/test_packaging.py | 71 ++++++++++++++++++++++++++++++--- 3 files changed, 81 insertions(+), 10 deletions(-) diff --git a/opensafely/jobrunner/tracing.py b/opensafely/jobrunner/tracing.py index d00020ef..504d214d 100644 --- a/opensafely/jobrunner/tracing.py +++ b/opensafely/jobrunner/tracing.py @@ -101,6 +101,9 @@ def initialise_trace(job): We create a root span, which is a requirement in OTel. For this reason we send it out straight away, which means its duration is very short. """ + if not TRACING_AVAILABLE: + return + assert not job.trace_context, "this job already has a trace-context" assert job.status_code is not None, "job has no initial StatusCode" assert ( @@ -115,11 +118,11 @@ def initialise_trace(job): # the job has completed; see complete_job() for details. root = tracer.start_span("JOB", context={}) - # TraceContextTextMapPropagator only works with the current span, so set it as such. - with trace.use_span(root, end_on_exit=False): - # we serialise the entire trace context, as it may grow extra fields - # (e.g. baggage) over time - TraceContextTextMapPropagator().inject(job.trace_context) + span_context = propagation.set_span_in_context(root) + propagator = TraceContextTextMapPropagator() + # we serialise the entire trace context, as it may grow extra fields + # (e.g. baggage) over time + propagator.inject(job.trace_context, context=span_context) def _traceable(job): diff --git a/setup.py b/setup.py index 88af9764..7651e22d 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,13 @@ install_requires=[ "setuptools", ], + extras_require={ + "tracing": [ + "opentelemetry-api==1.12.0", + "opentelemetry-sdk==1.12.0", + "opentelemetry-exporter-otlp-proto-http==1.12.0", + ], + }, entry_points={"console_scripts": ["opensafely=opensafely:main"]}, classifiers=["License :: OSI Approved :: GNU General Public License v3 (GPLv3)"], project_urls={ diff --git a/tests/test_packaging.py b/tests/test_packaging.py index 34f9eac6..8a3d930e 100644 --- a/tests/test_packaging.py +++ b/tests/test_packaging.py @@ -7,6 +7,7 @@ import pytest import opensafely +from opensafely.jobrunner.cli.local_run import docker_preflight_check BIN_DIR = "bin" if os.name != "nt" else "Scripts" @@ -29,8 +30,15 @@ def older_version_file(): version_file_path.write_bytes(orig_contents) +@pytest.fixture +def project_dir(tmp_path): + project_dir = tmp_path / "project" + shutil.copytree(project_fixture_path, project_dir) + return project_dir + + @pytest.mark.parametrize("package_type", ["sdist", "bdist_wheel"]) -def test_packaging(package_type, tmp_path, older_version_file): +def test_packaging(package_type, tmp_path, older_version_file, project_dir): package_path = build_package(package_type) # Install it in a temporary virtualenv subprocess_run([sys.executable, "-m", "venv", tmp_path], check=True) @@ -51,7 +59,7 @@ def test_packaging(package_type, tmp_path, older_version_file): subprocess_run( [tmp_path / BIN_DIR / "opensafely", "run", "python"], check=True, - cwd=str(project_fixture_path), + cwd=project_dir, ) # This always triggers an upgrade because the development version is always @@ -66,7 +74,7 @@ def test_packaging(package_type, tmp_path, older_version_file): assert "Successfully installed opensafely" in result.stdout -def test_installing_with_uv(tmp_path, older_version_file): +def test_installing_with_uv(tmp_path, older_version_file, project_dir): uv_bin = shutil.which("uv") if uv_bin is None: pytest.skip("Skipping as `uv` not installed") @@ -85,8 +93,19 @@ def test_installing_with_uv(tmp_path, older_version_file): check=True, ) # Basic smoketest - subprocess_run([bin_path / "opensafely", "run", "--help"], check=True) - subprocess_run([bin_path / "opensafely", "--version"], check=True) + subprocess_run([bin_path / "opensafely", "--debug", "--version"], check=True) + + if docker_preflight_check(): + # run an actual job to test the install + subprocess_run( + [bin_path / "opensafely", "--debug", "run", "python"], + check=True, + cwd=project_dir, + ) + else: # no docker, e.g. windows/mac CI + # Basic smoketest that doesn't need docker + subprocess_run([bin_path / "opensafely", "run", "--help"], check=True) + # The `upgrade` command should prompt the user to use `uv upgrade` instead result = subprocess_run( [bin_path / "opensafely", "upgrade"], capture_output=True, text=True @@ -95,6 +114,47 @@ def test_installing_with_uv(tmp_path, older_version_file): assert "uv tool upgrade opensafely" in result.stdout +def test_installing_otel_with_uv(tmp_path, older_version_file, project_dir): + uv_bin = shutil.which("uv") + if uv_bin is None: + pytest.skip("Skipping as `uv` not installed") + + package_path = build_package("bdist_wheel") + install_target = str(package_path) + "[tracing]" + bin_path = tmp_path / "bin" + uv_env = dict( + os.environ, + UV_TOOL_BIN_DIR=bin_path, + UV_TOOL_DIR=tmp_path / "tools", + ) + python_version = f"python{sys.version_info[0]}.{sys.version_info[1]}" + subprocess_run( + [uv_bin, "tool", "install", "--python", python_version, install_target], + env=uv_env, + check=True, + ) + # check we are installed + subprocess_run([bin_path / "opensafely", "--version"], check=True) + + if docker_preflight_check(): + # run an actual job to test the install + env = os.environ.copy() + env["OTEL_EXPORTER_CONSOLE"] = "true" + ps = subprocess_run( + [bin_path / "opensafely", "run", "python"], + check=True, + text=True, + capture_output=True, + cwd=project_dir, + env=env, + ) + # we should be seeing otel traces + assert '"trace_id":' in ps.stdout + else: # no docker, e.g. windows/mac CI + # Basic smoketest that doesn't need docker + subprocess_run([bin_path / "opensafely", "run", "--help"], check=True) + + def build_package(package_type): extension = {"sdist": "tar.gz", "bdist_wheel": "whl"}[package_type] project_root = Path(__file__).parent.parent @@ -127,6 +187,7 @@ def subprocess_run(cmd_args, **kwargs): kwargs["cwd"] = to_str(kwargs["cwd"]) if "env" in kwargs: kwargs["env"] = {key: to_str(value) for (key, value) in kwargs["env"].items()} + print(f"Executing: {' '.join(cmd_args)}") return subprocess.run(cmd_args, **kwargs) From 5cccb578b8010ba4962655ec4011be825429deb2 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 16:22:07 +0100 Subject: [PATCH 09/12] Add developer documentation on how to enable tracing. --- DEVELOPERS.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 2db37929..afdb3b33 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -31,6 +31,21 @@ The `opensafely.jobrunner` package (and associated tests at tests/jobrunner) are currently maintained by the RAP team, rather than REX. Some things, like dependencies, affect the whole system, so may need some cross team reviews. +### Tracing + +The opensafely run code is instrumented with opentelemetry, using the vendored +opentelemety-api package. By default, this does nothing, but its fairly easy to +enable it if needed for development or debugging. + +1. Install the extra dependencies: + - if in a devenv, they should already be installed + - if opensafely was installed via pip, then `install opensafely[tracing]` + - if opensafely was installed via uv, then `uv tool install opensafely[tracing]` +2. Create an ingest key from the Development Environment in Honeycomb: https://ui.honeycomb.io/bennett-institute-for-applied-data-science/environments/development/api_keys +3. set `export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=" +4. Use `opensafely run` as normal. +5. The traces should appear in the `opensafely-run` dataset in the Development environment in Honeycomb. + ## Tests From 565630dded700b3b95d5449df951683d316fc354 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 16:34:41 +0100 Subject: [PATCH 10/12] nit: bump coverage floor as it has crept up --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f277737e..c5193c65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ omit = [ ] [tool.coverage.report] -fail_under = 87 +fail_under = 90 skip_covered = true show_missing = true From 3848494b5def1533471af4ddcfa5482ad0df7dc6 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Tue, 23 Sep 2025 16:50:36 +0100 Subject: [PATCH 11/12] Fix CI by checking for linux explicitly It seems docker is install in windows CI images, but it doesn't work. Thanks, Github. --- tests/test_packaging.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_packaging.py b/tests/test_packaging.py index 8a3d930e..5a3ccbd5 100644 --- a/tests/test_packaging.py +++ b/tests/test_packaging.py @@ -7,7 +7,6 @@ import pytest import opensafely -from opensafely.jobrunner.cli.local_run import docker_preflight_check BIN_DIR = "bin" if os.name != "nt" else "Scripts" @@ -95,14 +94,14 @@ def test_installing_with_uv(tmp_path, older_version_file, project_dir): # Basic smoketest subprocess_run([bin_path / "opensafely", "--debug", "--version"], check=True) - if docker_preflight_check(): + if sys.platform == "linux": # run an actual job to test the install subprocess_run( [bin_path / "opensafely", "--debug", "run", "python"], check=True, cwd=project_dir, ) - else: # no docker, e.g. windows/mac CI + else: # e.g. windows/mac CI # Basic smoketest that doesn't need docker subprocess_run([bin_path / "opensafely", "run", "--help"], check=True) @@ -136,7 +135,7 @@ def test_installing_otel_with_uv(tmp_path, older_version_file, project_dir): # check we are installed subprocess_run([bin_path / "opensafely", "--version"], check=True) - if docker_preflight_check(): + if sys.platform == "linux": # run an actual job to test the install env = os.environ.copy() env["OTEL_EXPORTER_CONSOLE"] = "true" @@ -150,7 +149,7 @@ def test_installing_otel_with_uv(tmp_path, older_version_file, project_dir): ) # we should be seeing otel traces assert '"trace_id":' in ps.stdout - else: # no docker, e.g. windows/mac CI + else: # e.g. windows/mac CI # Basic smoketest that doesn't need docker subprocess_run([bin_path / "opensafely", "run", "--help"], check=True) From 0a44424b8f776574d90bd005c75a3f978aabc616 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Wed, 24 Sep 2025 08:15:48 +0100 Subject: [PATCH 12/12] Revert to upstream vendoring package Previously, to support vendoring otel packages, we had to fork vendoring and add support for including package metadata, so that the otel plugin system would find the right packages. With those dependencies being unvendored, we do not need that any more, so can revert to upstream. This removes all the package metadata files from our _vendor dir. --- .../_vendor/Deprecated-1.2.13.dist-info.pyi | 1 - .../Deprecated-1.2.13.dist-info/INSTALLER | 1 - .../Deprecated-1.2.13.dist-info/LICENSE.rst | 21 - .../Deprecated-1.2.13.dist-info/METADATA | 187 --- .../Deprecated-1.2.13.dist-info/RECORD | 10 - .../Deprecated-1.2.13.dist-info/REQUESTED | 0 .../_vendor/Deprecated-1.2.13.dist-info/WHEEL | 6 - .../Deprecated-1.2.13.dist-info/top_level.txt | 1 - .../_vendor/certifi-2020.11.8.dist-info.pyi | 1 - .../certifi-2020.11.8.dist-info/INSTALLER | 1 - .../certifi-2020.11.8.dist-info/LICENSE | 21 - .../certifi-2020.11.8.dist-info/METADATA | 83 - .../certifi-2020.11.8.dist-info/RECORD | 11 - .../certifi-2020.11.8.dist-info/REQUESTED | 0 .../_vendor/certifi-2020.11.8.dist-info/WHEEL | 6 - .../certifi-2020.11.8.dist-info/top_level.txt | 1 - .../_vendor/chardet-3.0.4.dist-info.pyi | 1 - .../chardet-3.0.4.dist-info/DESCRIPTION.rst | 70 - .../_vendor/chardet-3.0.4.dist-info/INSTALLER | 1 - .../_vendor/chardet-3.0.4.dist-info/METADATA | 96 -- .../_vendor/chardet-3.0.4.dist-info/RECORD | 51 - .../_vendor/chardet-3.0.4.dist-info/REQUESTED | 0 .../_vendor/chardet-3.0.4.dist-info/WHEEL | 6 - .../chardet-3.0.4.dist-info/entry_points.txt | 3 - .../chardet-3.0.4.dist-info/metadata.json | 1 - .../chardet-3.0.4.dist-info/top_level.txt | 1 - opensafely/_vendor/distro-1.8.0.dist-info.pyi | 1 - .../_vendor/distro-1.8.0.dist-info/INSTALLER | 1 - .../_vendor/distro-1.8.0.dist-info/LICENSE | 202 --- .../_vendor/distro-1.8.0.dist-info/METADATA | 183 --- .../_vendor/distro-1.8.0.dist-info/RECORD | 13 - .../_vendor/distro-1.8.0.dist-info/REQUESTED | 0 .../_vendor/distro-1.8.0.dist-info/WHEEL | 5 - .../distro-1.8.0.dist-info/entry_points.txt | 2 - .../distro-1.8.0.dist-info/top_level.txt | 1 - opensafely/_vendor/idna-2.10.dist-info.pyi | 1 - .../_vendor/idna-2.10.dist-info/INSTALLER | 1 - .../_vendor/idna-2.10.dist-info/LICENSE.rst | 34 - .../_vendor/idna-2.10.dist-info/METADATA | 243 --- opensafely/_vendor/idna-2.10.dist-info/RECORD | 15 - .../_vendor/idna-2.10.dist-info/REQUESTED | 0 opensafely/_vendor/idna-2.10.dist-info/WHEEL | 6 - .../_vendor/idna-2.10.dist-info/top_level.txt | 1 - ...ely_pipeline-2025.3.6.161237.dist-info.pyi | 1 - .../INSTALLER | 1 - .../LICENSE | 15 - .../METADATA | 49 - .../RECORD | 19 - .../REQUESTED | 0 .../WHEEL | 5 - .../direct_url.json | 1 - .../top_level.txt | 1 - .../opentelemetry_api-1.12.0.dist-info.pyi | 1 - .../INSTALLER | 1 - .../LICENSE | 201 --- .../METADATA | 47 - .../opentelemetry_api-1.12.0.dist-info/RECORD | 34 - .../REQUESTED | 0 .../opentelemetry_api-1.12.0.dist-info/WHEEL | 5 - .../entry_points.txt | 15 - .../top_level.txt | 1 - .../_vendor/requests-2.25.0.dist-info.pyi | 1 - .../requests-2.25.0.dist-info/INSTALLER | 1 - .../_vendor/requests-2.25.0.dist-info/LICENSE | 175 --- .../requests-2.25.0.dist-info/METADATA | 103 -- .../_vendor/requests-2.25.0.dist-info/RECORD | 25 - .../requests-2.25.0.dist-info/REQUESTED | 0 .../_vendor/requests-2.25.0.dist-info/WHEEL | 6 - .../requests-2.25.0.dist-info/top_level.txt | 1 - .../_vendor/ruyaml-0.91.0.dist-info.pyi | 1 - .../_vendor/ruyaml-0.91.0.dist-info/INSTALLER | 1 - .../_vendor/ruyaml-0.91.0.dist-info/LICENSE | 21 - .../_vendor/ruyaml-0.91.0.dist-info/METADATA | 296 ---- .../_vendor/ruyaml-0.91.0.dist-info/RECORD | 37 - .../_vendor/ruyaml-0.91.0.dist-info/REQUESTED | 0 .../_vendor/ruyaml-0.91.0.dist-info/WHEEL | 5 - .../ruyaml-0.91.0.dist-info/top_level.txt | 1 - .../_vendor/ruyaml-0.91.0.dist-info/zip-safe | 1 - .../_vendor/urllib3-1.26.5.dist-info.pyi | 1 - .../urllib3-1.26.5.dist-info/INSTALLER | 1 - .../urllib3-1.26.5.dist-info/LICENSE.txt | 21 - .../_vendor/urllib3-1.26.5.dist-info/METADATA | 1376 ----------------- .../_vendor/urllib3-1.26.5.dist-info/RECORD | 46 - .../urllib3-1.26.5.dist-info/REQUESTED | 0 .../_vendor/urllib3-1.26.5.dist-info/WHEEL | 6 - .../urllib3-1.26.5.dist-info/top_level.txt | 1 - opensafely/_vendor/wrapt-1.14.1.dist-info.pyi | 1 - .../_vendor/wrapt-1.14.1.dist-info/INSTALLER | 1 - .../_vendor/wrapt-1.14.1.dist-info/LICENSE | 24 - .../_vendor/wrapt-1.14.1.dist-info/METADATA | 172 --- .../_vendor/wrapt-1.14.1.dist-info/RECORD | 12 - .../_vendor/wrapt-1.14.1.dist-info/REQUESTED | 0 .../_vendor/wrapt-1.14.1.dist-info/WHEEL | 5 - .../wrapt-1.14.1.dist-info/top_level.txt | 1 - pyproject.toml | 3 - requirements.dev.in | 16 +- requirements.dev.txt | 5 +- 97 files changed, 7 insertions(+), 4047 deletions(-) delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info.pyi delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info/LICENSE.rst delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info/METADATA delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info/RECORD delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info/WHEEL delete mode 100644 opensafely/_vendor/Deprecated-1.2.13.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info.pyi delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info/LICENSE delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info/METADATA delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info/RECORD delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info/WHEEL delete mode 100644 opensafely/_vendor/certifi-2020.11.8.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info.pyi delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/DESCRIPTION.rst delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/METADATA delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/RECORD delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/WHEEL delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/entry_points.txt delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/metadata.json delete mode 100644 opensafely/_vendor/chardet-3.0.4.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info.pyi delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/METADATA delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/RECORD delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/entry_points.txt delete mode 100644 opensafely/_vendor/distro-1.8.0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/idna-2.10.dist-info.pyi delete mode 100644 opensafely/_vendor/idna-2.10.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/idna-2.10.dist-info/LICENSE.rst delete mode 100644 opensafely/_vendor/idna-2.10.dist-info/METADATA delete mode 100644 opensafely/_vendor/idna-2.10.dist-info/RECORD delete mode 100644 opensafely/_vendor/idna-2.10.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/idna-2.10.dist-info/WHEEL delete mode 100644 opensafely/_vendor/idna-2.10.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info.pyi delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/LICENSE delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/METADATA delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/RECORD delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/WHEEL delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/direct_url.json delete mode 100644 opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info.pyi delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/METADATA delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/RECORD delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/entry_points.txt delete mode 100644 opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info.pyi delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info/METADATA delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info/RECORD delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/requests-2.25.0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info.pyi delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/LICENSE delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/METADATA delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/RECORD delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/WHEEL delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/ruyaml-0.91.0.dist-info/zip-safe delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info.pyi delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info/LICENSE.txt delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info/METADATA delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info/RECORD delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info/WHEEL delete mode 100644 opensafely/_vendor/urllib3-1.26.5.dist-info/top_level.txt delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info.pyi delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info/INSTALLER delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info/LICENSE delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info/METADATA delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info/REQUESTED delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info/WHEEL delete mode 100644 opensafely/_vendor/wrapt-1.14.1.dist-info/top_level.txt diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info.pyi b/opensafely/_vendor/Deprecated-1.2.13.dist-info.pyi deleted file mode 100644 index 9876e6d8..00000000 --- a/opensafely/_vendor/Deprecated-1.2.13.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from Deprecated-1.2.13.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info/INSTALLER b/opensafely/_vendor/Deprecated-1.2.13.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/Deprecated-1.2.13.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info/LICENSE.rst b/opensafely/_vendor/Deprecated-1.2.13.dist-info/LICENSE.rst deleted file mode 100644 index 191ddaf3..00000000 --- a/opensafely/_vendor/Deprecated-1.2.13.dist-info/LICENSE.rst +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Laurent LAPORTE - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info/METADATA b/opensafely/_vendor/Deprecated-1.2.13.dist-info/METADATA deleted file mode 100644 index b588a554..00000000 --- a/opensafely/_vendor/Deprecated-1.2.13.dist-info/METADATA +++ /dev/null @@ -1,187 +0,0 @@ -Metadata-Version: 2.1 -Name: Deprecated -Version: 1.2.13 -Summary: Python @deprecated decorator to deprecate old python classes, functions or methods. -Home-page: https://github.com/tantale/deprecated -Author: Laurent LAPORTE -Author-email: tantale.solutions@gmail.com -License: MIT -Project-URL: Documentation, https://deprecated.readthedocs.io/en/latest/ -Project-URL: Source, https://github.com/tantale/deprecated -Project-URL: Bug Tracker, https://github.com/tantale/deprecated/issues -Keywords: deprecate,deprecated,deprecation,warning,warn,decorator -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Web Environment -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* -Description-Content-Type: text/x-rst -License-File: LICENSE.rst -Requires-Dist: wrapt (<2,>=1.10) -Provides-Extra: dev -Requires-Dist: tox ; extra == 'dev' -Requires-Dist: bump2version (<1) ; extra == 'dev' -Requires-Dist: sphinx (<2) ; extra == 'dev' -Requires-Dist: importlib-metadata (<3) ; (python_version < "3") and extra == 'dev' -Requires-Dist: importlib-resources (<4) ; (python_version < "3") and extra == 'dev' -Requires-Dist: configparser (<5) ; (python_version < "3") and extra == 'dev' -Requires-Dist: sphinxcontrib-websupport (<2) ; (python_version < "3") and extra == 'dev' -Requires-Dist: zipp (<2) ; (python_version < "3") and extra == 'dev' -Requires-Dist: PyTest (<5) ; (python_version < "3.6") and extra == 'dev' -Requires-Dist: PyTest-Cov (<2.6) ; (python_version < "3.6") and extra == 'dev' -Requires-Dist: PyTest ; (python_version >= "3.6") and extra == 'dev' -Requires-Dist: PyTest-Cov ; (python_version >= "3.6") and extra == 'dev' - - -Deprecated Library ------------------- - -Deprecated is Easy to Use -````````````````````````` - -If you need to mark a function or a method as deprecated, -you can use the ``@deprecated`` decorator: - -Save in a hello.py: - -.. code:: python - - from deprecated import deprecated - - - @deprecated(version='1.2.1', reason="You should use another function") - def some_old_function(x, y): - return x + y - - - class SomeClass(object): - @deprecated(version='1.3.0', reason="This method is deprecated") - def some_old_method(self, x, y): - return x + y - - - some_old_function(12, 34) - obj = SomeClass() - obj.some_old_method(5, 8) - - -And Easy to Setup -````````````````` - -And run it: - -.. code:: bash - - $ pip install Deprecated - $ python hello.py - hello.py:15: DeprecationWarning: Call to deprecated function (or staticmethod) some_old_function. - (You should use another function) -- Deprecated since version 1.2.0. - some_old_function(12, 34) - hello.py:17: DeprecationWarning: Call to deprecated method some_old_method. - (This method is deprecated) -- Deprecated since version 1.3.0. - obj.some_old_method(5, 8) - - -You can document your code -`````````````````````````` - -Have you ever wonder how to document that some functions, classes, methods, etc. are deprecated? -This is now possible with the integrated Sphinx directives: - -For instance, in hello_sphinx.py: - -.. code:: python - - from deprecated.sphinx import deprecated - from deprecated.sphinx import versionadded - from deprecated.sphinx import versionchanged - - - @versionadded(version='1.0', reason="This function is new") - def function_one(): - '''This is the function one''' - - - @versionchanged(version='1.0', reason="This function is modified") - def function_two(): - '''This is the function two''' - - - @deprecated(version='1.0', reason="This function will be removed soon") - def function_three(): - '''This is the function three''' - - - function_one() - function_two() - function_three() # warns - - help(function_one) - help(function_two) - help(function_three) - - -The result it immediate -``````````````````````` - -Run it: - -.. code:: bash - - $ python hello_sphinx.py - - hello_sphinx.py:23: DeprecationWarning: Call to deprecated function (or staticmethod) function_three. - (This function will be removed soon) -- Deprecated since version 1.0. - function_three() # warns - - Help on function function_one in module __main__: - - function_one() - This is the function one - - .. versionadded:: 1.0 - This function is new - - Help on function function_two in module __main__: - - function_two() - This is the function two - - .. versionchanged:: 1.0 - This function is modified - - Help on function function_three in module __main__: - - function_three() - This is the function three - - .. deprecated:: 1.0 - This function will be removed soon - - -Links -````` - -* `Python package index (PyPi) `_ -* `GitHub website `_ -* `Read The Docs `_ -* `EBook on Lulu.com `_ -* `StackOverFlow Q&A `_ -* `Development version - `_ - - - diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info/RECORD b/opensafely/_vendor/Deprecated-1.2.13.dist-info/RECORD deleted file mode 100644 index 33ed9139..00000000 --- a/opensafely/_vendor/Deprecated-1.2.13.dist-info/RECORD +++ /dev/null @@ -1,10 +0,0 @@ -Deprecated-1.2.13.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -Deprecated-1.2.13.dist-info/LICENSE.rst,sha256=HoPt0VvkGbXVveNy4yXlJ_9PmRX1SOfHUxS0H2aZ6Dw,1081 -Deprecated-1.2.13.dist-info/METADATA,sha256=3yaMBaEEx4K_RPhU7Bmb8P_UprR9-67MvES0XRGK7go,5817 -Deprecated-1.2.13.dist-info/RECORD,, -Deprecated-1.2.13.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -Deprecated-1.2.13.dist-info/WHEEL,sha256=8zNYZbwQSXoB9IfXOjPfeNwvAsALAjffgk27FqvCWbo,110 -Deprecated-1.2.13.dist-info/top_level.txt,sha256=nHbOYawKPQQE5lQl-toUB1JBRJjUyn_m_Mb8RVJ0RjA,11 -deprecated/__init__.py,sha256=YA_PiKdeI1jWCt2FxdMLc9wFZ_DDZFl0OlI6jf6mdeo,349 -deprecated/classic.py,sha256=QugmUi7IhBvp2nDvMtyWqFDPRR43-9nfSZG1ZJSDpFM,9880 -deprecated/sphinx.py,sha256=zrgb7gbK4iixgRbO_AXusI8_Gi4JwrQJZHs3RZArdfE,9988 diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info/REQUESTED b/opensafely/_vendor/Deprecated-1.2.13.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info/WHEEL b/opensafely/_vendor/Deprecated-1.2.13.dist-info/WHEEL deleted file mode 100644 index 8b701e93..00000000 --- a/opensafely/_vendor/Deprecated-1.2.13.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.33.6) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/Deprecated-1.2.13.dist-info/top_level.txt b/opensafely/_vendor/Deprecated-1.2.13.dist-info/top_level.txt deleted file mode 100644 index 9f8d5502..00000000 --- a/opensafely/_vendor/Deprecated-1.2.13.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -deprecated diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info.pyi b/opensafely/_vendor/certifi-2020.11.8.dist-info.pyi deleted file mode 100644 index c006f1f5..00000000 --- a/opensafely/_vendor/certifi-2020.11.8.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from certifi-2020.11.8.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info/INSTALLER b/opensafely/_vendor/certifi-2020.11.8.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/certifi-2020.11.8.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info/LICENSE b/opensafely/_vendor/certifi-2020.11.8.dist-info/LICENSE deleted file mode 100644 index 802b53ff..00000000 --- a/opensafely/_vendor/certifi-2020.11.8.dist-info/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -This packge contains a modified version of ca-bundle.crt: - -ca-bundle.crt -- Bundle of CA Root Certificates - -Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011# -This is a bundle of X.509 certificates of public Certificate Authorities -(CA). These were automatically extracted from Mozilla's root certificates -file (certdata.txt). This file can be found in the mozilla source tree: -http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1# -It contains the certificates in PEM format and therefore -can be directly used with curl / libcurl / php_curl, or with -an Apache+mod_ssl webserver for SSL client authentication. -Just configure this file as the SSLCACertificateFile.# - -***** BEGIN LICENSE BLOCK ***** -This Source Code Form is subject to the terms of the Mozilla Public License, -v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain -one at http://mozilla.org/MPL/2.0/. - -***** END LICENSE BLOCK ***** -@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info/METADATA b/opensafely/_vendor/certifi-2020.11.8.dist-info/METADATA deleted file mode 100644 index e25ee759..00000000 --- a/opensafely/_vendor/certifi-2020.11.8.dist-info/METADATA +++ /dev/null @@ -1,83 +0,0 @@ -Metadata-Version: 2.1 -Name: certifi -Version: 2020.11.8 -Summary: Python package for providing Mozilla's CA Bundle. -Home-page: https://certifiio.readthedocs.io/en/latest/ -Author: Kenneth Reitz -Author-email: me@kennethreitz.com -License: MPL-2.0 -Project-URL: Documentation, https://certifiio.readthedocs.io/en/latest/ -Project-URL: Source, https://github.com/certifi/python-certifi -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) -Classifier: Natural Language :: English -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 - -Certifi: Python SSL Certificates -================================ - -`Certifi`_ provides Mozilla's carefully curated collection of Root Certificates for -validating the trustworthiness of SSL certificates while verifying the identity -of TLS hosts. It has been extracted from the `Requests`_ project. - -Installation ------------- - -``certifi`` is available on PyPI. Simply install it with ``pip``:: - - $ pip install certifi - -Usage ------ - -To reference the installed certificate authority (CA) bundle, you can use the -built-in function:: - - >>> import certifi - - >>> certifi.where() - '/usr/local/lib/python3.7/site-packages/certifi/cacert.pem' - -Or from the command line:: - - $ python -m certifi - /usr/local/lib/python3.7/site-packages/certifi/cacert.pem - -Enjoy! - -1024-bit Root Certificates -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Browsers and certificate authorities have concluded that 1024-bit keys are -unacceptably weak for certificates, particularly root certificates. For this -reason, Mozilla has removed any weak (i.e. 1024-bit key) certificate from its -bundle, replacing it with an equivalent strong (i.e. 2048-bit or greater key) -certificate from the same CA. Because Mozilla removed these certificates from -its bundle, ``certifi`` removed them as well. - -In previous versions, ``certifi`` provided the ``certifi.old_where()`` function -to intentionally re-add the 1024-bit roots back into your bundle. This was not -recommended in production and therefore was removed at the end of 2018. - -.. _`Certifi`: https://certifiio.readthedocs.io/en/latest/ -.. _`Requests`: https://requests.readthedocs.io/en/master/ - -Addition/Removal of Certificates --------------------------------- - -Certifi does not support any addition/removal or other modification of the -CA trust store content. This project is intended to provide a reliable and -highly portable root of trust to python deployments. Look to upstream projects -for methods to use alternate trust. - - diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info/RECORD b/opensafely/_vendor/certifi-2020.11.8.dist-info/RECORD deleted file mode 100644 index 47dd2d95..00000000 --- a/opensafely/_vendor/certifi-2020.11.8.dist-info/RECORD +++ /dev/null @@ -1,11 +0,0 @@ -certifi-2020.11.8.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -certifi-2020.11.8.dist-info/LICENSE,sha256=anCkv2sBABbVmmS4rkrY3H9e8W8ftFPMLs13HFo0ETE,1048 -certifi-2020.11.8.dist-info/METADATA,sha256=LBPr6g1-mGhOtrMGg8DFzNp-V76vs5J38EKLzzJDbOM,2994 -certifi-2020.11.8.dist-info/RECORD,, -certifi-2020.11.8.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -certifi-2020.11.8.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110 -certifi-2020.11.8.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8 -certifi/__init__.py,sha256=TocBfHrqAkQK91W5jNYhRH8KKizxkkXZBk68DTHj0xo,62 -certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243 -certifi/cacert.pem,sha256=U7iFT4_n-7XCfHpc8I46ad5kHuGvDSedla2fdbQoQUo,281608 -certifi/core.py,sha256=V0uyxKOYdz6ulDSusclrLmjbPgOXsD0BnEf0SQ7OnoE,2303 diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info/REQUESTED b/opensafely/_vendor/certifi-2020.11.8.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info/WHEEL b/opensafely/_vendor/certifi-2020.11.8.dist-info/WHEEL deleted file mode 100644 index 6d38aa06..00000000 --- a/opensafely/_vendor/certifi-2020.11.8.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.35.1) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/certifi-2020.11.8.dist-info/top_level.txt b/opensafely/_vendor/certifi-2020.11.8.dist-info/top_level.txt deleted file mode 100644 index 963eac53..00000000 --- a/opensafely/_vendor/certifi-2020.11.8.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -certifi diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info.pyi b/opensafely/_vendor/chardet-3.0.4.dist-info.pyi deleted file mode 100644 index 7916a70e..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from chardet-3.0.4.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/DESCRIPTION.rst b/opensafely/_vendor/chardet-3.0.4.dist-info/DESCRIPTION.rst deleted file mode 100644 index c0f044d8..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/DESCRIPTION.rst +++ /dev/null @@ -1,70 +0,0 @@ -Chardet: The Universal Character Encoding Detector --------------------------------------------------- - -.. image:: https://img.shields.io/travis/chardet/chardet/stable.svg - :alt: Build status - :target: https://travis-ci.org/chardet/chardet - -.. image:: https://img.shields.io/coveralls/chardet/chardet/stable.svg - :target: https://coveralls.io/r/chardet/chardet - -.. image:: https://img.shields.io/pypi/v/chardet.svg - :target: https://warehouse.python.org/project/chardet/ - :alt: Latest version on PyPI - -.. image:: https://img.shields.io/pypi/l/chardet.svg - :alt: License - - -Detects - - ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants) - - Big5, GB2312, EUC-TW, HZ-GB-2312, ISO-2022-CN (Traditional and Simplified Chinese) - - EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP (Japanese) - - EUC-KR, ISO-2022-KR (Korean) - - KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic) - - ISO-8859-5, windows-1251 (Bulgarian) - - ISO-8859-1, windows-1252 (Western European languages) - - ISO-8859-7, windows-1253 (Greek) - - ISO-8859-8, windows-1255 (Visual and Logical Hebrew) - - TIS-620 (Thai) - -.. note:: - Our ISO-8859-2 and windows-1250 (Hungarian) probers have been temporarily - disabled until we can retrain the models. - -Requires Python 2.6, 2.7, or 3.3+. - -Installation ------------- - -Install from `PyPI `_:: - - pip install chardet - -Documentation -------------- - -For users, docs are now available at https://chardet.readthedocs.io/. - -Command-line Tool ------------------ - -chardet comes with a command-line script which reports on the encodings of one -or more files:: - - % chardetect somefile someotherfile - somefile: windows-1252 with confidence 0.5 - someotherfile: ascii with confidence 1.0 - -About ------ - -This is a continuation of Mark Pilgrim's excellent chardet. Previously, two -versions needed to be maintained: one that supported python 2.x and one that -supported python 3.x. We've recently merged with `Ian Cordasco `_'s -`charade `_ fork, so now we have one -coherent version that works for Python 2.6+. - -:maintainer: Dan Blanchard - - diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/INSTALLER b/opensafely/_vendor/chardet-3.0.4.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/METADATA b/opensafely/_vendor/chardet-3.0.4.dist-info/METADATA deleted file mode 100644 index 1427867a..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/METADATA +++ /dev/null @@ -1,96 +0,0 @@ -Metadata-Version: 2.0 -Name: chardet -Version: 3.0.4 -Summary: Universal encoding detector for Python 2 and 3 -Home-page: https://github.com/chardet/chardet -Author: Daniel Blanchard -Author-email: dan.blanchard@gmail.com -License: LGPL -Keywords: encoding,i18n,xml -Platform: UNKNOWN -Classifier: Development Status :: 4 - Beta -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Text Processing :: Linguistic - -Chardet: The Universal Character Encoding Detector --------------------------------------------------- - -.. image:: https://img.shields.io/travis/chardet/chardet/stable.svg - :alt: Build status - :target: https://travis-ci.org/chardet/chardet - -.. image:: https://img.shields.io/coveralls/chardet/chardet/stable.svg - :target: https://coveralls.io/r/chardet/chardet - -.. image:: https://img.shields.io/pypi/v/chardet.svg - :target: https://warehouse.python.org/project/chardet/ - :alt: Latest version on PyPI - -.. image:: https://img.shields.io/pypi/l/chardet.svg - :alt: License - - -Detects - - ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants) - - Big5, GB2312, EUC-TW, HZ-GB-2312, ISO-2022-CN (Traditional and Simplified Chinese) - - EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP (Japanese) - - EUC-KR, ISO-2022-KR (Korean) - - KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic) - - ISO-8859-5, windows-1251 (Bulgarian) - - ISO-8859-1, windows-1252 (Western European languages) - - ISO-8859-7, windows-1253 (Greek) - - ISO-8859-8, windows-1255 (Visual and Logical Hebrew) - - TIS-620 (Thai) - -.. note:: - Our ISO-8859-2 and windows-1250 (Hungarian) probers have been temporarily - disabled until we can retrain the models. - -Requires Python 2.6, 2.7, or 3.3+. - -Installation ------------- - -Install from `PyPI `_:: - - pip install chardet - -Documentation -------------- - -For users, docs are now available at https://chardet.readthedocs.io/. - -Command-line Tool ------------------ - -chardet comes with a command-line script which reports on the encodings of one -or more files:: - - % chardetect somefile someotherfile - somefile: windows-1252 with confidence 0.5 - someotherfile: ascii with confidence 1.0 - -About ------ - -This is a continuation of Mark Pilgrim's excellent chardet. Previously, two -versions needed to be maintained: one that supported python 2.x and one that -supported python 3.x. We've recently merged with `Ian Cordasco `_'s -`charade `_ fork, so now we have one -coherent version that works for Python 2.6+. - -:maintainer: Dan Blanchard - - diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/RECORD b/opensafely/_vendor/chardet-3.0.4.dist-info/RECORD deleted file mode 100644 index 03ee8705..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/RECORD +++ /dev/null @@ -1,51 +0,0 @@ -../../bin/chardetect,sha256=rs8ryhcO6KK7HEbwaqQXMyJbs-rh0b3z7StE9WY6u1s,255 -chardet-3.0.4.dist-info/DESCRIPTION.rst,sha256=PQ4sBsMyKFZkjC6QpmbpLn0UtCNyeb-ZqvCGEgyZMGk,2174 -chardet-3.0.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -chardet-3.0.4.dist-info/METADATA,sha256=RV_2I4B1Z586DL8oVO5Kp7X5bUdQ5EuKAvNoAEF8wSw,3239 -chardet-3.0.4.dist-info/RECORD,, -chardet-3.0.4.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -chardet-3.0.4.dist-info/WHEEL,sha256=o2k-Qa-RMNIJmUdIc7KU6VWR_ErNRbWNlxDIpl7lm34,110 -chardet-3.0.4.dist-info/entry_points.txt,sha256=fAMmhu5eJ-zAJ-smfqQwRClQ3-nozOCmvJ6-E8lgGJo,60 -chardet-3.0.4.dist-info/metadata.json,sha256=0htbRM18ujyGZDdfowgAqj6Hq2eQtwzwyhaEveKntgo,1375 -chardet-3.0.4.dist-info/top_level.txt,sha256=AowzBbZy4x8EirABDdJSLJZMkJ_53iIag8xfKR6D7kI,8 -chardet/__init__.py,sha256=YsP5wQlsHJ2auF1RZJfypiSrCA7_bQiRm3ES_NI76-Y,1559 -chardet/big5freq.py,sha256=D_zK5GyzoVsRes0HkLJziltFQX0bKCLOrFe9_xDvO_8,31254 -chardet/big5prober.py,sha256=kBxHbdetBpPe7xrlb-e990iot64g_eGSLd32lB7_h3M,1757 -chardet/chardistribution.py,sha256=3woWS62KrGooKyqz4zQSnjFbJpa6V7g02daAibTwcl8,9411 -chardet/charsetgroupprober.py,sha256=6bDu8YIiRuScX4ca9Igb0U69TA2PGXXDej6Cc4_9kO4,3787 -chardet/charsetprober.py,sha256=KSmwJErjypyj0bRZmC5F5eM7c8YQgLYIjZXintZNstg,5110 -chardet/cli/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 -chardet/cli/chardetect.py,sha256=YBO8L4mXo0WR6_-Fjh_8QxPBoEBNqB9oNxNrdc54AQs,2738 -chardet/codingstatemachine.py,sha256=VYp_6cyyki5sHgXDSZnXW4q1oelHc3cu9AyQTX7uug8,3590 -chardet/compat.py,sha256=PKTzHkSbtbHDqS9PyujMbX74q1a8mMpeQTDVsQhZMRw,1134 -chardet/cp949prober.py,sha256=TZ434QX8zzBsnUvL_8wm4AQVTZ2ZkqEEQL_lNw9f9ow,1855 -chardet/enums.py,sha256=Aimwdb9as1dJKZaFNUH2OhWIVBVd6ZkJJ_WK5sNY8cU,1661 -chardet/escprober.py,sha256=kkyqVg1Yw3DIOAMJ2bdlyQgUFQhuHAW8dUGskToNWSc,3950 -chardet/escsm.py,sha256=RuXlgNvTIDarndvllNCk5WZBIpdCxQ0kcd9EAuxUh84,10510 -chardet/eucjpprober.py,sha256=iD8Jdp0ISRjgjiVN7f0e8xGeQJ5GM2oeZ1dA8nbSeUw,3749 -chardet/euckrfreq.py,sha256=-7GdmvgWez4-eO4SuXpa7tBiDi5vRXQ8WvdFAzVaSfo,13546 -chardet/euckrprober.py,sha256=MqFMTQXxW4HbzIpZ9lKDHB3GN8SP4yiHenTmf8g_PxY,1748 -chardet/euctwfreq.py,sha256=No1WyduFOgB5VITUA7PLyC5oJRNzRyMbBxaKI1l16MA,31621 -chardet/euctwprober.py,sha256=13p6EP4yRaxqnP4iHtxHOJ6R2zxHq1_m8hTRjzVZ95c,1747 -chardet/gb2312freq.py,sha256=JX8lsweKLmnCwmk8UHEQsLgkr_rP_kEbvivC4qPOrlc,20715 -chardet/gb2312prober.py,sha256=gGvIWi9WhDjE-xQXHvNIyrnLvEbMAYgyUSZ65HUfylw,1754 -chardet/hebrewprober.py,sha256=c3SZ-K7hvyzGY6JRAZxJgwJ_sUS9k0WYkvMY00YBYFo,13838 -chardet/jisfreq.py,sha256=vpmJv2Bu0J8gnMVRPHMFefTRvo_ha1mryLig8CBwgOg,25777 -chardet/jpcntx.py,sha256=PYlNqRUQT8LM3cT5FmHGP0iiscFlTWED92MALvBungo,19643 -chardet/langbulgarianmodel.py,sha256=1HqQS9Pbtnj1xQgxitJMvw8X6kKr5OockNCZWfEQrPE,12839 -chardet/langcyrillicmodel.py,sha256=LODajvsetH87yYDDQKA2CULXUH87tI223dhfjh9Zx9c,17948 -chardet/langgreekmodel.py,sha256=8YAW7bU8YwSJap0kIJSbPMw1BEqzGjWzqcqf0WgUKAA,12688 -chardet/langhebrewmodel.py,sha256=JSnqmE5E62tDLTPTvLpQsg5gOMO4PbdWRvV7Avkc0HA,11345 -chardet/langhungarianmodel.py,sha256=RhapYSG5l0ZaO-VV4Fan5sW0WRGQqhwBM61yx3yxyOA,12592 -chardet/langthaimodel.py,sha256=8l0173Gu_W6G8mxmQOTEF4ls2YdE7FxWf3QkSxEGXJQ,11290 -chardet/langturkishmodel.py,sha256=W22eRNJsqI6uWAfwXSKVWWnCerYqrI8dZQTm_M0lRFk,11102 -chardet/latin1prober.py,sha256=S2IoORhFk39FEFOlSFWtgVybRiP6h7BlLldHVclNkU8,5370 -chardet/mbcharsetprober.py,sha256=AR95eFH9vuqSfvLQZN-L5ijea25NOBCoXqw8s5O9xLQ,3413 -chardet/mbcsgroupprober.py,sha256=h6TRnnYq2OxG1WdD5JOyxcdVpn7dG0q-vB8nWr5mbh4,2012 -chardet/mbcssm.py,sha256=SY32wVIF3HzcjY3BaEspy9metbNSKxIIB0RKPn7tjpI,25481 -chardet/sbcharsetprober.py,sha256=LDSpCldDCFlYwUkGkwD2oFxLlPWIWXT09akH_2PiY74,5657 -chardet/sbcsgroupprober.py,sha256=1IprcCB_k1qfmnxGC6MBbxELlKqD3scW6S8YIwdeyXA,3546 -chardet/sjisprober.py,sha256=IIt-lZj0WJqK4rmUZzKZP4GJlE8KUEtFYVuY96ek5MQ,3774 -chardet/universaldetector.py,sha256=qL0174lSZE442eB21nnktT9_VcAye07laFWUeUrjttY,12485 -chardet/utf8prober.py,sha256=IdD8v3zWOsB8OLiyPi-y_fqwipRFxV9Nc1eKBLSuIEw,2766 -chardet/version.py,sha256=sp3B08mrDXB-pf3K9fqJ_zeDHOCLC8RrngQyDFap_7g,242 diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/REQUESTED b/opensafely/_vendor/chardet-3.0.4.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/WHEEL b/opensafely/_vendor/chardet-3.0.4.dist-info/WHEEL deleted file mode 100644 index 8b6dd1b5..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.29.0) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/entry_points.txt b/opensafely/_vendor/chardet-3.0.4.dist-info/entry_points.txt deleted file mode 100644 index a884269e..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/entry_points.txt +++ /dev/null @@ -1,3 +0,0 @@ -[console_scripts] -chardetect = chardet.cli.chardetect:main - diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/metadata.json b/opensafely/_vendor/chardet-3.0.4.dist-info/metadata.json deleted file mode 100644 index 8cdf0256..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"classifiers": ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Linguistic"], "extensions": {"python.commands": {"wrap_console": {"chardetect": "chardet.cli.chardetect:main"}}, "python.details": {"contacts": [{"email": "dan.blanchard@gmail.com", "name": "Daniel Blanchard", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/chardet/chardet"}}, "python.exports": {"console_scripts": {"chardetect": "chardet.cli.chardetect:main"}}}, "generator": "bdist_wheel (0.29.0)", "keywords": ["encoding", "i18n", "xml"], "license": "LGPL", "metadata_version": "2.0", "name": "chardet", "summary": "Universal encoding detector for Python 2 and 3", "test_requires": [{"requires": ["hypothesis", "pytest"]}], "version": "3.0.4"} \ No newline at end of file diff --git a/opensafely/_vendor/chardet-3.0.4.dist-info/top_level.txt b/opensafely/_vendor/chardet-3.0.4.dist-info/top_level.txt deleted file mode 100644 index 79236f25..00000000 --- a/opensafely/_vendor/chardet-3.0.4.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -chardet diff --git a/opensafely/_vendor/distro-1.8.0.dist-info.pyi b/opensafely/_vendor/distro-1.8.0.dist-info.pyi deleted file mode 100644 index 86f34726..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from distro-1.8.0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/INSTALLER b/opensafely/_vendor/distro-1.8.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/LICENSE b/opensafely/_vendor/distro-1.8.0.dist-info/LICENSE deleted file mode 100644 index e06d2081..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. - diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/METADATA b/opensafely/_vendor/distro-1.8.0.dist-info/METADATA deleted file mode 100644 index 4ea28c49..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info/METADATA +++ /dev/null @@ -1,183 +0,0 @@ -Metadata-Version: 2.1 -Name: distro -Version: 1.8.0 -Summary: Distro - an OS platform information API -Home-page: https://github.com/python-distro/distro -Author: Nir Cohen -Author-email: nir36g@gmail.com -License: Apache License, Version 2.0 -Platform: All -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Operating System :: POSIX :: Linux -Classifier: Operating System :: POSIX :: BSD -Classifier: Operating System :: POSIX :: BSD :: FreeBSD -Classifier: Operating System :: POSIX :: BSD :: NetBSD -Classifier: Operating System :: POSIX :: BSD :: OpenBSD -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: System :: Operating System -Requires-Python: >=3.6 -Description-Content-Type: text/markdown -License-File: LICENSE - -Distro - an OS platform information API -======================================= - -[![CI Status](https://github.com/python-distro/distro/workflows/CI/badge.svg)](https://github.com/python-distro/distro/actions/workflows/ci.yaml) -[![PyPI version](http://img.shields.io/pypi/v/distro.svg)](https://pypi.python.org/pypi/distro) -[![Supported Python Versions](https://img.shields.io/pypi/pyversions/distro.svg)](https://img.shields.io/pypi/pyversions/distro.svg) -[![Code Coverage](https://codecov.io/github/python-distro/distro/coverage.svg?branch=master)](https://codecov.io/github/python-distro/distro?branch=master) -[![Is Wheel](https://img.shields.io/pypi/wheel/distro.svg?style=flat)](https://pypi.python.org/pypi/distro) -[![Latest Github Release](https://readthedocs.org/projects/distro/badge/?version=stable)](http://distro.readthedocs.io/en/latest/) -[![Join the chat at https://gitter.im/python-distro/distro](https://badges.gitter.im/python-distro/distro.svg)](https://gitter.im/python-distro/distro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -`distro` provides information about the -OS distribution it runs on, such as a reliable machine-readable ID, or -version information. - -It is the recommended replacement for Python's original -[`platform.linux_distribution`](https://docs.python.org/3.7/library/platform.html#platform.linux_distribution) -function (removed in Python 3.8). It also provides much more functionality -which isn't necessarily Python bound, like a command-line interface. - -Distro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/python-distro/distro/issues/177) is also planned. - -For Python 2.6 support, see https://github.com/python-distro/distro/tree/python2.6-support - -## Installation - -Installation of the latest released version from PyPI: - -```shell -pip install distro -``` - -Installation of the latest development version: - -```shell -pip install https://github.com/python-distro/distro/archive/master.tar.gz -``` - -To use as a standalone script, download `distro.py` directly: - -```shell -curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py -python distro.py -``` - -``distro`` is safe to vendor within projects that do not wish to add -dependencies. - -```shell -cd myproject -curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py -``` - -## Usage - -```bash -$ distro -Name: Antergos Linux -Version: 2015.10 (ISO-Rolling) -Codename: ISO-Rolling - -$ distro -j -{ - "codename": "ISO-Rolling", - "id": "antergos", - "like": "arch", - "version": "16.9", - "version_parts": { - "build_number": "", - "major": "16", - "minor": "9" - } -} - - -$ python ->>> import distro ->>> distro.name(pretty=True) -'CentOS Linux 8' ->>> distro.id() -'centos' ->>> distro.version(best=True) -'8.4.2105' -``` - - -## Documentation - -On top of the aforementioned API, several more functions are available. For a complete description of the -API, see the [latest API documentation](http://distro.readthedocs.org/en/latest/). - -## Background - -An alternative implementation became necessary because Python 3.5 deprecated -this function, and Python 3.8 removed it altogether. Its predecessor function -[`platform.dist`](https://docs.python.org/3.7/library/platform.html#platform.dist) -was already deprecated since Python 2.6 and removed in Python 3.8. Still, there -are many cases in which access to that information is needed. See [Python issue -1322](https://bugs.python.org/issue1322) for more information. - -The `distro` package implements a robust and inclusive way of retrieving the -information about a distribution based on new standards and old methods, -namely from these data sources (from high to low precedence): - -* The os-release file `/etc/os-release` if present, with a fall-back on `/usr/lib/os-release` if needed. -* The output of the `lsb_release` command, if available. -* The distro release file (`/etc/*(-|_)(release|version)`), if present. -* The `uname` command for BSD based distrubtions. - - -## Python and Distribution Support - -`distro` is supported and tested on Python 3.6+ and PyPy and on any -distribution that provides one or more of the data sources covered. - -This package is tested with test data that mimics the exact behavior of the data sources of [a number of Linux distributions](https://github.com/python-distro/distro/tree/master/tests/resources/distros). - - -## Testing - -```shell -git clone git@github.com:python-distro/distro.git -cd distro -pip install tox -tox -``` - - -## Contributions - -Pull requests are always welcome to deal with specific distributions or just -for general merriment. - -See [CONTRIBUTIONS](https://github.com/python-distro/distro/blob/master/CONTRIBUTING.md) for contribution info. - -Reference implementations for supporting additional distributions and file -formats can be found here: - -* https://github.com/saltstack/salt/blob/develop/salt/grains/core.py#L1172 -* https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb -* https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py -* https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/os_linux.cc - -## Package manager distributions - -* https://src.fedoraproject.org/rpms/python-distro -* https://www.archlinux.org/packages/community/any/python-distro/ -* https://launchpad.net/ubuntu/+source/python-distro -* https://packages.debian.org/stable/python3-distro -* https://packages.gentoo.org/packages/dev-python/distro -* https://pkgs.org/download/python3-distro -* https://slackbuilds.org/repository/14.2/python/python-distro/ diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/RECORD b/opensafely/_vendor/distro-1.8.0.dist-info/RECORD deleted file mode 100644 index cb2cb76a..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info/RECORD +++ /dev/null @@ -1,13 +0,0 @@ -../../bin/distro,sha256=29a3n43B_mVjn_fQOgyvUvaVNz2-44LC06SGtEopzvU,246 -distro-1.8.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -distro-1.8.0.dist-info/LICENSE,sha256=y16Ofl9KOYjhBjwULGDcLfdWBfTEZRXnduOspt-XbhQ,11325 -distro-1.8.0.dist-info/METADATA,sha256=NhYw94UPXb78_Z3_VtLxTJ1zQgUUKoTndg10uKJX800,6915 -distro-1.8.0.dist-info/RECORD,, -distro-1.8.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -distro-1.8.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -distro-1.8.0.dist-info/entry_points.txt,sha256=3ObjqQMbh1xeQQwsWtgbfDNDMDD-EbggR1Oj_z8s9hc,46 -distro-1.8.0.dist-info/top_level.txt,sha256=ikde_V_XEdSBqaGd5tEriN_wzYHLgTX_zVtlsGLHvwQ,7 -distro/__init__.py,sha256=2fHjF-SfgPvjyNZ1iHh_wjqWdR_Yo5ODHwZC0jLBPhc,981 -distro/__main__.py,sha256=bu9d3TifoKciZFcqRBuygV3GSuThnVD_m2IK4cz96Vs,64 -distro/distro.py,sha256=UZO1LjIhtFCMdlbiz39gj3raV-Amf3SBwzGzfApiMHw,49330 -distro/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/REQUESTED b/opensafely/_vendor/distro-1.8.0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/WHEEL b/opensafely/_vendor/distro-1.8.0.dist-info/WHEEL deleted file mode 100644 index becc9a66..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/entry_points.txt b/opensafely/_vendor/distro-1.8.0.dist-info/entry_points.txt deleted file mode 100644 index 08d29c55..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -distro = distro.distro:main diff --git a/opensafely/_vendor/distro-1.8.0.dist-info/top_level.txt b/opensafely/_vendor/distro-1.8.0.dist-info/top_level.txt deleted file mode 100644 index 0e093317..00000000 --- a/opensafely/_vendor/distro-1.8.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -distro diff --git a/opensafely/_vendor/idna-2.10.dist-info.pyi b/opensafely/_vendor/idna-2.10.dist-info.pyi deleted file mode 100644 index 69109b75..00000000 --- a/opensafely/_vendor/idna-2.10.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from idna-2.10.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/idna-2.10.dist-info/INSTALLER b/opensafely/_vendor/idna-2.10.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/idna-2.10.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/idna-2.10.dist-info/LICENSE.rst b/opensafely/_vendor/idna-2.10.dist-info/LICENSE.rst deleted file mode 100644 index 63664b82..00000000 --- a/opensafely/_vendor/idna-2.10.dist-info/LICENSE.rst +++ /dev/null @@ -1,34 +0,0 @@ -License -------- - -License: bsd-3-clause - -Copyright (c) 2013-2020, Kim Davies. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -#. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -#. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with - the distribution. - -#. Neither the name of the copyright holder nor the names of the - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -#. THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS "AS IS" AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. diff --git a/opensafely/_vendor/idna-2.10.dist-info/METADATA b/opensafely/_vendor/idna-2.10.dist-info/METADATA deleted file mode 100644 index f73c0ffe..00000000 --- a/opensafely/_vendor/idna-2.10.dist-info/METADATA +++ /dev/null @@ -1,243 +0,0 @@ -Metadata-Version: 2.1 -Name: idna -Version: 2.10 -Summary: Internationalized Domain Names in Applications (IDNA) -Home-page: https://github.com/kjd/idna -Author: Kim Davies -Author-email: kim@cynosure.com.au -License: BSD-like -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Internet :: Name Service (DNS) -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Utilities -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* - -Internationalized Domain Names in Applications (IDNA) -===================================================== - -Support for the Internationalised Domain Names in Applications -(IDNA) protocol as specified in `RFC 5891 `_. -This is the latest version of the protocol and is sometimes referred to as -“IDNA 2008”. - -This library also provides support for Unicode Technical Standard 46, -`Unicode IDNA Compatibility Processing `_. - -This acts as a suitable replacement for the “encodings.idna” module that -comes with the Python standard library, but only supports the -old, deprecated IDNA specification (`RFC 3490 `_). - -Basic functions are simply executed: - -.. code-block:: pycon - - # Python 3 - >>> import idna - >>> idna.encode('ドメイン.テスト') - b'xn--eckwd4c7c.xn--zckzah' - >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) - ドメイン.テスト - - # Python 2 - >>> import idna - >>> idna.encode(u'ドメイン.テスト') - 'xn--eckwd4c7c.xn--zckzah' - >>> print idna.decode('xn--eckwd4c7c.xn--zckzah') - ドメイン.テスト - -Packages --------- - -The latest tagged release version is published in the PyPI repository: - -.. image:: https://badge.fury.io/py/idna.svg - :target: http://badge.fury.io/py/idna - - -Installation ------------- - -To install this library, you can use pip: - -.. code-block:: bash - - $ pip install idna - -Alternatively, you can install the package using the bundled setup script: - -.. code-block:: bash - - $ python setup.py install - -This library works with Python 2.7 and Python 3.4 or later. - - -Usage ------ - -For typical usage, the ``encode`` and ``decode`` functions will take a domain -name argument and perform a conversion to A-labels or U-labels respectively. - -.. code-block:: pycon - - # Python 3 - >>> import idna - >>> idna.encode('ドメイン.テスト') - b'xn--eckwd4c7c.xn--zckzah' - >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) - ドメイン.テスト - -You may use the codec encoding and decoding methods using the -``idna.codec`` module: - -.. code-block:: pycon - - # Python 2 - >>> import idna.codec - >>> print u'домена.испытание'.encode('idna') - xn--80ahd1agd.xn--80akhbyknj4f - >>> print 'xn--80ahd1agd.xn--80akhbyknj4f'.decode('idna') - домена.испытание - -Conversions can be applied at a per-label basis using the ``ulabel`` or ``alabel`` -functions if necessary: - -.. code-block:: pycon - - # Python 2 - >>> idna.alabel(u'测试') - 'xn--0zwm56d' - -Compatibility Mapping (UTS #46) -+++++++++++++++++++++++++++++++ - -As described in `RFC 5895 `_, the IDNA -specification no longer normalizes input from different potential ways a user -may input a domain name. This functionality, known as a “mapping”, is now -considered by the specification to be a local user-interface issue distinct -from IDNA conversion functionality. - -This library provides one such mapping, that was developed by the Unicode -Consortium. Known as `Unicode IDNA Compatibility Processing `_, -it provides for both a regular mapping for typical applications, as well as -a transitional mapping to help migrate from older IDNA 2003 applications. - -For example, “Königsgäßchen” is not a permissible label as *LATIN CAPITAL -LETTER K* is not allowed (nor are capital letters in general). UTS 46 will -convert this into lower case prior to applying the IDNA conversion. - -.. code-block:: pycon - - # Python 3 - >>> import idna - >>> idna.encode(u'Königsgäßchen') - ... - idna.core.InvalidCodepoint: Codepoint U+004B at position 1 of 'Königsgäßchen' not allowed - >>> idna.encode('Königsgäßchen', uts46=True) - b'xn--knigsgchen-b4a3dun' - >>> print(idna.decode('xn--knigsgchen-b4a3dun')) - königsgäßchen - -Transitional processing provides conversions to help transition from the older -2003 standard to the current standard. For example, in the original IDNA -specification, the *LATIN SMALL LETTER SHARP S* (ß) was converted into two -*LATIN SMALL LETTER S* (ss), whereas in the current IDNA specification this -conversion is not performed. - -.. code-block:: pycon - - # Python 2 - >>> idna.encode(u'Königsgäßchen', uts46=True, transitional=True) - 'xn--knigsgsschen-lcb0w' - -Implementors should use transitional processing with caution, only in rare -cases where conversion from legacy labels to current labels must be performed -(i.e. IDNA implementations that pre-date 2008). For typical applications -that just need to convert labels, transitional processing is unlikely to be -beneficial and could produce unexpected incompatible results. - -``encodings.idna`` Compatibility -++++++++++++++++++++++++++++++++ - -Function calls from the Python built-in ``encodings.idna`` module are -mapped to their IDNA 2008 equivalents using the ``idna.compat`` module. -Simply substitute the ``import`` clause in your code to refer to the -new module name. - -Exceptions ----------- - -All errors raised during the conversion following the specification should -raise an exception derived from the ``idna.IDNAError`` base class. - -More specific exceptions that may be generated as ``idna.IDNABidiError`` -when the error reflects an illegal combination of left-to-right and right-to-left -characters in a label; ``idna.InvalidCodepoint`` when a specific codepoint is -an illegal character in an IDN label (i.e. INVALID); and ``idna.InvalidCodepointContext`` -when the codepoint is illegal based on its positional context (i.e. it is CONTEXTO -or CONTEXTJ but the contextual requirements are not satisfied.) - -Building and Diagnostics ------------------------- - -The IDNA and UTS 46 functionality relies upon pre-calculated lookup tables for -performance. These tables are derived from computing against eligibility criteria -in the respective standards. These tables are computed using the command-line -script ``tools/idna-data``. - -This tool will fetch relevant tables from the Unicode Consortium and perform the -required calculations to identify eligibility. It has three main modes: - -* ``idna-data make-libdata``. Generates ``idnadata.py`` and ``uts46data.py``, - the pre-calculated lookup tables using for IDNA and UTS 46 conversions. Implementors - who wish to track this library against a different Unicode version may use this tool - to manually generate a different version of the ``idnadata.py`` and ``uts46data.py`` - files. - -* ``idna-data make-table``. Generate a table of the IDNA disposition - (e.g. PVALID, CONTEXTJ, CONTEXTO) in the format found in Appendix B.1 of RFC - 5892 and the pre-computed tables published by `IANA `_. - -* ``idna-data U+0061``. Prints debugging output on the various properties - associated with an individual Unicode codepoint (in this case, U+0061), that are - used to assess the IDNA and UTS 46 status of a codepoint. This is helpful in debugging - or analysis. - -The tool accepts a number of arguments, described using ``idna-data -h``. Most notably, -the ``--version`` argument allows the specification of the version of Unicode to use -in computing the table data. For example, ``idna-data --version 9.0.0 make-libdata`` -will generate library data against Unicode 9.0.0. - -Note that this script requires Python 3, but all generated library data will work -in Python 2.7. - - -Testing -------- - -The library has a test suite based on each rule of the IDNA specification, as -well as tests that are provided as part of the Unicode Technical Standard 46, -`Unicode IDNA Compatibility Processing `_. - -The tests are run automatically on each commit at Travis CI: - -.. image:: https://travis-ci.org/kjd/idna.svg?branch=master - :target: https://travis-ci.org/kjd/idna - - diff --git a/opensafely/_vendor/idna-2.10.dist-info/RECORD b/opensafely/_vendor/idna-2.10.dist-info/RECORD deleted file mode 100644 index 24c09989..00000000 --- a/opensafely/_vendor/idna-2.10.dist-info/RECORD +++ /dev/null @@ -1,15 +0,0 @@ -idna-2.10.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -idna-2.10.dist-info/LICENSE.rst,sha256=QSAUQg0kc9ugYRfD1Nng7sqm3eDKMM2VH07CvjlCbzI,1565 -idna-2.10.dist-info/METADATA,sha256=ZWCaQDBjdmSvx5EU7Cv6ORC-9NUQ6nXh1eXx38ySe40,9104 -idna-2.10.dist-info/RECORD,, -idna-2.10.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -idna-2.10.dist-info/WHEEL,sha256=8zNYZbwQSXoB9IfXOjPfeNwvAsALAjffgk27FqvCWbo,110 -idna-2.10.dist-info/top_level.txt,sha256=jSag9sEDqvSPftxOQy-ABfGV_RSy7oFh4zZJpODV8k0,5 -idna/__init__.py,sha256=9Nt7xpyet3DmOrPUGooDdAwmHZZu1qUAy2EaJ93kGiQ,58 -idna/codec.py,sha256=lvYb7yu7PhAqFaAIAdWcwgaWI2UmgseUua-1c0AsG0A,3299 -idna/compat.py,sha256=R-h29D-6mrnJzbXxymrWUW7iZUvy-26TQwZ0ij57i4U,232 -idna/core.py,sha256=jCoaLb3bA2tS_DDx9PpGuNTEZZN2jAzB369aP-IHYRE,11951 -idna/idnadata.py,sha256=gmzFwZWjdms3kKZ_M_vwz7-LP_SCgYfSeE03B21Qpsk,42350 -idna/intranges.py,sha256=TY1lpxZIQWEP6tNqjZkFA5hgoMWOj1OBmnUG8ihT87E,1749 -idna/package_data.py,sha256=bxBjpLnE06_1jSYKEy5svOMu1zM3OMztXVUb1tPlcp0,22 -idna/uts46data.py,sha256=lMdw2zdjkH1JUWXPPEfFUSYT3Fyj60bBmfLvvy5m7ko,202084 diff --git a/opensafely/_vendor/idna-2.10.dist-info/REQUESTED b/opensafely/_vendor/idna-2.10.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/idna-2.10.dist-info/WHEEL b/opensafely/_vendor/idna-2.10.dist-info/WHEEL deleted file mode 100644 index 8b701e93..00000000 --- a/opensafely/_vendor/idna-2.10.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.33.6) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/idna-2.10.dist-info/top_level.txt b/opensafely/_vendor/idna-2.10.dist-info/top_level.txt deleted file mode 100644 index c40472e6..00000000 --- a/opensafely/_vendor/idna-2.10.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -idna diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info.pyi b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info.pyi deleted file mode 100644 index 802e7a46..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from opensafely_pipeline-2025.3.6.161237.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/INSTALLER b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/LICENSE b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/LICENSE deleted file mode 100644 index c7901370..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -${GITHUB_REPOSITORY_NAME} -Copyright (C) University of Oxford - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/METADATA b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/METADATA deleted file mode 100644 index 8555486d..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/METADATA +++ /dev/null @@ -1,49 +0,0 @@ -Metadata-Version: 2.1 -Name: opensafely-pipeline -Version: 2025.3.6.161237 -Summary: OpenSAFELY pipeline configuration parsing library -Author-email: OpenSAFELY -License: ${GITHUB_REPOSITORY_NAME} - Copyright (C) University of Oxford - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Project-URL: Home, https://opensafely.org -Project-URL: Documentation, https://docs.opensafely.org -Project-URL: Source, https://github.com/opensafely-core/pipeline -Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) -Requires-Python: >=3.8 -Description-Content-Type: text/markdown -License-File: LICENSE -Requires-Dist: ruyaml -Provides-Extra: fastparser -Requires-Dist: ruamel-yaml==0.18.6; extra == "fastparser" -Requires-Dist: ruamel-yaml-clib==0.2.8; extra == "fastparser" - -# OpenSAFELY Pipeline Parser - -This library takes the contents of an OpenSAFELY pipeline configuration file (`project.yaml` or `pipeline.yaml`), validates it, and parses it into a typed structure. - -For example: - - with open("/path/to/project.yaml") as f: - data = load_pipeline(f.read()) - - -The returned object is an instance of `pipeline.models.Pipeline`. - - -## Developer docs - -Please see the [additional information](DEVELOPERS.md). diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/RECORD b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/RECORD deleted file mode 100644 index 1260cb67..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/RECORD +++ /dev/null @@ -1,19 +0,0 @@ -opensafely_pipeline-2025.3.6.161237.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -opensafely_pipeline-2025.3.6.161237.dist-info/LICENSE,sha256=3dYRqvpnIRI1ISbzwG_EKRHulT5qzYLacVDM09Ehn5Y,675 -opensafely_pipeline-2025.3.6.161237.dist-info/METADATA,sha256=LfJ8xHLVDlbioXdBIfeSVEG_igZO7jNu9YrzahEMw18,1929 -opensafely_pipeline-2025.3.6.161237.dist-info/RECORD,, -opensafely_pipeline-2025.3.6.161237.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opensafely_pipeline-2025.3.6.161237.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91 -opensafely_pipeline-2025.3.6.161237.dist-info/direct_url.json,sha256=e9dD--BHdJ2fmUSpDoMkTNk1kbyf_kWyi8qcba94WPc,286 -opensafely_pipeline-2025.3.6.161237.dist-info/top_level.txt,sha256=Qdc1eKrvhKK_o9CPbdooOdDt7g3ZSXZDrNXHmUGl94Q,9 -pipeline/__init__.py,sha256=OXi7WT9uT8zmpPCJY5mh7DCBiSdRg7D6EFOT-wNTulM,236 -pipeline/__main__.py,sha256=5hAi8GJDuS0ufV6IA9TP91SPQphoJQjdBTtBHzPeIQQ,471 -pipeline/constants.py,sha256=YYp4huzWNFIaimLP9AbiW1eDLaRaS2c6tHYW_GRb19c,354 -pipeline/exceptions.py,sha256=aeRYcjMhpgkhdRyQka-yK4X2vxRqa3wg6LG-lYI67Tw,196 -pipeline/features.py,sha256=z-Gs7TaX-9YqBYGt0zLiVeZT_aU1VRMjmPJGb-7t4wI,972 -pipeline/legacy.py,sha256=hfxBHpEXO6VbqHcg_cqKUb_lVKmq0hVbhwYaXkACkf8,405 -pipeline/loading.py,sha256=HUh-uOOVTh6VBLi3xUvwyEP91155Z_IPp2Mimcm-PPk,3929 -pipeline/main.py,sha256=t8KyXsNdZvCeEq5LFR7xJtV6aq4OvJidL24K0_580ro,990 -pipeline/models.py,sha256=oov0x8jOPz9f9AoTNMY9Lqb6HQ9TGhmP0MbM2jlm_go,11782 -pipeline/outputs.py,sha256=d58FoAE5vF6nepfW4n3ixoPQ4Q4vlA4BAIpAZJQiMQI,658 -pipeline/validation.py,sha256=yrSw6HWYN098ztDmmYj9rmsYmIR8nxHUmZRVBQxVyYQ,7043 diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/REQUESTED b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/WHEEL b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/WHEEL deleted file mode 100644 index 1f646157..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (75.3.2) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/direct_url.json b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/direct_url.json deleted file mode 100644 index 402703b1..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/direct_url.json +++ /dev/null @@ -1 +0,0 @@ -{"archive_info": {"hash": "sha256=1b63f0ea0d6df2d3ecedbb6fc0550185e96b5164b956bc2b5d5eb47cb0d0611f", "hashes": {"sha256": "1b63f0ea0d6df2d3ecedbb6fc0550185e96b5164b956bc2b5d5eb47cb0d0611f"}}, "url": "https://github.com/opensafely-core/pipeline/archive/refs/tags/v2025.03.06.161237.zip"} \ No newline at end of file diff --git a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/top_level.txt b/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/top_level.txt deleted file mode 100644 index 975ba4d6..00000000 --- a/opensafely/_vendor/opensafely_pipeline-2025.3.6.161237.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -pipeline diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info.pyi b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info.pyi deleted file mode 100644 index 60b2d98b..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from opentelemetry_api-1.12.0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/INSTALLER b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/LICENSE b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/LICENSE deleted file mode 100644 index 1ef7dad2..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright The OpenTelemetry Authors - - 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. diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/METADATA b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/METADATA deleted file mode 100644 index 71d471fa..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/METADATA +++ /dev/null @@ -1,47 +0,0 @@ -Metadata-Version: 2.1 -Name: opentelemetry-api -Version: 1.12.0 -Summary: OpenTelemetry Python API -Home-page: https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-api -Author: OpenTelemetry Authors -Author-email: cncf-opentelemetry-contributors@lists.cncf.io -License: Apache-2.0 -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Typing :: Typed -Requires-Python: >=3.6 -Description-Content-Type: text/x-rst -License-File: LICENSE -Requires-Dist: Deprecated (>=1.2.6) -Requires-Dist: setuptools (>=16.0) -Requires-Dist: aiocontextvars ; python_version < "3.7" -Provides-Extra: test - -OpenTelemetry Python API -============================================================================ - -|pypi| - -.. |pypi| image:: https://badge.fury.io/py/opentelemetry-api.svg - :target: https://pypi.org/project/opentelemetry-api/ - -Installation ------------- - -:: - - pip install opentelemetry-api - -References ----------- - -* `OpenTelemetry Project `_ diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/RECORD b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/RECORD deleted file mode 100644 index df37ca4b..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/RECORD +++ /dev/null @@ -1,34 +0,0 @@ -opentelemetry/attributes/__init__.py,sha256=XZERg5vb7J-DseJv9obM1ulV5Xs8rqXXNjrBZM7EVUA,6592 -opentelemetry/baggage/__init__.py,sha256=aV1fTIHE3d6iwwmwZnQCDy-xwZQTLz_lZj1mzlW5ky4,4174 -opentelemetry/baggage/propagation/__init__.py,sha256=j0gy9sAkpaMx9WVmyDvca7sHfyuQHJ7sMsrICqlBv_w,4683 -opentelemetry/context/__init__.py,sha256=k7DTC5wlkZcWYXz33QVMrr0GdiSVTsAK1yBoCBULxFU,5895 -opentelemetry/context/context.py,sha256=NamBGlAlwMmplU4U8tgJXXIONfrGWdNunSJ99icHumA,1632 -opentelemetry/context/contextvars_context.py,sha256=AL05cPSFQYj1W0ng2mf_ShoX21nNBnlj91KRkgPO-qY,1972 -opentelemetry/environment_variables.py,sha256=3jKbuK_S1ywdgjPQt-Rlu5GzeT0AgKFu287ucJT9E_A,1323 -opentelemetry/metrics/__init__.py,sha256=kCm2c9R5P04q2DbN_NLZzHlANr_baellq7Zo5ckrVWM,3366 -opentelemetry/metrics/_internal/__init__.py,sha256=eFEdtKodnP2MDsclLnNa8oMH8S3WuCRlgi9aS2uwSFY,27227 -opentelemetry/metrics/_internal/instrument.py,sha256=NeV6Pw7Xr2F_f1zOQ2QOIsi5yjnbby5oE99M4qlD4g4,11438 -opentelemetry/metrics/_internal/observation.py,sha256=WrzGscBXf_dboUhK3veiOUrJ9N7UUCvwqzJ0OIpXnuU,1600 -opentelemetry/propagate/__init__.py,sha256=2c2khAyeOAAmGHtHOemuWI2WEMypt4Eis9BOlrksJCI,5365 -opentelemetry/propagators/composite.py,sha256=EgdgEbaNEN7g-XNGXR9YEO8akBv7eOWzA4pKyhDXVxc,3255 -opentelemetry/propagators/textmap.py,sha256=IorrrDqoRv1ESB7Zn43lEeg7X_jetb6vNK87o-1oYSY,6611 -opentelemetry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry/trace/__init__.py,sha256=dsES4mO-hwH_WSv3V4il1QnsbhVoAR629K3oDymt8rY,21799 -opentelemetry/trace/propagation/__init__.py,sha256=YZMj0p-IcgBkyBfcZN0xO-3iUxi65Z8_zaIZGXRu5Q4,1684 -opentelemetry/trace/propagation/tracecontext.py,sha256=enrv8I99529sQcvokscqfZyY_Z6GblgV3r2W-rjxLTA,4178 -opentelemetry/trace/span.py,sha256=Ks9wdxTut8VuNHd8tWKCjvXXU_veSF64CGmOzsnS884,18681 -opentelemetry/trace/status.py,sha256=2K7fRLV7gDFAgpFA4AvMTjJfEUfyZjFa2PQ3VjjHBHE,2539 -opentelemetry/util/_once.py,sha256=qTsPYBYopTsAtVthY88gd8EQR6jNe-yWzZB353_REDY,1440 -opentelemetry/util/_providers.py,sha256=AuarIvbOdlvafzSJK6lrWOFZQUjlukxxdcijzsSsaZc,1634 -opentelemetry/util/_time.py,sha256=4ME31vkhHehCSxx8OQTGsRModQpqL8oisGDAK0fQMPw,1267 -opentelemetry/util/re.py,sha256=I7hOIUdkro0iekFt-Kb1Bzye334nVx7dnhf28VDYZvM,2363 -opentelemetry/util/types.py,sha256=a9i0orW124UkS48cDIa0PDZOsjbx1weHHNJp3gGjlQc,1167 -opentelemetry/version.py,sha256=yk1jvTkr9u44V9-UKXzc2yZoks579w8PMizujHde9S4,608 -opentelemetry_api-1.12.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -opentelemetry_api-1.12.0.dist-info/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350 -opentelemetry_api-1.12.0.dist-info/METADATA,sha256=4VrMi66FCoO38PaG6IaFsh4sfQkjaRBHlDVCdjv5cq4,1454 -opentelemetry_api-1.12.0.dist-info/RECORD,, -opentelemetry_api-1.12.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -opentelemetry_api-1.12.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 -opentelemetry_api-1.12.0.dist-info/entry_points.txt,sha256=dxPq0YRbQDSwl8QkR-I9A38rbbfKQG5h2uNFjpvU6V4,573 -opentelemetry_api-1.12.0.dist-info/top_level.txt,sha256=5p97iTMneNm1LAKDalzEVpYhvPZsaqJZzdLuD_upSaQ,14 diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/REQUESTED b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/WHEEL b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/WHEEL deleted file mode 100644 index becc9a66..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.1) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/entry_points.txt b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/entry_points.txt deleted file mode 100644 index 62796162..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/entry_points.txt +++ /dev/null @@ -1,15 +0,0 @@ -[opentelemetry_context] -contextvars_context = opentelemetry.context.contextvars_context:ContextVarsRuntimeContext - -[opentelemetry_environment_variables] -api = opentelemetry.environment_variables - -[opentelemetry_meter_provider] -default_meter_provider = opentelemetry.metrics:NoOpMeterProvider - -[opentelemetry_propagator] -baggage = opentelemetry.baggage.propagation:W3CBaggagePropagator -tracecontext = opentelemetry.trace.propagation.tracecontext:TraceContextTextMapPropagator - -[opentelemetry_tracer_provider] -default_tracer_provider = opentelemetry.trace:NoOpTracerProvider diff --git a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/top_level.txt b/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/top_level.txt deleted file mode 100644 index 25138d19..00000000 --- a/opensafely/_vendor/opentelemetry_api-1.12.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -opentelemetry diff --git a/opensafely/_vendor/requests-2.25.0.dist-info.pyi b/opensafely/_vendor/requests-2.25.0.dist-info.pyi deleted file mode 100644 index 9ae01f41..00000000 --- a/opensafely/_vendor/requests-2.25.0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from requests-2.25.0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/requests-2.25.0.dist-info/INSTALLER b/opensafely/_vendor/requests-2.25.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/requests-2.25.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/requests-2.25.0.dist-info/LICENSE b/opensafely/_vendor/requests-2.25.0.dist-info/LICENSE deleted file mode 100644 index 67db8588..00000000 --- a/opensafely/_vendor/requests-2.25.0.dist-info/LICENSE +++ /dev/null @@ -1,175 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. diff --git a/opensafely/_vendor/requests-2.25.0.dist-info/METADATA b/opensafely/_vendor/requests-2.25.0.dist-info/METADATA deleted file mode 100644 index 98afa528..00000000 --- a/opensafely/_vendor/requests-2.25.0.dist-info/METADATA +++ /dev/null @@ -1,103 +0,0 @@ -Metadata-Version: 2.1 -Name: requests -Version: 2.25.0 -Summary: Python HTTP for Humans. -Home-page: https://requests.readthedocs.io -Author: Kenneth Reitz -Author-email: me@kennethreitz.org -License: Apache 2.0 -Project-URL: Documentation, https://requests.readthedocs.io -Project-URL: Source, https://github.com/psf/requests -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Natural Language :: English -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* -Description-Content-Type: text/markdown -Requires-Dist: chardet (<4,>=3.0.2) -Requires-Dist: idna (<3,>=2.5) -Requires-Dist: urllib3 (<1.27,>=1.21.1) -Requires-Dist: certifi (>=2017.4.17) -Provides-Extra: security -Requires-Dist: pyOpenSSL (>=0.14) ; extra == 'security' -Requires-Dist: cryptography (>=1.3.4) ; extra == 'security' -Provides-Extra: socks -Requires-Dist: PySocks (!=1.5.7,>=1.5.6) ; extra == 'socks' -Requires-Dist: win-inet-pton ; (sys_platform == "win32" and python_version == "2.7") and extra == 'socks' - -# Requests - -**Requests** is a simple, yet elegant HTTP library. - -```python ->>> import requests ->>> r = requests.get('https://api.github.com/user', auth=('user', 'pass')) ->>> r.status_code -200 ->>> r.headers['content-type'] -'application/json; charset=utf8' ->>> r.encoding -'utf-8' ->>> r.text -'{"type":"User"...' ->>> r.json() -{'disk_usage': 368627, 'private_gists': 484, ...} -``` - -Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your `PUT` & `POST` data — but nowadays, just use the `json` method! - -Requests is one of the most downloaded Python package today, pulling in around `14M downloads / week`— according to GitHub, Requests is currently [depended upon](https://github.com/psf/requests/network/dependents?package_id=UGFja2FnZS01NzA4OTExNg%3D%3D) by `500,000+` repositories. You may certainly put your trust in this code. - -[![Downloads](https://pepy.tech/badge/requests/month)](https://pepy.tech/project/requests/month) -[![Supported Versions](https://img.shields.io/pypi/pyversions/requests.svg)](https://pypi.org/project/requests) -[![Contributors](https://img.shields.io/github/contributors/psf/requests.svg)](https://github.com/psf/requests/graphs/contributors) - -## Installing Requests and Supported Versions - -Requests is available on PyPI: - -```console -$ python -m pip install requests -``` - -Requests officially supports Python 2.7 & 3.5+. - -## Supported Features & Best–Practices - -Requests is ready for the demands of building robust and reliable HTTP–speaking applications, for the needs of today. - -- Keep-Alive & Connection Pooling -- International Domains and URLs -- Sessions with Cookie Persistence -- Browser-style TLS/SSL Verification -- Basic & Digest Authentication -- Familiar `dict`–like Cookies -- Automatic Content Decompression and Decoding -- Multi-part File Uploads -- SOCKS Proxy Support -- Connection Timeouts -- Streaming Downloads -- Automatic honoring of `.netrc` -- Chunked HTTP Requests - -## API Reference and User Guide available on [Read the Docs](https://requests.readthedocs.io) - -[![Read the Docs](https://raw.githubusercontent.com/psf/requests/master/ext/ss.png)](https://requests.readthedocs.io) - ---- - -[![Kenneth Reitz](https://raw.githubusercontent.com/psf/requests/master/ext/kr.png)](https://kennethreitz.org) [![Python Software Foundation](https://raw.githubusercontent.com/psf/requests/master/ext/psf.png)](https://www.python.org/psf) - - diff --git a/opensafely/_vendor/requests-2.25.0.dist-info/RECORD b/opensafely/_vendor/requests-2.25.0.dist-info/RECORD deleted file mode 100644 index 6b2ef622..00000000 --- a/opensafely/_vendor/requests-2.25.0.dist-info/RECORD +++ /dev/null @@ -1,25 +0,0 @@ -requests-2.25.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -requests-2.25.0.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142 -requests-2.25.0.dist-info/METADATA,sha256=lF4qQTUP5FmvRXX2FptMvzd1VBYCHDjShVAnnL9jrVw,4168 -requests-2.25.0.dist-info/RECORD,, -requests-2.25.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -requests-2.25.0.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110 -requests-2.25.0.dist-info/top_level.txt,sha256=fMSVmHfb5rbGOo6xv-O_tUX6j-WyixssE-SnwcDRxNQ,9 -requests/__init__.py,sha256=k-Io-iijbUsCpQ3oQ1ofbvP0TJ-Z69lVVHZZ5rJw028,4148 -requests/__version__.py,sha256=H_gz0kn3hr_O3iETRESvsWhrLs4160qle4OHnhYnmeU,441 -requests/_internal_utils.py,sha256=Zx3PnEUccyfsB-ie11nZVAW8qClJy0gx1qNME7rgT18,1096 -requests/adapters.py,sha256=WelSM1BCQXdbjEuDsBxqKDADeY8BHmxlrwbNnLN2rr4,21344 -requests/api.py,sha256=PlHM-HT3PQ5lyufoeGmV-nJxRi7UnUyGVh7OV7B9XV4,6496 -requests/auth.py,sha256=OMoJIVKyRLy9THr91y8rxysZuclwPB-K1Xg1zBomUhQ,10207 -requests/certs.py,sha256=dOB5rV2DZ13dEhq9BUa_4hd5kAqg59e_zUZB00faYz8,453 -requests/compat.py,sha256=iBRvu-X540CH4PJsuxr0vcGTnl_TZhq_75SwmeckQ7w,1782 -requests/cookies.py,sha256=Y-bKX6TvW3FnYlE6Au0SXtVVWcaNdFvuAwQxw-G0iTI,18430 -requests/exceptions.py,sha256=xXoj1rdhnxTS_DYphKZ9OvFZJQZ333A64REc9ZDZIgU,3161 -requests/help.py,sha256=lLcBtKAar8T6T78e9Tc4Zfd_EEJFhntxgib1JHNctEI,3515 -requests/hooks.py,sha256=QReGyy0bRcr5rkwCuObNakbYsc7EkiKeBwG4qHekr2Q,757 -requests/models.py,sha256=Uhb4Ra_ubNGBf-6ktHShgO5mUSCGZKa5D_wLGVCMtYk,34308 -requests/packages.py,sha256=Q2rF0L5mc3wQAvc6q_lAVtPTDOaOeFgD-7kWSQLkjEQ,542 -requests/sessions.py,sha256=cl1qvq_xsLURTHRBjgtTyY18VyGeiyw8offXDT4_apo,30135 -requests/status_codes.py,sha256=gT79Pbs_cQjBgp-fvrUgg1dn2DQO32bDj4TInjnMPSc,4188 -requests/structures.py,sha256=msAtr9mq1JxHd-JRyiILfdFlpbJwvvFuP3rfUQT_QxE,3005 -requests/utils.py,sha256=RpCuBOJ7R4gv1pzGwHOCHEnW_CbI0r0cAN6hx2HyICs,30355 diff --git a/opensafely/_vendor/requests-2.25.0.dist-info/REQUESTED b/opensafely/_vendor/requests-2.25.0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/requests-2.25.0.dist-info/WHEEL b/opensafely/_vendor/requests-2.25.0.dist-info/WHEEL deleted file mode 100644 index 6d38aa06..00000000 --- a/opensafely/_vendor/requests-2.25.0.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.35.1) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/requests-2.25.0.dist-info/top_level.txt b/opensafely/_vendor/requests-2.25.0.dist-info/top_level.txt deleted file mode 100644 index f2293605..00000000 --- a/opensafely/_vendor/requests-2.25.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -requests diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info.pyi b/opensafely/_vendor/ruyaml-0.91.0.dist-info.pyi deleted file mode 100644 index 48b2b5ea..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from ruyaml-0.91.0.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/INSTALLER b/opensafely/_vendor/ruyaml-0.91.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/LICENSE b/opensafely/_vendor/ruyaml-0.91.0.dist-info/LICENSE deleted file mode 100644 index 3f65b07a..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - The MIT License (MIT) - - Copyright (c) 2014-2021 Anthon van der Neut, Ruamel bvba - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/METADATA b/opensafely/_vendor/ruyaml-0.91.0.dist-info/METADATA deleted file mode 100644 index 08ce36b3..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info/METADATA +++ /dev/null @@ -1,296 +0,0 @@ -Metadata-Version: 2.1 -Name: ruyaml -Version: 0.91.0 -Summary: ruyaml is a fork of ruamel.yaml -Home-page: https://github.com/pycontribs/ruyaml -Author: ruyaml Contributors -Author-email: pycontribs@googlegroups.com -Maintainer: Sorin Sbarnea -Maintainer-email: sorin.sbarnea@gmail.com -License: MIT license -Project-URL: Bug Tracker, https://github.com/pycontribs/ruyaml/issues -Project-URL: Release Management, https://github.com/pycontribs/ruyaml/releases -Project-URL: Source Code, https://github.com/pycontribs/ruyaml -Keywords: selinux,virtualenv -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Console -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Information Technology -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: MIT License -Classifier: Natural Language :: English -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Topic :: Utilities -Requires-Python: >=3.6 -Description-Content-Type: text/x-rst; charset=UTF-8 -License-File: LICENSE -Requires-Dist: distro (>=1.3.0) -Requires-Dist: setuptools (>=39.0) -Provides-Extra: docs -Requires-Dist: Sphinx ; extra == 'docs' - -ruyaml -====== - -``ruyaml`` package is a fork of ``ruamel.yaml`` aimed to made in order to -secure the future of the library, mainly by having a pool of maintainers. - -Notes -===== - -- The current version has the same API as the "ruamel.yaml" package. - However, it will install the `ruyaml` python module. Thus, simply - replace ``from ruamel import yaml`` with ``import ruyaml as yaml`` - (or equivalent) and you're all set. -- python3.6 is the minimal version of python supported - - -:version: 0.90.1 -:updated: 2021-06-10 -:documentation: http://ruyaml.readthedocs.io -:repository: https://github.com/pycontribs/ruyaml.git -:pypi: https://pypi.org/project/ruyaml/ - -*The 0.16.13 release was the last that was tested to be working on Python 2.7. -The 0.17 series will still be tested on Python 3.5, but the 0.18 will not. The -0.17 series will also stop support for the old PyYAML functions, so a `YAML()` instance -will need to be created.* - -*The 0.17 series will also see changes in how comments are attached during -roundtrip. This will result in backwards incompatibilities on the `.ca` data and -it might even be necessary for documented methods that handle comments.* - -*Please adjust your dependencies accordingly if necessary. (`ruamel.yaml<0.17`)* - - -Starting with version 0.15.0 the way YAML files are loaded and dumped -has been changing, see the API doc for details. Currently existing -functionality will throw a warning before being changed/removed. -**For production systems already using a pre 0.16 version, you should -pin the version being used with ``ruamel.yaml<=0.15``** if you cannot -fully test upgrading to a newer version. For new usage -pin to the minor version tested ( ``ruamel.yaml<=0.17``) or even to the -exact version used. - -New functionality is usually only available via the new API, so -make sure you use it and stop using the `ruamel.yaml.safe_load()`, -`ruamel.yaml.round_trip_load()` and `ruamel.yaml.load()` functions -(and their `....dump()` counterparts). - -If your package uses ``ruamel.yaml`` and is not listed on PyPI, drop -me an email, preferably with some information on how you use the -package (or a link to the repository) and I'll keep you informed -when the status of the API is stable enough to make the transition. - -* `Overview `_ -* `Installing `_ -* `Basic Usage `_ -* `Details `_ -* `Examples `_ -* `API `_ -* `Differences with PyYAML `_ - -.. image:: https://readthedocs.org/projects/yaml/badge/?version=stable - :target: https://yaml.readthedocs.org/en/stable - -.. image:: https://bestpractices.coreinfrastructure.org/projects/1128/badge - :target: https://bestpractices.coreinfrastructure.org/projects/1128 - -.. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree/_doc/_static/license.svg?format=raw - :target: https://opensource.org/licenses/MIT - -.. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree/_doc/_static/pypi.svg?format=raw - :target: https://pypi.org/project/ruamel.yaml/ - -.. image:: https://sourceforge.net/p/oitnb/code/ci/default/tree/_doc/_static/oitnb.svg?format=raw - :target: https://pypi.org/project/oitnb/ - -.. image:: http://www.mypy-lang.org/static/mypy_badge.svg - :target: http://mypy-lang.org/ - -ChangeLog -========= - -.. should insert NEXT: at the beginning of line for next key (with empty line) - -0.17.17 (2021-10-31): - - extract timestamp matching/creation to util - -0.17.16 (2021-08-28): - - 398 also handle issue 397 when comment is newline - -0.17.15 (2021-08-28): - - fix issue 397, insert comment before key when a comment between key and value exists - (reported by `Bastien gerard `__) - -0.17.14 (2021-08-25): - - fix issue 396, inserting key/val in merged-in dictionary (reported by `Bastien gerard - `__) - -0.17.13 (2021-08-21): - - minor fix in attr handling - -0.17.12 (2021-08-21): - - fix issue with anchor on registered class not preserved and those classes using package - attrs with `@attr.s()` (both reported by `ssph `__) - -0.17.11 (2021-08-19): - - fix error baseclass for ``DuplicateKeyErorr`` (reported by `Łukasz Rogalski - `__) - - fix typo in reader error message, causing `KeyError` during reader error - (reported by `MTU `__) - -0.17.10 (2021-06-24): - - fix issue 388, token with old comment structure != two elements - (reported by `Dimitrios Bariamis `__) - -0.17.9 (2021-06-10): - - fix issue with updating CommentedMap (reported by sri on - `StackOverflow `__) - -0.17.8 (2021-06-09): - - fix for issue 387 where templated anchors on tagged object did get set - resulting in potential id reuse. (reported by `Artem Ploujnikov - `__) - -0.17.7 (2021-05-31): - - issue 385 also affected other deprecated loaders (reported via email - by Oren Watson) - -0.17.6 (2021-05-31): - - merged type annotations update provided by - `Jochen Sprickerhof `__ - - fix for issue 385: deprecated round_trip_loader function not working - (reported by `Mike Gouline `__) - - wasted a few hours getting rid of mypy warnings/errors - -0.17.5 (2021-05-30): - - fix for issue 384 !!set with aliased entry resulting in broken YAML on rt - reported by `William Kimball `__) - -0.17.4 (2021-04-07): - - prevent (empty) comments from throwing assertion error (issue 351 - reported by `William Kimball `__) - comments (or empty line) will be dropped - -0.17.3 (2021-04-07): - - fix for issue 382 caused by an error in a format string (reported by - `William Kimball `__) - - allow expansion of aliases by setting ``yaml.composer.return_alias = lambda s: copy.deepcopy(s)`` - (as per `Stackoverflow answer `__) - -0.17.2 (2021-03-29): - - change -py2.py3-none-any.whl to -py3-none-any.whl, and remove 0.17.1 - -0.17.1 (2021-03-29): - - added 'Programming Language :: Python :: 3 :: Only', and removing - 0.17.0 from PyPI (reported by `Alasdair Nicol `__) - -0.17.0 (2021-03-26): - - removed because of incomplete classifiers - - this release no longer supports Python 2.7, most if not all Python 2 - specific code is removed. The 0.17.x series is the last to support Python 3.5 - (this also allowed for removal of the dependency on ``ruamel.std.pathlib``) - - remove Python2 specific code branches and adaptations (u-strings) - - prepare % code for f-strings using ``_F`` - - allow PyOxidisation (`issue 324 `__ - resp. `issue 171 `__) - - replaced Python 2 compatible enforcement of keyword arguments with '*' - - the old top level *functions* ``load``, ``safe_load``, ``round_trip_load``, - ``dump``, ``safe_dump``, ``round_trip_dump``, ``scan``, ``parse``, - ``compose``, ``emit``, ``serialize`` as well as their ``_all`` variants for - multi-document streams, now issue a ``PendingDeprecationning`` (e.g. when run - from pytest, but also Python is started with ``-Wd``). Use the methods on - ``YAML()``, which have been extended. - - fix for issue 376: indentation changes could put literal/folded scalar to start - before the ``#`` column of a following comment. Effectively making the comment - part of the scalar in the output. (reported by - `Bence Nagy `__) - - -0.16.13 (2021-03-05): - - fix for issue 359: could not update() CommentedMap with keyword arguments - (reported by `Steve Franchak `__) - - fix for issue 365: unable to dump mutated TimeStamp objects - (reported by Anton Akmerov `__) - - fix for issue 371: unable to addd comment without starting space - (reported by 'Mark Grandi `__) - - fix for issue 373: recursive call to walk_tree not preserving all params - (reported by `eulores `__) - - a None value in a flow-style sequence is now dumped as `null` instead - of `!!null ''` (reported by mcarans on - `StackOverflow `__) - -0.16.12 (2020-09-04): - - update links in doc - -0.16.11 (2020-09-03): - - workaround issue with setuptools 0.50 and importing pip ( fix by jaraco - https://github.com/pypa/setuptools/issues/2355#issuecomment-685159580 ) - -0.16.10 (2020-02-12): - - (auto) updated image references in README to sourceforge - -0.16.9 (2020-02-11): - - update CHANGES - -0.16.8 (2020-02-11): - - update requirements so that ruamel.yaml.clib is installed for 3.8, - as it has become available (via manylinux builds) - -0.16.7 (2020-01-30): - - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) - - fix error in dumping literal scalar in sequence with comments before element - (reported by `EJ Etherington `__) - -0.16.6 (2020-01-20): - - fix empty string mapping key roundtripping with preservation of quotes as `? ''` - (reported via email by Tomer Aharoni). - - fix incorrect state setting in class constructor (reported by `Douglas Raillard - `__) - - adjust deprecation warning test for Hashable, as that no longer warns (reported - by `Jason Montleon `__) - -0.16.5 (2019-08-18): - - allow for ``YAML(typ=['unsafe', 'pytypes'])`` - -0.16.4 (2019-08-16): - - fix output of TAG directives with # (reported by `Thomas Smith - `__) - - -0.16.3 (2019-08-15): - - split construct_object - - change stuff back to keep mypy happy - - move setting of version based on YAML directive to scanner, allowing to - check for file version during TAG directive scanning - -0.16.2 (2019-08-15): - - preserve YAML and TAG directives on roundtrip, correctly output # - in URL for YAML 1.2 (both reported by `Thomas Smith - `__) - -0.16.1 (2019-08-08): - - Force the use of new version of ruamel.yaml.clib (reported by `Alex Joz - `__) - - Allow '#' in tag URI as these are allowed in YAML 1.2 (reported by - `Thomas Smith - `__) - -0.16.0 (2019-07-25): - - split of C source that generates .so file to ruamel.yaml.clib - - duplicate keys are now an error when working with the old API as well - - ----- - -For older changes see the file -`CHANGES `_ - - diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/RECORD b/opensafely/_vendor/ruyaml-0.91.0.dist-info/RECORD deleted file mode 100644 index e65b0e76..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info/RECORD +++ /dev/null @@ -1,37 +0,0 @@ -ruyaml-0.91.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -ruyaml-0.91.0.dist-info/LICENSE,sha256=wjyOB0soSsZk6bvkLuDrECh_0MViEw8Wlpb0UqCqVIU,1121 -ruyaml-0.91.0.dist-info/METADATA,sha256=BANywMqY-zd59bFIKsIlogSaeAJxSp7rW7MpQepgt3k,12855 -ruyaml-0.91.0.dist-info/RECORD,, -ruyaml-0.91.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -ruyaml-0.91.0.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 -ruyaml-0.91.0.dist-info/top_level.txt,sha256=ey66DkV8_AK3o3BlaCKHFeASd8o68IXvV4WnAs9T9JA,7 -ruyaml-0.91.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 -ruyaml/__init__.py,sha256=5NLoeLjKfgTckjQZp8rsHqIf6nLmecYGLmgRIweYzVM,2031 -ruyaml/anchor.py,sha256=ydg6KajeVwK5mWBDLNJ_S3fdSCQjWBs62ml1fNCiFeA,498 -ruyaml/comments.py,sha256=w4LXnnOK7sM6y9Y28iwuVAwvm95ln_MyAr9CMxGPJZE,39511 -ruyaml/compat.py,sha256=5JupCpavKoK4Csx6YgmRa1TFu2sPLxktZ8eVOe6wEVQ,7406 -ruyaml/composer.py,sha256=w15EMl2Z5w1L1p-kSEUE45mjrb62KhDCICs-c3n6AVE,8429 -ruyaml/configobjwalker.py,sha256=FQKRoZw3r_hHW-fG5ICtSsiykVtTk3WAx0v53fnRw0A,332 -ruyaml/constructor.py,sha256=ZtcjyMGXGPushdLbeuaFOZ8K0g_AM7Yw-zm2vwAueZY,72746 -ruyaml/cyaml.py,sha256=a3FaM1rhseXASXzR3EPfpPevhPVxbR5cM_nSRujmPuo,6547 -ruyaml/dumper.py,sha256=9P_6C_4gi7Hcxi12uAt8nNm-KZdSVStFECxawYqUF58,6744 -ruyaml/emitter.py,sha256=goBbONnC-vVdyjZLFKymqrsQKJ-HgZEokFj0z3271q4,67014 -ruyaml/error.py,sha256=bPP6C-Moj-eG43-S4m-4TG71CaShSkVJLEhwv7eQTes,9510 -ruyaml/events.py,sha256=SrFJqZDj_bAbWNd6axX60tZsekavqNYweMlajmfTO9M,5627 -ruyaml/loader.py,sha256=KMZkzg-PCT4rwPVsI6Ab3-Kg8Pj4QxvNUn-Z6gyawFQ,3059 -ruyaml/main.py,sha256=szRcUXHw7vpY-V60sbbt26LKoizn5VgPJrXFHXnMQoM,59643 -ruyaml/nodes.py,sha256=loFkBXzo1NTdvy4Vi9AWRzmfBauuIVeB8gMUIaNUnPo,3886 -ruyaml/parser.py,sha256=Wj9dXgMAlcau6pyR1u3i5MpdX1wZ_y4sHElQH7ehyrY,37181 -ruyaml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -ruyaml/reader.py,sha256=Hvofar6kw1rfhNMdpk--vk7RFkSZkfwPNIUfMhI0u9Y,10851 -ruyaml/representer.py,sha256=RPifzy31E9VuiEhzZB7PhQ4k2fS7FfwX_rGGSWmXHns,44798 -ruyaml/resolver.py,sha256=J6Itc3GEsO1HJsyKQVkq59yVng8WfLdZw5N9gLp-EFo,15968 -ruyaml/scalarbool.py,sha256=6erEWeIoy1Jo2rRR_mEq8Um0pIoECtKmXYzQSMcu5nE,1375 -ruyaml/scalarfloat.py,sha256=7aRsvuNIQ9bT_W8MgKhIY85i8-HV63ySY5cISAs4xlU,4237 -ruyaml/scalarint.py,sha256=kLWD9CiJnmISfglzKEdgE41DK0-oMUBjKk8cmnU4vpo,4360 -ruyaml/scalarstring.py,sha256=SFLtIqdMWGaxr90Z5HUiN1rLzgOKMJlT370NuHDDJiQ,4250 -ruyaml/scanner.py,sha256=EMqs14wqm9QB8bdaevQF1WUOdaolQeJDd_aANF-MPc0,90051 -ruyaml/serializer.py,sha256=NSfPV_Ugy69f46q_3OAF5gIKLw3gW6Jztk4ShkOGOKQ,8698 -ruyaml/timestamp.py,sha256=W8CPgURyy8-cOvHDB7QAOPhHacWMyIQakDOMbjBOKQc,1843 -ruyaml/tokens.py,sha256=qNsotRUWO7OTfDuJ0tiJQzHFjye1Y2MMc9I1japmWzI,12111 -ruyaml/util.py,sha256=NuSXzNleSXXrhiWT4Y-1gGTUi4Er9mpkf2AZ275ESa0,7980 diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/REQUESTED b/opensafely/_vendor/ruyaml-0.91.0.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/WHEEL b/opensafely/_vendor/ruyaml-0.91.0.dist-info/WHEEL deleted file mode 100644 index 5bad85fd..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.37.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/top_level.txt b/opensafely/_vendor/ruyaml-0.91.0.dist-info/top_level.txt deleted file mode 100644 index 88ae0953..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -ruyaml diff --git a/opensafely/_vendor/ruyaml-0.91.0.dist-info/zip-safe b/opensafely/_vendor/ruyaml-0.91.0.dist-info/zip-safe deleted file mode 100644 index 8b137891..00000000 --- a/opensafely/_vendor/ruyaml-0.91.0.dist-info/zip-safe +++ /dev/null @@ -1 +0,0 @@ - diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info.pyi b/opensafely/_vendor/urllib3-1.26.5.dist-info.pyi deleted file mode 100644 index 7a765958..00000000 --- a/opensafely/_vendor/urllib3-1.26.5.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from urllib3-1.26.5.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info/INSTALLER b/opensafely/_vendor/urllib3-1.26.5.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/urllib3-1.26.5.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info/LICENSE.txt b/opensafely/_vendor/urllib3-1.26.5.dist-info/LICENSE.txt deleted file mode 100644 index 429a1767..00000000 --- a/opensafely/_vendor/urllib3-1.26.5.dist-info/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2008-2020 Andrey Petrov and contributors (see CONTRIBUTORS.txt) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info/METADATA b/opensafely/_vendor/urllib3-1.26.5.dist-info/METADATA deleted file mode 100644 index d962c13c..00000000 --- a/opensafely/_vendor/urllib3-1.26.5.dist-info/METADATA +++ /dev/null @@ -1,1376 +0,0 @@ -Metadata-Version: 2.1 -Name: urllib3 -Version: 1.26.5 -Summary: HTTP library with thread-safe connection pooling, file post, and more. -Home-page: https://urllib3.readthedocs.io/ -Author: Andrey Petrov -Author-email: andrey.petrov@shazow.net -License: MIT -Project-URL: Documentation, https://urllib3.readthedocs.io/ -Project-URL: Code, https://github.com/urllib3/urllib3 -Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues -Keywords: urllib httplib threadsafe filepost http https ssl pooling -Platform: UNKNOWN -Classifier: Environment :: Web Environment -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Internet :: WWW/HTTP -Classifier: Topic :: Software Development :: Libraries -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4 -Description-Content-Type: text/x-rst -License-File: LICENSE.txt -Provides-Extra: brotli -Requires-Dist: brotlipy (>=0.6.0) ; extra == 'brotli' -Provides-Extra: secure -Requires-Dist: pyOpenSSL (>=0.14) ; extra == 'secure' -Requires-Dist: cryptography (>=1.3.4) ; extra == 'secure' -Requires-Dist: idna (>=2.0.0) ; extra == 'secure' -Requires-Dist: certifi ; extra == 'secure' -Requires-Dist: ipaddress ; (python_version == "2.7") and extra == 'secure' -Provides-Extra: socks -Requires-Dist: PySocks (!=1.5.7,<2.0,>=1.5.6) ; extra == 'socks' - - -urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the -Python ecosystem already uses urllib3 and you should too. -urllib3 brings many critical features that are missing from the Python -standard libraries: - -- Thread safety. -- Connection pooling. -- Client-side SSL/TLS verification. -- File uploads with multipart encoding. -- Helpers for retrying requests and dealing with HTTP redirects. -- Support for gzip, deflate, and brotli encoding. -- Proxy support for HTTP and SOCKS. -- 100% test coverage. - -urllib3 is powerful and easy to use: - -.. code-block:: python - - >>> import urllib3 - >>> http = urllib3.PoolManager() - >>> r = http.request('GET', 'http://httpbin.org/robots.txt') - >>> r.status - 200 - >>> r.data - 'User-agent: *\nDisallow: /deny\n' - - -Installing ----------- - -urllib3 can be installed with `pip `_:: - - $ python -m pip install urllib3 - -Alternatively, you can grab the latest source code from `GitHub `_:: - - $ git clone git://github.com/urllib3/urllib3.git - $ python setup.py install - - -Documentation -------------- - -urllib3 has usage and reference documentation at `urllib3.readthedocs.io `_. - - -Contributing ------------- - -urllib3 happily accepts contributions. Please see our -`contributing documentation `_ -for some tips on getting started. - - -Security Disclosures --------------------- - -To report a security vulnerability, please use the -`Tidelift security contact `_. -Tidelift will coordinate the fix and disclosure with maintainers. - - -Maintainers ------------ - -- `@sethmlarson `__ (Seth M. Larson) -- `@pquentin `__ (Quentin Pradet) -- `@theacodes `__ (Thea Flowers) -- `@haikuginger `__ (Jess Shapiro) -- `@lukasa `__ (Cory Benfield) -- `@sigmavirus24 `__ (Ian Stapleton Cordasco) -- `@shazow `__ (Andrey Petrov) - -👋 - - -Sponsorship ------------ - -If your company benefits from this library, please consider `sponsoring its -development `_. - - -For Enterprise --------------- - -.. |tideliftlogo| image:: https://nedbatchelder.com/pix/Tidelift_Logos_RGB_Tidelift_Shorthand_On-White_small.png - :width: 75 - :alt: Tidelift - -.. list-table:: - :widths: 10 100 - - * - |tideliftlogo| - - Professional support for urllib3 is available as part of the `Tidelift - Subscription`_. Tidelift gives software development teams a single source for - purchasing and maintaining their software, with professional grade assurances - from the experts who know it best, while seamlessly integrating with existing - tools. - -.. _Tidelift Subscription: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme - - -Changes -======= - -1.26.5 (2021-05-26) -------------------- - -* Fixed deprecation warnings emitted in Python 3.10. -* Updated vendored ``six`` library to 1.16.0. -* Improved performance of URL parser when splitting - the authority component. - - -1.26.4 (2021-03-15) -------------------- - -* Changed behavior of the default ``SSLContext`` when connecting to HTTPS proxy - during HTTPS requests. The default ``SSLContext`` now sets ``check_hostname=True``. - - -1.26.3 (2021-01-26) -------------------- - -* Fixed bytes and string comparison issue with headers (Pull #2141) - -* Changed ``ProxySchemeUnknown`` error message to be - more actionable if the user supplies a proxy URL without - a scheme. (Pull #2107) - - -1.26.2 (2020-11-12) -------------------- - -* Fixed an issue where ``wrap_socket`` and ``CERT_REQUIRED`` wouldn't - be imported properly on Python 2.7.8 and earlier (Pull #2052) - - -1.26.1 (2020-11-11) -------------------- - -* Fixed an issue where two ``User-Agent`` headers would be sent if a - ``User-Agent`` header key is passed as ``bytes`` (Pull #2047) - - -1.26.0 (2020-11-10) -------------------- - -* **NOTE: urllib3 v2.0 will drop support for Python 2**. - `Read more in the v2.0 Roadmap `_. - -* Added support for HTTPS proxies contacting HTTPS servers (Pull #1923, Pull #1806) - -* Deprecated negotiating TLSv1 and TLSv1.1 by default. Users that - still wish to use TLS earlier than 1.2 without a deprecation warning - should opt-in explicitly by setting ``ssl_version=ssl.PROTOCOL_TLSv1_1`` (Pull #2002) - **Starting in urllib3 v2.0: Connections that receive a ``DeprecationWarning`` will fail** - -* Deprecated ``Retry`` options ``Retry.DEFAULT_METHOD_WHITELIST``, ``Retry.DEFAULT_REDIRECT_HEADERS_BLACKLIST`` - and ``Retry(method_whitelist=...)`` in favor of ``Retry.DEFAULT_ALLOWED_METHODS``, - ``Retry.DEFAULT_REMOVE_HEADERS_ON_REDIRECT``, and ``Retry(allowed_methods=...)`` - (Pull #2000) **Starting in urllib3 v2.0: Deprecated options will be removed** - -* Added default ``User-Agent`` header to every request (Pull #1750) - -* Added ``urllib3.util.SKIP_HEADER`` for skipping ``User-Agent``, ``Accept-Encoding``, - and ``Host`` headers from being automatically emitted with requests (Pull #2018) - -* Collapse ``transfer-encoding: chunked`` request data and framing into - the same ``socket.send()`` call (Pull #1906) - -* Send ``http/1.1`` ALPN identifier with every TLS handshake by default (Pull #1894) - -* Properly terminate SecureTransport connections when CA verification fails (Pull #1977) - -* Don't emit an ``SNIMissingWarning`` when passing ``server_hostname=None`` - to SecureTransport (Pull #1903) - -* Disabled requesting TLSv1.2 session tickets as they weren't being used by urllib3 (Pull #1970) - -* Suppress ``BrokenPipeError`` when writing request body after the server - has closed the socket (Pull #1524) - -* Wrap ``ssl.SSLError`` that can be raised from reading a socket (e.g. "bad MAC") - into an ``urllib3.exceptions.SSLError`` (Pull #1939) - - -1.25.11 (2020-10-19) --------------------- - -* Fix retry backoff time parsed from ``Retry-After`` header when given - in the HTTP date format. The HTTP date was parsed as the local timezone - rather than accounting for the timezone in the HTTP date (typically - UTC) (Pull #1932, Pull #1935, Pull #1938, Pull #1949) - -* Fix issue where an error would be raised when the ``SSLKEYLOGFILE`` - environment variable was set to the empty string. Now ``SSLContext.keylog_file`` - is not set in this situation (Pull #2016) - - -1.25.10 (2020-07-22) --------------------- - -* Added support for ``SSLKEYLOGFILE`` environment variable for - logging TLS session keys with use with programs like - Wireshark for decrypting captured web traffic (Pull #1867) - -* Fixed loading of SecureTransport libraries on macOS Big Sur - due to the new dynamic linker cache (Pull #1905) - -* Collapse chunked request bodies data and framing into one - call to ``send()`` to reduce the number of TCP packets by 2-4x (Pull #1906) - -* Don't insert ``None`` into ``ConnectionPool`` if the pool - was empty when requesting a connection (Pull #1866) - -* Avoid ``hasattr`` call in ``BrotliDecoder.decompress()`` (Pull #1858) - - -1.25.9 (2020-04-16) -------------------- - -* Added ``InvalidProxyConfigurationWarning`` which is raised when - erroneously specifying an HTTPS proxy URL. urllib3 doesn't currently - support connecting to HTTPS proxies but will soon be able to - and we would like users to migrate properly without much breakage. - - See `this GitHub issue `_ - for more information on how to fix your proxy config. (Pull #1851) - -* Drain connection after ``PoolManager`` redirect (Pull #1817) - -* Ensure ``load_verify_locations`` raises ``SSLError`` for all backends (Pull #1812) - -* Rename ``VerifiedHTTPSConnection`` to ``HTTPSConnection`` (Pull #1805) - -* Allow the CA certificate data to be passed as a string (Pull #1804) - -* Raise ``ValueError`` if method contains control characters (Pull #1800) - -* Add ``__repr__`` to ``Timeout`` (Pull #1795) - - -1.25.8 (2020-01-20) -------------------- - -* Drop support for EOL Python 3.4 (Pull #1774) - -* Optimize _encode_invalid_chars (Pull #1787) - - -1.25.7 (2019-11-11) -------------------- - -* Preserve ``chunked`` parameter on retries (Pull #1715, Pull #1734) - -* Allow unset ``SERVER_SOFTWARE`` in App Engine (Pull #1704, Issue #1470) - -* Fix issue where URL fragment was sent within the request target. (Pull #1732) - -* Fix issue where an empty query section in a URL would fail to parse. (Pull #1732) - -* Remove TLS 1.3 support in SecureTransport due to Apple removing support (Pull #1703) - - -1.25.6 (2019-09-24) -------------------- - -* Fix issue where tilde (``~``) characters were incorrectly - percent-encoded in the path. (Pull #1692) - - -1.25.5 (2019-09-19) -------------------- - -* Add mitigation for BPO-37428 affecting Python <3.7.4 and OpenSSL 1.1.1+ which - caused certificate verification to be enabled when using ``cert_reqs=CERT_NONE``. - (Issue #1682) - - -1.25.4 (2019-09-19) -------------------- - -* Propagate Retry-After header settings to subsequent retries. (Pull #1607) - -* Fix edge case where Retry-After header was still respected even when - explicitly opted out of. (Pull #1607) - -* Remove dependency on ``rfc3986`` for URL parsing. - -* Fix issue where URLs containing invalid characters within ``Url.auth`` would - raise an exception instead of percent-encoding those characters. - -* Add support for ``HTTPResponse.auto_close = False`` which makes HTTP responses - work well with BufferedReaders and other ``io`` module features. (Pull #1652) - -* Percent-encode invalid characters in URL for ``HTTPConnectionPool.request()`` (Pull #1673) - - -1.25.3 (2019-05-23) -------------------- - -* Change ``HTTPSConnection`` to load system CA certificates - when ``ca_certs``, ``ca_cert_dir``, and ``ssl_context`` are - unspecified. (Pull #1608, Issue #1603) - -* Upgrade bundled rfc3986 to v1.3.2. (Pull #1609, Issue #1605) - - -1.25.2 (2019-04-28) -------------------- - -* Change ``is_ipaddress`` to not detect IPvFuture addresses. (Pull #1583) - -* Change ``parse_url`` to percent-encode invalid characters within the - path, query, and target components. (Pull #1586) - - -1.25.1 (2019-04-24) -------------------- - -* Add support for Google's ``Brotli`` package. (Pull #1572, Pull #1579) - -* Upgrade bundled rfc3986 to v1.3.1 (Pull #1578) - - -1.25 (2019-04-22) ------------------ - -* Require and validate certificates by default when using HTTPS (Pull #1507) - -* Upgraded ``urllib3.utils.parse_url()`` to be RFC 3986 compliant. (Pull #1487) - -* Added support for ``key_password`` for ``HTTPSConnectionPool`` to use - encrypted ``key_file`` without creating your own ``SSLContext`` object. (Pull #1489) - -* Add TLSv1.3 support to CPython, pyOpenSSL, and SecureTransport ``SSLContext`` - implementations. (Pull #1496) - -* Switched the default multipart header encoder from RFC 2231 to HTML 5 working draft. (Issue #303, Pull #1492) - -* Fixed issue where OpenSSL would block if an encrypted client private key was - given and no password was given. Instead an ``SSLError`` is raised. (Pull #1489) - -* Added support for Brotli content encoding. It is enabled automatically if - ``brotlipy`` package is installed which can be requested with - ``urllib3[brotli]`` extra. (Pull #1532) - -* Drop ciphers using DSS key exchange from default TLS cipher suites. - Improve default ciphers when using SecureTransport. (Pull #1496) - -* Implemented a more efficient ``HTTPResponse.__iter__()`` method. (Issue #1483) - -1.24.3 (2019-05-01) -------------------- - -* Apply fix for CVE-2019-9740. (Pull #1591) - -1.24.2 (2019-04-17) -------------------- - -* Don't load system certificates by default when any other ``ca_certs``, ``ca_certs_dir`` or - ``ssl_context`` parameters are specified. - -* Remove Authorization header regardless of case when redirecting to cross-site. (Issue #1510) - -* Add support for IPv6 addresses in subjectAltName section of certificates. (Issue #1269) - - -1.24.1 (2018-11-02) -------------------- - -* Remove quadratic behavior within ``GzipDecoder.decompress()`` (Issue #1467) - -* Restored functionality of ``ciphers`` parameter for ``create_urllib3_context()``. (Issue #1462) - - -1.24 (2018-10-16) ------------------ - -* Allow key_server_hostname to be specified when initializing a PoolManager to allow custom SNI to be overridden. (Pull #1449) - -* Test against Python 3.7 on AppVeyor. (Pull #1453) - -* Early-out ipv6 checks when running on App Engine. (Pull #1450) - -* Change ambiguous description of backoff_factor (Pull #1436) - -* Add ability to handle multiple Content-Encodings (Issue #1441 and Pull #1442) - -* Skip DNS names that can't be idna-decoded when using pyOpenSSL (Issue #1405). - -* Add a server_hostname parameter to HTTPSConnection which allows for - overriding the SNI hostname sent in the handshake. (Pull #1397) - -* Drop support for EOL Python 2.6 (Pull #1429 and Pull #1430) - -* Fixed bug where responses with header Content-Type: message/* erroneously - raised HeaderParsingError, resulting in a warning being logged. (Pull #1439) - -* Move urllib3 to src/urllib3 (Pull #1409) - - -1.23 (2018-06-04) ------------------ - -* Allow providing a list of headers to strip from requests when redirecting - to a different host. Defaults to the ``Authorization`` header. Different - headers can be set via ``Retry.remove_headers_on_redirect``. (Issue #1316) - -* Fix ``util.selectors._fileobj_to_fd`` to accept ``long`` (Issue #1247). - -* Dropped Python 3.3 support. (Pull #1242) - -* Put the connection back in the pool when calling stream() or read_chunked() on - a chunked HEAD response. (Issue #1234) - -* Fixed pyOpenSSL-specific ssl client authentication issue when clients - attempted to auth via certificate + chain (Issue #1060) - -* Add the port to the connectionpool connect print (Pull #1251) - -* Don't use the ``uuid`` module to create multipart data boundaries. (Pull #1380) - -* ``read_chunked()`` on a closed response returns no chunks. (Issue #1088) - -* Add Python 2.6 support to ``contrib.securetransport`` (Pull #1359) - -* Added support for auth info in url for SOCKS proxy (Pull #1363) - - -1.22 (2017-07-20) ------------------ - -* Fixed missing brackets in ``HTTP CONNECT`` when connecting to IPv6 address via - IPv6 proxy. (Issue #1222) - -* Made the connection pool retry on ``SSLError``. The original ``SSLError`` - is available on ``MaxRetryError.reason``. (Issue #1112) - -* Drain and release connection before recursing on retry/redirect. Fixes - deadlocks with a blocking connectionpool. (Issue #1167) - -* Fixed compatibility for cookiejar. (Issue #1229) - -* pyopenssl: Use vendored version of ``six``. (Issue #1231) - - -1.21.1 (2017-05-02) -------------------- - -* Fixed SecureTransport issue that would cause long delays in response body - delivery. (Pull #1154) - -* Fixed regression in 1.21 that threw exceptions when users passed the - ``socket_options`` flag to the ``PoolManager``. (Issue #1165) - -* Fixed regression in 1.21 that threw exceptions when users passed the - ``assert_hostname`` or ``assert_fingerprint`` flag to the ``PoolManager``. - (Pull #1157) - - -1.21 (2017-04-25) ------------------ - -* Improved performance of certain selector system calls on Python 3.5 and - later. (Pull #1095) - -* Resolved issue where the PyOpenSSL backend would not wrap SysCallError - exceptions appropriately when sending data. (Pull #1125) - -* Selectors now detects a monkey-patched select module after import for modules - that patch the select module like eventlet, greenlet. (Pull #1128) - -* Reduced memory consumption when streaming zlib-compressed responses - (as opposed to raw deflate streams). (Pull #1129) - -* Connection pools now use the entire request context when constructing the - pool key. (Pull #1016) - -* ``PoolManager.connection_from_*`` methods now accept a new keyword argument, - ``pool_kwargs``, which are merged with the existing ``connection_pool_kw``. - (Pull #1016) - -* Add retry counter for ``status_forcelist``. (Issue #1147) - -* Added ``contrib`` module for using SecureTransport on macOS: - ``urllib3.contrib.securetransport``. (Pull #1122) - -* urllib3 now only normalizes the case of ``http://`` and ``https://`` schemes: - for schemes it does not recognise, it assumes they are case-sensitive and - leaves them unchanged. - (Issue #1080) - - -1.20 (2017-01-19) ------------------ - -* Added support for waiting for I/O using selectors other than select, - improving urllib3's behaviour with large numbers of concurrent connections. - (Pull #1001) - -* Updated the date for the system clock check. (Issue #1005) - -* ConnectionPools now correctly consider hostnames to be case-insensitive. - (Issue #1032) - -* Outdated versions of PyOpenSSL now cause the PyOpenSSL contrib module - to fail when it is injected, rather than at first use. (Pull #1063) - -* Outdated versions of cryptography now cause the PyOpenSSL contrib module - to fail when it is injected, rather than at first use. (Issue #1044) - -* Automatically attempt to rewind a file-like body object when a request is - retried or redirected. (Pull #1039) - -* Fix some bugs that occur when modules incautiously patch the queue module. - (Pull #1061) - -* Prevent retries from occurring on read timeouts for which the request method - was not in the method whitelist. (Issue #1059) - -* Changed the PyOpenSSL contrib module to lazily load idna to avoid - unnecessarily bloating the memory of programs that don't need it. (Pull - #1076) - -* Add support for IPv6 literals with zone identifiers. (Pull #1013) - -* Added support for socks5h:// and socks4a:// schemes when working with SOCKS - proxies, and controlled remote DNS appropriately. (Issue #1035) - - -1.19.1 (2016-11-16) -------------------- - -* Fixed AppEngine import that didn't function on Python 3.5. (Pull #1025) - - -1.19 (2016-11-03) ------------------ - -* urllib3 now respects Retry-After headers on 413, 429, and 503 responses when - using the default retry logic. (Pull #955) - -* Remove markers from setup.py to assist ancient setuptools versions. (Issue - #986) - -* Disallow superscripts and other integerish things in URL ports. (Issue #989) - -* Allow urllib3's HTTPResponse.stream() method to continue to work with - non-httplib underlying FPs. (Pull #990) - -* Empty filenames in multipart headers are now emitted as such, rather than - being suppressed. (Issue #1015) - -* Prefer user-supplied Host headers on chunked uploads. (Issue #1009) - - -1.18.1 (2016-10-27) -------------------- - -* CVE-2016-9015. Users who are using urllib3 version 1.17 or 1.18 along with - PyOpenSSL injection and OpenSSL 1.1.0 *must* upgrade to this version. This - release fixes a vulnerability whereby urllib3 in the above configuration - would silently fail to validate TLS certificates due to erroneously setting - invalid flags in OpenSSL's ``SSL_CTX_set_verify`` function. These erroneous - flags do not cause a problem in OpenSSL versions before 1.1.0, which - interprets the presence of any flag as requesting certificate validation. - - There is no PR for this patch, as it was prepared for simultaneous disclosure - and release. The master branch received the same fix in Pull #1010. - - -1.18 (2016-09-26) ------------------ - -* Fixed incorrect message for IncompleteRead exception. (Pull #973) - -* Accept ``iPAddress`` subject alternative name fields in TLS certificates. - (Issue #258) - -* Fixed consistency of ``HTTPResponse.closed`` between Python 2 and 3. - (Issue #977) - -* Fixed handling of wildcard certificates when using PyOpenSSL. (Issue #979) - - -1.17 (2016-09-06) ------------------ - -* Accept ``SSLContext`` objects for use in SSL/TLS negotiation. (Issue #835) - -* ConnectionPool debug log now includes scheme, host, and port. (Issue #897) - -* Substantially refactored documentation. (Issue #887) - -* Used URLFetch default timeout on AppEngine, rather than hardcoding our own. - (Issue #858) - -* Normalize the scheme and host in the URL parser (Issue #833) - -* ``HTTPResponse`` contains the last ``Retry`` object, which now also - contains retries history. (Issue #848) - -* Timeout can no longer be set as boolean, and must be greater than zero. - (Pull #924) - -* Removed pyasn1 and ndg-httpsclient from dependencies used for PyOpenSSL. We - now use cryptography and idna, both of which are already dependencies of - PyOpenSSL. (Pull #930) - -* Fixed infinite loop in ``stream`` when amt=None. (Issue #928) - -* Try to use the operating system's certificates when we are using an - ``SSLContext``. (Pull #941) - -* Updated cipher suite list to allow ChaCha20+Poly1305. AES-GCM is preferred to - ChaCha20, but ChaCha20 is then preferred to everything else. (Pull #947) - -* Updated cipher suite list to remove 3DES-based cipher suites. (Pull #958) - -* Removed the cipher suite fallback to allow HIGH ciphers. (Pull #958) - -* Implemented ``length_remaining`` to determine remaining content - to be read. (Pull #949) - -* Implemented ``enforce_content_length`` to enable exceptions when - incomplete data chunks are received. (Pull #949) - -* Dropped connection start, dropped connection reset, redirect, forced retry, - and new HTTPS connection log levels to DEBUG, from INFO. (Pull #967) - - -1.16 (2016-06-11) ------------------ - -* Disable IPv6 DNS when IPv6 connections are not possible. (Issue #840) - -* Provide ``key_fn_by_scheme`` pool keying mechanism that can be - overridden. (Issue #830) - -* Normalize scheme and host to lowercase for pool keys, and include - ``source_address``. (Issue #830) - -* Cleaner exception chain in Python 3 for ``_make_request``. - (Issue #861) - -* Fixed installing ``urllib3[socks]`` extra. (Issue #864) - -* Fixed signature of ``ConnectionPool.close`` so it can actually safely be - called by subclasses. (Issue #873) - -* Retain ``release_conn`` state across retries. (Issues #651, #866) - -* Add customizable ``HTTPConnectionPool.ResponseCls``, which defaults to - ``HTTPResponse`` but can be replaced with a subclass. (Issue #879) - - -1.15.1 (2016-04-11) -------------------- - -* Fix packaging to include backports module. (Issue #841) - - -1.15 (2016-04-06) ------------------ - -* Added Retry(raise_on_status=False). (Issue #720) - -* Always use setuptools, no more distutils fallback. (Issue #785) - -* Dropped support for Python 3.2. (Issue #786) - -* Chunked transfer encoding when requesting with ``chunked=True``. - (Issue #790) - -* Fixed regression with IPv6 port parsing. (Issue #801) - -* Append SNIMissingWarning messages to allow users to specify it in - the PYTHONWARNINGS environment variable. (Issue #816) - -* Handle unicode headers in Py2. (Issue #818) - -* Log certificate when there is a hostname mismatch. (Issue #820) - -* Preserve order of request/response headers. (Issue #821) - - -1.14 (2015-12-29) ------------------ - -* contrib: SOCKS proxy support! (Issue #762) - -* Fixed AppEngine handling of transfer-encoding header and bug - in Timeout defaults checking. (Issue #763) - - -1.13.1 (2015-12-18) -------------------- - -* Fixed regression in IPv6 + SSL for match_hostname. (Issue #761) - - -1.13 (2015-12-14) ------------------ - -* Fixed ``pip install urllib3[secure]`` on modern pip. (Issue #706) - -* pyopenssl: Fixed SSL3_WRITE_PENDING error. (Issue #717) - -* pyopenssl: Support for TLSv1.1 and TLSv1.2. (Issue #696) - -* Close connections more defensively on exception. (Issue #734) - -* Adjusted ``read_chunked`` to handle gzipped, chunk-encoded bodies without - repeatedly flushing the decoder, to function better on Jython. (Issue #743) - -* Accept ``ca_cert_dir`` for SSL-related PoolManager configuration. (Issue #758) - - -1.12 (2015-09-03) ------------------ - -* Rely on ``six`` for importing ``httplib`` to work around - conflicts with other Python 3 shims. (Issue #688) - -* Add support for directories of certificate authorities, as supported by - OpenSSL. (Issue #701) - -* New exception: ``NewConnectionError``, raised when we fail to establish - a new connection, usually ``ECONNREFUSED`` socket error. - - -1.11 (2015-07-21) ------------------ - -* When ``ca_certs`` is given, ``cert_reqs`` defaults to - ``'CERT_REQUIRED'``. (Issue #650) - -* ``pip install urllib3[secure]`` will install Certifi and - PyOpenSSL as dependencies. (Issue #678) - -* Made ``HTTPHeaderDict`` usable as a ``headers`` input value - (Issues #632, #679) - -* Added `urllib3.contrib.appengine `_ - which has an ``AppEngineManager`` for using ``URLFetch`` in a - Google AppEngine environment. (Issue #664) - -* Dev: Added test suite for AppEngine. (Issue #631) - -* Fix performance regression when using PyOpenSSL. (Issue #626) - -* Passing incorrect scheme (e.g. ``foo://``) will raise - ``ValueError`` instead of ``AssertionError`` (backwards - compatible for now, but please migrate). (Issue #640) - -* Fix pools not getting replenished when an error occurs during a - request using ``release_conn=False``. (Issue #644) - -* Fix pool-default headers not applying for url-encoded requests - like GET. (Issue #657) - -* log.warning in Python 3 when headers are skipped due to parsing - errors. (Issue #642) - -* Close and discard connections if an error occurs during read. - (Issue #660) - -* Fix host parsing for IPv6 proxies. (Issue #668) - -* Separate warning type SubjectAltNameWarning, now issued once - per host. (Issue #671) - -* Fix ``httplib.IncompleteRead`` not getting converted to - ``ProtocolError`` when using ``HTTPResponse.stream()`` - (Issue #674) - -1.10.4 (2015-05-03) -------------------- - -* Migrate tests to Tornado 4. (Issue #594) - -* Append default warning configuration rather than overwrite. - (Issue #603) - -* Fix streaming decoding regression. (Issue #595) - -* Fix chunked requests losing state across keep-alive connections. - (Issue #599) - -* Fix hanging when chunked HEAD response has no body. (Issue #605) - - -1.10.3 (2015-04-21) -------------------- - -* Emit ``InsecurePlatformWarning`` when SSLContext object is missing. - (Issue #558) - -* Fix regression of duplicate header keys being discarded. - (Issue #563) - -* ``Response.stream()`` returns a generator for chunked responses. - (Issue #560) - -* Set upper-bound timeout when waiting for a socket in PyOpenSSL. - (Issue #585) - -* Work on platforms without `ssl` module for plain HTTP requests. - (Issue #587) - -* Stop relying on the stdlib's default cipher list. (Issue #588) - - -1.10.2 (2015-02-25) -------------------- - -* Fix file descriptor leakage on retries. (Issue #548) - -* Removed RC4 from default cipher list. (Issue #551) - -* Header performance improvements. (Issue #544) - -* Fix PoolManager not obeying redirect retry settings. (Issue #553) - - -1.10.1 (2015-02-10) -------------------- - -* Pools can be used as context managers. (Issue #545) - -* Don't re-use connections which experienced an SSLError. (Issue #529) - -* Don't fail when gzip decoding an empty stream. (Issue #535) - -* Add sha256 support for fingerprint verification. (Issue #540) - -* Fixed handling of header values containing commas. (Issue #533) - - -1.10 (2014-12-14) ------------------ - -* Disabled SSLv3. (Issue #473) - -* Add ``Url.url`` property to return the composed url string. (Issue #394) - -* Fixed PyOpenSSL + gevent ``WantWriteError``. (Issue #412) - -* ``MaxRetryError.reason`` will always be an exception, not string. - (Issue #481) - -* Fixed SSL-related timeouts not being detected as timeouts. (Issue #492) - -* Py3: Use ``ssl.create_default_context()`` when available. (Issue #473) - -* Emit ``InsecureRequestWarning`` for *every* insecure HTTPS request. - (Issue #496) - -* Emit ``SecurityWarning`` when certificate has no ``subjectAltName``. - (Issue #499) - -* Close and discard sockets which experienced SSL-related errors. - (Issue #501) - -* Handle ``body`` param in ``.request(...)``. (Issue #513) - -* Respect timeout with HTTPS proxy. (Issue #505) - -* PyOpenSSL: Handle ZeroReturnError exception. (Issue #520) - - -1.9.1 (2014-09-13) ------------------- - -* Apply socket arguments before binding. (Issue #427) - -* More careful checks if fp-like object is closed. (Issue #435) - -* Fixed packaging issues of some development-related files not - getting included. (Issue #440) - -* Allow performing *only* fingerprint verification. (Issue #444) - -* Emit ``SecurityWarning`` if system clock is waaay off. (Issue #445) - -* Fixed PyOpenSSL compatibility with PyPy. (Issue #450) - -* Fixed ``BrokenPipeError`` and ``ConnectionError`` handling in Py3. - (Issue #443) - - - -1.9 (2014-07-04) ----------------- - -* Shuffled around development-related files. If you're maintaining a distro - package of urllib3, you may need to tweak things. (Issue #415) - -* Unverified HTTPS requests will trigger a warning on the first request. See - our new `security documentation - `_ for details. - (Issue #426) - -* New retry logic and ``urllib3.util.retry.Retry`` configuration object. - (Issue #326) - -* All raised exceptions should now wrapped in a - ``urllib3.exceptions.HTTPException``-extending exception. (Issue #326) - -* All errors during a retry-enabled request should be wrapped in - ``urllib3.exceptions.MaxRetryError``, including timeout-related exceptions - which were previously exempt. Underlying error is accessible from the - ``.reason`` property. (Issue #326) - -* ``urllib3.exceptions.ConnectionError`` renamed to - ``urllib3.exceptions.ProtocolError``. (Issue #326) - -* Errors during response read (such as IncompleteRead) are now wrapped in - ``urllib3.exceptions.ProtocolError``. (Issue #418) - -* Requesting an empty host will raise ``urllib3.exceptions.LocationValueError``. - (Issue #417) - -* Catch read timeouts over SSL connections as - ``urllib3.exceptions.ReadTimeoutError``. (Issue #419) - -* Apply socket arguments before connecting. (Issue #427) - - -1.8.3 (2014-06-23) ------------------- - -* Fix TLS verification when using a proxy in Python 3.4.1. (Issue #385) - -* Add ``disable_cache`` option to ``urllib3.util.make_headers``. (Issue #393) - -* Wrap ``socket.timeout`` exception with - ``urllib3.exceptions.ReadTimeoutError``. (Issue #399) - -* Fixed proxy-related bug where connections were being reused incorrectly. - (Issues #366, #369) - -* Added ``socket_options`` keyword parameter which allows to define - ``setsockopt`` configuration of new sockets. (Issue #397) - -* Removed ``HTTPConnection.tcp_nodelay`` in favor of - ``HTTPConnection.default_socket_options``. (Issue #397) - -* Fixed ``TypeError`` bug in Python 2.6.4. (Issue #411) - - -1.8.2 (2014-04-17) ------------------- - -* Fix ``urllib3.util`` not being included in the package. - - -1.8.1 (2014-04-17) ------------------- - -* Fix AppEngine bug of HTTPS requests going out as HTTP. (Issue #356) - -* Don't install ``dummyserver`` into ``site-packages`` as it's only needed - for the test suite. (Issue #362) - -* Added support for specifying ``source_address``. (Issue #352) - - -1.8 (2014-03-04) ----------------- - -* Improved url parsing in ``urllib3.util.parse_url`` (properly parse '@' in - username, and blank ports like 'hostname:'). - -* New ``urllib3.connection`` module which contains all the HTTPConnection - objects. - -* Several ``urllib3.util.Timeout``-related fixes. Also changed constructor - signature to a more sensible order. [Backwards incompatible] - (Issues #252, #262, #263) - -* Use ``backports.ssl_match_hostname`` if it's installed. (Issue #274) - -* Added ``.tell()`` method to ``urllib3.response.HTTPResponse`` which - returns the number of bytes read so far. (Issue #277) - -* Support for platforms without threading. (Issue #289) - -* Expand default-port comparison in ``HTTPConnectionPool.is_same_host`` - to allow a pool with no specified port to be considered equal to to an - HTTP/HTTPS url with port 80/443 explicitly provided. (Issue #305) - -* Improved default SSL/TLS settings to avoid vulnerabilities. - (Issue #309) - -* Fixed ``urllib3.poolmanager.ProxyManager`` not retrying on connect errors. - (Issue #310) - -* Disable Nagle's Algorithm on the socket for non-proxies. A subset of requests - will send the entire HTTP request ~200 milliseconds faster; however, some of - the resulting TCP packets will be smaller. (Issue #254) - -* Increased maximum number of SubjectAltNames in ``urllib3.contrib.pyopenssl`` - from the default 64 to 1024 in a single certificate. (Issue #318) - -* Headers are now passed and stored as a custom - ``urllib3.collections_.HTTPHeaderDict`` object rather than a plain ``dict``. - (Issue #329, #333) - -* Headers no longer lose their case on Python 3. (Issue #236) - -* ``urllib3.contrib.pyopenssl`` now uses the operating system's default CA - certificates on inject. (Issue #332) - -* Requests with ``retries=False`` will immediately raise any exceptions without - wrapping them in ``MaxRetryError``. (Issue #348) - -* Fixed open socket leak with SSL-related failures. (Issue #344, #348) - - -1.7.1 (2013-09-25) ------------------- - -* Added granular timeout support with new ``urllib3.util.Timeout`` class. - (Issue #231) - -* Fixed Python 3.4 support. (Issue #238) - - -1.7 (2013-08-14) ----------------- - -* More exceptions are now pickle-able, with tests. (Issue #174) - -* Fixed redirecting with relative URLs in Location header. (Issue #178) - -* Support for relative urls in ``Location: ...`` header. (Issue #179) - -* ``urllib3.response.HTTPResponse`` now inherits from ``io.IOBase`` for bonus - file-like functionality. (Issue #187) - -* Passing ``assert_hostname=False`` when creating a HTTPSConnectionPool will - skip hostname verification for SSL connections. (Issue #194) - -* New method ``urllib3.response.HTTPResponse.stream(...)`` which acts as a - generator wrapped around ``.read(...)``. (Issue #198) - -* IPv6 url parsing enforces brackets around the hostname. (Issue #199) - -* Fixed thread race condition in - ``urllib3.poolmanager.PoolManager.connection_from_host(...)`` (Issue #204) - -* ``ProxyManager`` requests now include non-default port in ``Host: ...`` - header. (Issue #217) - -* Added HTTPS proxy support in ``ProxyManager``. (Issue #170 #139) - -* New ``RequestField`` object can be passed to the ``fields=...`` param which - can specify headers. (Issue #220) - -* Raise ``urllib3.exceptions.ProxyError`` when connecting to proxy fails. - (Issue #221) - -* Use international headers when posting file names. (Issue #119) - -* Improved IPv6 support. (Issue #203) - - -1.6 (2013-04-25) ----------------- - -* Contrib: Optional SNI support for Py2 using PyOpenSSL. (Issue #156) - -* ``ProxyManager`` automatically adds ``Host: ...`` header if not given. - -* Improved SSL-related code. ``cert_req`` now optionally takes a string like - "REQUIRED" or "NONE". Same with ``ssl_version`` takes strings like "SSLv23" - The string values reflect the suffix of the respective constant variable. - (Issue #130) - -* Vendored ``socksipy`` now based on Anorov's fork which handles unexpectedly - closed proxy connections and larger read buffers. (Issue #135) - -* Ensure the connection is closed if no data is received, fixes connection leak - on some platforms. (Issue #133) - -* Added SNI support for SSL/TLS connections on Py32+. (Issue #89) - -* Tests fixed to be compatible with Py26 again. (Issue #125) - -* Added ability to choose SSL version by passing an ``ssl.PROTOCOL_*`` constant - to the ``ssl_version`` parameter of ``HTTPSConnectionPool``. (Issue #109) - -* Allow an explicit content type to be specified when encoding file fields. - (Issue #126) - -* Exceptions are now pickleable, with tests. (Issue #101) - -* Fixed default headers not getting passed in some cases. (Issue #99) - -* Treat "content-encoding" header value as case-insensitive, per RFC 2616 - Section 3.5. (Issue #110) - -* "Connection Refused" SocketErrors will get retried rather than raised. - (Issue #92) - -* Updated vendored ``six``, no longer overrides the global ``six`` module - namespace. (Issue #113) - -* ``urllib3.exceptions.MaxRetryError`` contains a ``reason`` property holding - the exception that prompted the final retry. If ``reason is None`` then it - was due to a redirect. (Issue #92, #114) - -* Fixed ``PoolManager.urlopen()`` from not redirecting more than once. - (Issue #149) - -* Don't assume ``Content-Type: text/plain`` for multi-part encoding parameters - that are not files. (Issue #111) - -* Pass `strict` param down to ``httplib.HTTPConnection``. (Issue #122) - -* Added mechanism to verify SSL certificates by fingerprint (md5, sha1) or - against an arbitrary hostname (when connecting by IP or for misconfigured - servers). (Issue #140) - -* Streaming decompression support. (Issue #159) - - -1.5 (2012-08-02) ----------------- - -* Added ``urllib3.add_stderr_logger()`` for quickly enabling STDERR debug - logging in urllib3. - -* Native full URL parsing (including auth, path, query, fragment) available in - ``urllib3.util.parse_url(url)``. - -* Built-in redirect will switch method to 'GET' if status code is 303. - (Issue #11) - -* ``urllib3.PoolManager`` strips the scheme and host before sending the request - uri. (Issue #8) - -* New ``urllib3.exceptions.DecodeError`` exception for when automatic decoding, - based on the Content-Type header, fails. - -* Fixed bug with pool depletion and leaking connections (Issue #76). Added - explicit connection closing on pool eviction. Added - ``urllib3.PoolManager.clear()``. - -* 99% -> 100% unit test coverage. - - -1.4 (2012-06-16) ----------------- - -* Minor AppEngine-related fixes. - -* Switched from ``mimetools.choose_boundary`` to ``uuid.uuid4()``. - -* Improved url parsing. (Issue #73) - -* IPv6 url support. (Issue #72) - - -1.3 (2012-03-25) ----------------- - -* Removed pre-1.0 deprecated API. - -* Refactored helpers into a ``urllib3.util`` submodule. - -* Fixed multipart encoding to support list-of-tuples for keys with multiple - values. (Issue #48) - -* Fixed multiple Set-Cookie headers in response not getting merged properly in - Python 3. (Issue #53) - -* AppEngine support with Py27. (Issue #61) - -* Minor ``encode_multipart_formdata`` fixes related to Python 3 strings vs - bytes. - - -1.2.2 (2012-02-06) ------------------- - -* Fixed packaging bug of not shipping ``test-requirements.txt``. (Issue #47) - - -1.2.1 (2012-02-05) ------------------- - -* Fixed another bug related to when ``ssl`` module is not available. (Issue #41) - -* Location parsing errors now raise ``urllib3.exceptions.LocationParseError`` - which inherits from ``ValueError``. - - -1.2 (2012-01-29) ----------------- - -* Added Python 3 support (tested on 3.2.2) - -* Dropped Python 2.5 support (tested on 2.6.7, 2.7.2) - -* Use ``select.poll`` instead of ``select.select`` for platforms that support - it. - -* Use ``Queue.LifoQueue`` instead of ``Queue.Queue`` for more aggressive - connection reusing. Configurable by overriding ``ConnectionPool.QueueCls``. - -* Fixed ``ImportError`` during install when ``ssl`` module is not available. - (Issue #41) - -* Fixed ``PoolManager`` redirects between schemes (such as HTTP -> HTTPS) not - completing properly. (Issue #28, uncovered by Issue #10 in v1.1) - -* Ported ``dummyserver`` to use ``tornado`` instead of ``webob`` + - ``eventlet``. Removed extraneous unsupported dummyserver testing backends. - Added socket-level tests. - -* More tests. Achievement Unlocked: 99% Coverage. - - -1.1 (2012-01-07) ----------------- - -* Refactored ``dummyserver`` to its own root namespace module (used for - testing). - -* Added hostname verification for ``VerifiedHTTPSConnection`` by vendoring in - Py32's ``ssl_match_hostname``. (Issue #25) - -* Fixed cross-host HTTP redirects when using ``PoolManager``. (Issue #10) - -* Fixed ``decode_content`` being ignored when set through ``urlopen``. (Issue - #27) - -* Fixed timeout-related bugs. (Issues #17, #23) - - -1.0.2 (2011-11-04) ------------------- - -* Fixed typo in ``VerifiedHTTPSConnection`` which would only present as a bug if - you're using the object manually. (Thanks pyos) - -* Made RecentlyUsedContainer (and consequently PoolManager) more thread-safe by - wrapping the access log in a mutex. (Thanks @christer) - -* Made RecentlyUsedContainer more dict-like (corrected ``__delitem__`` and - ``__getitem__`` behaviour), with tests. Shouldn't affect core urllib3 code. - - -1.0.1 (2011-10-10) ------------------- - -* Fixed a bug where the same connection would get returned into the pool twice, - causing extraneous "HttpConnectionPool is full" log warnings. - - -1.0 (2011-10-08) ----------------- - -* Added ``PoolManager`` with LRU expiration of connections (tested and - documented). -* Added ``ProxyManager`` (needs tests, docs, and confirmation that it works - with HTTPS proxies). -* Added optional partial-read support for responses when - ``preload_content=False``. You can now make requests and just read the headers - without loading the content. -* Made response decoding optional (default on, same as before). -* Added optional explicit boundary string for ``encode_multipart_formdata``. -* Convenience request methods are now inherited from ``RequestMethods``. Old - helpers like ``get_url`` and ``post_url`` should be abandoned in favour of - the new ``request(method, url, ...)``. -* Refactored code to be even more decoupled, reusable, and extendable. -* License header added to ``.py`` files. -* Embiggened the documentation: Lots of Sphinx-friendly docstrings in the code - and docs in ``docs/`` and on https://urllib3.readthedocs.io/. -* Embettered all the things! -* Started writing this file. - - -0.4.1 (2011-07-17) ------------------- - -* Minor bug fixes, code cleanup. - - -0.4 (2011-03-01) ----------------- - -* Better unicode support. -* Added ``VerifiedHTTPSConnection``. -* Added ``NTLMConnectionPool`` in contrib. -* Minor improvements. - - -0.3.1 (2010-07-13) ------------------- - -* Added ``assert_host_name`` optional parameter. Now compatible with proxies. - - -0.3 (2009-12-10) ----------------- - -* Added HTTPS support. -* Minor bug fixes. -* Refactored, broken backwards compatibility with 0.2. -* API to be treated as stable from this version forward. - - -0.2 (2008-11-17) ----------------- - -* Added unit tests. -* Bug fixes. - - -0.1 (2008-11-16) ----------------- - -* First release. - - diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info/RECORD b/opensafely/_vendor/urllib3-1.26.5.dist-info/RECORD deleted file mode 100644 index 2b4e2283..00000000 --- a/opensafely/_vendor/urllib3-1.26.5.dist-info/RECORD +++ /dev/null @@ -1,46 +0,0 @@ -urllib3-1.26.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -urllib3-1.26.5.dist-info/LICENSE.txt,sha256=w3vxhuJ8-dvpYZ5V7f486nswCRzrPaY8fay-Dm13kHs,1115 -urllib3-1.26.5.dist-info/METADATA,sha256=jWwZpgFsIprOd7WrCMd1x8kjgG3daOL8m3NzJMcZuBA,43687 -urllib3-1.26.5.dist-info/RECORD,, -urllib3-1.26.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -urllib3-1.26.5.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110 -urllib3-1.26.5.dist-info/top_level.txt,sha256=EMiXL2sKrTcmrMxIHTqdc3ET54pQI2Y072LexFEemvo,8 -urllib3/__init__.py,sha256=j3yzHIbmW7CS-IKQJ9-PPQf_YKO8EOAey_rMW0UR7us,2763 -urllib3/_collections.py,sha256=Rp1mVyBgc_UlAcp6M3at1skJBXR5J43NawRTvW2g_XY,10811 -urllib3/_version.py,sha256=zNQyneY_MoN2iMPWHGbn8vEIxtmlIPTZ92VURmOSI7Q,63 -urllib3/connection.py,sha256=vZ201XD8r3yNWIeo8fnxlfM0cHWkFeZ9UcILrB2WCrY,18750 -urllib3/connectionpool.py,sha256=Yg-Y17opc03ViPp3GVB4E5I6diCcYc5-2Pvza6TatBQ,37131 -urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -urllib3/contrib/_appengine_environ.py,sha256=bDbyOEhW2CKLJcQqAKAyrEHN-aklsyHFKq6vF8ZFsmk,957 -urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -urllib3/contrib/_securetransport/bindings.py,sha256=E1_7ScsgOchfxneozbAueK7ziCwF35fna4DuDCYJ9_o,17637 -urllib3/contrib/_securetransport/low_level.py,sha256=lgIdsSycqfB0Xm5BiJzXGeIKT7ybCQMFPJAgkcwPa1s,13908 -urllib3/contrib/appengine.py,sha256=7Pxb0tKfDB_LTGPERiswH0qomhDoUUOo5kwybAKLQyE,11010 -urllib3/contrib/ntlmpool.py,sha256=6I95h1_71fzxmoMSNtY0gB8lnyCoVtP_DpqFGj14fdU,4160 -urllib3/contrib/pyopenssl.py,sha256=YIMyTiXiLPV_QfFw3PjZ31mGqJmM5EzxIjhSLxZ7VUM,16874 -urllib3/contrib/securetransport.py,sha256=izdx43gFoUGFSgxasZlOCL42FaM4vSsAVTmhO0EH1vM,34417 -urllib3/contrib/socks.py,sha256=DcRjM2l0rQMIyhYrN6r-tnVkY6ZTDxHJlM8_usAkGCA,7097 -urllib3/exceptions.py,sha256=0Mnno3KHTNfXRfY7638NufOPkUb6mXOm-Lqj-4x2w8A,8217 -urllib3/fields.py,sha256=kvLDCg_JmH1lLjUUEY_FLS8UhY7hBvDPuVETbY8mdrM,8579 -urllib3/filepost.py,sha256=5b_qqgRHVlL7uLtdAYBzBh-GHmU5AfJVt_2N0XS3PeY,2440 -urllib3/packages/__init__.py,sha256=h4BLhD4tLaBx1adaDtKXfupsgqY0wWLXb_f1_yVlV6A,108 -urllib3/packages/backports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -urllib3/packages/backports/makefile.py,sha256=nbzt3i0agPVP07jqqgjhaYjMmuAi_W5E0EywZivVO8E,1417 -urllib3/packages/six.py,sha256=L5xlwGKnLfDh2j-8bYHZ5LfT_YkWS4tyJotLXrrWIMo,34665 -urllib3/packages/ssl_match_hostname/__init__.py,sha256=ZVMwCkHx-py8ERsxxM3Il-MiREZktV-8iLBmCfRRHI4,927 -urllib3/packages/ssl_match_hostname/_implementation.py,sha256=6dZ-q074g7XhsJ27MFCgkct8iVNZB3sMZvKhf-KUVy0,5679 -urllib3/poolmanager.py,sha256=whzlX6UTEgODMOCy0ZDMUONRBCz5wyIM8Z9opXAY-Lk,19763 -urllib3/request.py,sha256=ZFSIqX0C6WizixecChZ3_okyu7BEv0lZu1VT0s6h4SM,5985 -urllib3/response.py,sha256=hGhGBh7TkEkh_IQg5C1W_xuPNrgIKv5BUXPyE-q0LuE,28203 -urllib3/util/__init__.py,sha256=JEmSmmqqLyaw8P51gUImZh8Gwg9i1zSe-DoqAitn2nc,1155 -urllib3/util/connection.py,sha256=Z9JufD13VNcga6RTW1wRIULbWdxsPE0WCUi5VTebALA,4908 -urllib3/util/proxy.py,sha256=FGipAEnvZteyldXNjce4DEB7YzwU-a5lep8y5S0qHQg,1604 -urllib3/util/queue.py,sha256=nRgX8_eX-_VkvxoX096QWoz8Ps0QHUAExILCY_7PncM,498 -urllib3/util/request.py,sha256=NnzaEKQ1Pauw5MFMV6HmgEMHITf0Aua9fQuzi2uZzGc,4123 -urllib3/util/response.py,sha256=GJpg3Egi9qaJXRwBh5wv-MNuRWan5BIu40oReoxWP28,3510 -urllib3/util/retry.py,sha256=-gIQR41eIF9CsdFj2gPSQ36CaDogZutfjnUTC9ks3j0,21391 -urllib3/util/ssl_.py,sha256=pAi0t6KmBEX3EI-SRLxKVAKq7K2hye--vlW3F1Kp4Fg,17110 -urllib3/util/ssltransport.py,sha256=3bLBqYPryT9UMGbx5iRgMgb2sj7VEKp5pmRD1g8d6VI,6907 -urllib3/util/timeout.py,sha256=QSbBUNOB9yh6AnDn61SrLQ0hg5oz0I9-uXEG91AJuIg,10003 -urllib3/util/url.py,sha256=au9jkUMnVr9Qp_9kg4HfZx9q9ur6yXQ4u5M17In-UKY,14030 -urllib3/util/wait.py,sha256=3MUKRSAUJDB2tgco7qRUskW0zXGAWYvRRE4Q1_6xlLs,5404 diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info/REQUESTED b/opensafely/_vendor/urllib3-1.26.5.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info/WHEEL b/opensafely/_vendor/urllib3-1.26.5.dist-info/WHEEL deleted file mode 100644 index 01b8fc7d..00000000 --- a/opensafely/_vendor/urllib3-1.26.5.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.36.2) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/opensafely/_vendor/urllib3-1.26.5.dist-info/top_level.txt b/opensafely/_vendor/urllib3-1.26.5.dist-info/top_level.txt deleted file mode 100644 index a42590be..00000000 --- a/opensafely/_vendor/urllib3-1.26.5.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -urllib3 diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info.pyi b/opensafely/_vendor/wrapt-1.14.1.dist-info.pyi deleted file mode 100644 index 7972993f..00000000 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info.pyi +++ /dev/null @@ -1 +0,0 @@ -from wrapt-1.14.1.dist-info import * \ No newline at end of file diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/INSTALLER b/opensafely/_vendor/wrapt-1.14.1.dist-info/INSTALLER deleted file mode 100644 index a1b589e3..00000000 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/LICENSE b/opensafely/_vendor/wrapt-1.14.1.dist-info/LICENSE deleted file mode 100644 index 1cc51172..00000000 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2013-2022, Graham Dumpleton -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/METADATA b/opensafely/_vendor/wrapt-1.14.1.dist-info/METADATA deleted file mode 100644 index 56a0c0d9..00000000 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info/METADATA +++ /dev/null @@ -1,172 +0,0 @@ -Metadata-Version: 2.1 -Name: wrapt -Version: 1.14.1 -Summary: Module for decorators, wrappers and monkey patching. -Home-page: https://github.com/GrahamDumpleton/wrapt -Author: Graham Dumpleton -Author-email: Graham.Dumpleton@gmail.com -License: BSD -Project-URL: Bug Tracker, https://github.com/GrahamDumpleton/wrapt/issues/ -Project-URL: Changelog, https://wrapt.readthedocs.io/en/latest/changes.html -Project-URL: Documentation, https://wrapt.readthedocs.io/ -Keywords: wrapper,proxy,decorator -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: License :: OSI Approved :: BSD License -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7 -Description-Content-Type: text/x-rst -License-File: LICENSE - -wrapt -===== - -|Actions| |PyPI| - -The aim of the **wrapt** module is to provide a transparent object proxy -for Python, which can be used as the basis for the construction of function -wrappers and decorator functions. - -The **wrapt** module focuses very much on correctness. It therefore goes -way beyond existing mechanisms such as ``functools.wraps()`` to ensure that -decorators preserve introspectability, signatures, type checking abilities -etc. The decorators that can be constructed using this module will work in -far more scenarios than typical decorators and provide more predictable and -consistent behaviour. - -To ensure that the overhead is as minimal as possible, a C extension module -is used for performance critical components. An automatic fallback to a -pure Python implementation is also provided where a target system does not -have a compiler to allow the C extension to be compiled. - -Documentation -------------- - -For further information on the **wrapt** module see: - -* http://wrapt.readthedocs.org/ - -Quick Start ------------ - -To implement your decorator you need to first define a wrapper function. -This will be called each time a decorated function is called. The wrapper -function needs to take four positional arguments: - -* ``wrapped`` - The wrapped function which in turns needs to be called by your wrapper function. -* ``instance`` - The object to which the wrapped function was bound when it was called. -* ``args`` - The list of positional arguments supplied when the decorated function was called. -* ``kwargs`` - The dictionary of keyword arguments supplied when the decorated function was called. - -The wrapper function would do whatever it needs to, but would usually in -turn call the wrapped function that is passed in via the ``wrapped`` -argument. - -The decorator ``@wrapt.decorator`` then needs to be applied to the wrapper -function to convert it into a decorator which can in turn be applied to -other functions. - -.. code-block:: python - - import wrapt - - @wrapt.decorator - def pass_through(wrapped, instance, args, kwargs): - return wrapped(*args, **kwargs) - - @pass_through - def function(): - pass - -If you wish to implement a decorator which accepts arguments, then wrap the -definition of the decorator in a function closure. Any arguments supplied -to the outer function when the decorator is applied, will be available to -the inner wrapper when the wrapped function is called. - -.. code-block:: python - - import wrapt - - def with_arguments(myarg1, myarg2): - @wrapt.decorator - def wrapper(wrapped, instance, args, kwargs): - return wrapped(*args, **kwargs) - return wrapper - - @with_arguments(1, 2) - def function(): - pass - -When applied to a normal function or static method, the wrapper function -when called will be passed ``None`` as the ``instance`` argument. - -When applied to an instance method, the wrapper function when called will -be passed the instance of the class the method is being called on as the -``instance`` argument. This will be the case even when the instance method -was called explicitly via the class and the instance passed as the first -argument. That is, the instance will never be passed as part of ``args``. - -When applied to a class method, the wrapper function when called will be -passed the class type as the ``instance`` argument. - -When applied to a class, the wrapper function when called will be passed -``None`` as the ``instance`` argument. The ``wrapped`` argument in this -case will be the class. - -The above rules can be summarised with the following example. - -.. code-block:: python - - import inspect - - @wrapt.decorator - def universal(wrapped, instance, args, kwargs): - if instance is None: - if inspect.isclass(wrapped): - # Decorator was applied to a class. - return wrapped(*args, **kwargs) - else: - # Decorator was applied to a function or staticmethod. - return wrapped(*args, **kwargs) - else: - if inspect.isclass(instance): - # Decorator was applied to a classmethod. - return wrapped(*args, **kwargs) - else: - # Decorator was applied to an instancemethod. - return wrapped(*args, **kwargs) - -Using these checks it is therefore possible to create a universal decorator -that can be applied in all situations. It is no longer necessary to create -different variants of decorators for normal functions and instance methods, -or use additional wrappers to convert a function decorator into one that -will work for instance methods. - -In all cases, the wrapped function passed to the wrapper function is called -in the same way, with ``args`` and ``kwargs`` being passed. The -``instance`` argument doesn't need to be used in calling the wrapped -function. - -Repository ----------- - -Full source code for the **wrapt** module, including documentation files -and unit tests, can be obtained from github. - -* https://github.com/GrahamDumpleton/wrapt - -.. |Actions| image:: https://img.shields.io/github/workflow/status/GrahamDumpleton/wrapt/Test/develop?logo=github&cacheSeconds=600 - :target: https://github.com/GrahamDumpleton/wrapt/actions -.. |PyPI| image:: https://img.shields.io/pypi/v/wrapt.svg?logo=python&cacheSeconds=3600 - :target: https://pypi.python.org/pypi/wrapt diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD b/opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD deleted file mode 100644 index dd9d8d9c..00000000 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info/RECORD +++ /dev/null @@ -1,12 +0,0 @@ -wrapt-1.14.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -wrapt-1.14.1.dist-info/LICENSE,sha256=d9KpFZz_4SRz9TmnGj50HzURfmG_0AXr1gw6F3jiwfE,1304 -wrapt-1.14.1.dist-info/METADATA,sha256=2cBKYpezO05RkaYqJqK2LTbnB2txRteKtBRjx3RLY5s,6739 -wrapt-1.14.1.dist-info/RECORD,, -wrapt-1.14.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -wrapt-1.14.1.dist-info/WHEEL,sha256=xEtKyBmnO4eihUCAFoP53pvKisYAC7Qcs_GX_OtLyLQ,103 -wrapt-1.14.1.dist-info/top_level.txt,sha256=Jf7kcuXtwjUJMwOL0QzALDg2WiSiXiH9ThKMjN64DW0,6 -wrapt/__init__.py,sha256=Bh0h33Iapc_qaoLWsWfaXK5xJz9KJExF7gQKIWYdSsg,1200 -wrapt/arguments.py,sha256=RF0nTEdPzPIewJ-jnSY42i4JSzK3ctjPABV1SJxLymg,1746 -wrapt/decorators.py,sha256=gNy1PVq9NNVDAB9tujaAVhb0xtVKSSzqT-hdGFeWM34,21332 -wrapt/importer.py,sha256=yxFgVg6-lRTbSVJ2oZbw1TPCtB98fIF4A_qi_Dh2JRc,9981 -wrapt/wrappers.py,sha256=cckjgzvfj08P-8PWp2fkkJNVas-bn4NDypdPB5p9Lio,35521 diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/REQUESTED b/opensafely/_vendor/wrapt-1.14.1.dist-info/REQUESTED deleted file mode 100644 index e69de29b..00000000 diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/WHEEL b/opensafely/_vendor/wrapt-1.14.1.dist-info/WHEEL deleted file mode 100644 index 3c956a78..00000000 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.41.3) -Root-Is-Purelib: false -Tag: cp38-cp38-linux_x86_64 - diff --git a/opensafely/_vendor/wrapt-1.14.1.dist-info/top_level.txt b/opensafely/_vendor/wrapt-1.14.1.dist-info/top_level.txt deleted file mode 100644 index ba11553a..00000000 --- a/opensafely/_vendor/wrapt-1.14.1.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -wrapt diff --git a/pyproject.toml b/pyproject.toml index c5193c65..566f2d6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,6 @@ patches-dir = "patches" # Other config values which have to be defined even though we don't use them protected-files = [] typing-stubs = {} -preserve_metadata = true # some packages don't ship their license in the package. ffs google. [tool.vendoring.license.fallback-urls] @@ -30,8 +29,6 @@ substitute = [ # https://github.com/psf/requests/blob/589c4547338b592b1fb77c65663d8aa6fbb7e38b/requests/packages.py { match='from \. import packages', replace='' }, { match='wrapt._wrappers', replace='opensafely._vendor.wrapt._wrappers'}, - { match='pydantic.color', replace='opensafely._vendor.pydantic.color'}, - { match='pydantic.types', replace='opensafely._vendor.pydantic.types'}, { match='urllib3.contrib.securetransport', replace='opensafely._vendor.urllib3.contrib.securetransport'}, { match='urllib3.contrib.pyopenssl', replace='opensafely._vendor.urllib3.contrib.pyopenssl'}, ] diff --git a/requirements.dev.in b/requirements.dev.in index 9dc32ef9..4369eed7 100644 --- a/requirements.dev.in +++ b/requirements.dev.in @@ -1,7 +1,5 @@ pip-tools -# We have to develop using 3.8, but we need to test under 3.7 (see README) -# Currently use our fork of vendoring -https://github.com/opensafely-core/vendoring/archive/add-preserve-metadata-option.zip; python_version >= '3.8' +vendoring # regular test dependencies black pytest @@ -10,14 +8,8 @@ wheel pre-commit coverage ruff -opentelemetry-exporter-otlp-proto-http - - -# -#flake8 -#flake8-builtins -#flake8-implicit-str-concat -#flake8-no-pep420 -#isort pytest-cov pytest-freezer + +# optional otel deps, +opentelemetry-exporter-otlp-proto-http diff --git a/requirements.dev.txt b/requirements.dev.txt index 1020c4e8..24bdd52b 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -141,6 +141,8 @@ six==1.16.0 # via # python-dateutil # requests-mock +toml==0.10.2 + # via vendoring tomli==2.0.1 # via # black @@ -149,7 +151,6 @@ tomli==2.0.1 # pip-tools # pyproject-hooks # pytest - # vendoring typing-extensions==4.8.0 # via # black @@ -157,7 +158,7 @@ typing-extensions==4.8.0 # rich urllib3==2.2.2 # via requests -vendoring @ https://github.com/opensafely-core/vendoring/archive/add-preserve-metadata-option.zip +vendoring==1.2.0 # via -r requirements.dev.in virtualenv==20.24.6 # via pre-commit