aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/src/python/grpcio_status
diff options
context:
space:
mode:
authorneksard <neksard@yandex-team.ru>2022-02-10 16:45:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:23 +0300
commit8f7cf138264e0caa318144bf8a2c950e0b0a8593 (patch)
tree83bf5c8c8047c42d8475e6095df90ccdc3d1b57f /contrib/libs/grpc/src/python/grpcio_status
parentd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (diff)
downloadydb-8f7cf138264e0caa318144bf8a2c950e0b0a8593.tar.gz
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/grpc/src/python/grpcio_status')
-rw-r--r--contrib/libs/grpc/src/python/grpcio_status/grpc_status/__init__.py26
-rw-r--r--contrib/libs/grpc/src/python/grpcio_status/grpc_status/rpc_status.py132
-rw-r--r--contrib/libs/grpc/src/python/grpcio_status/grpc_version.py32
-rw-r--r--contrib/libs/grpc/src/python/grpcio_status/setup.py160
-rw-r--r--contrib/libs/grpc/src/python/grpcio_status/status_commands.py78
5 files changed, 214 insertions, 214 deletions
diff --git a/contrib/libs/grpc/src/python/grpcio_status/grpc_status/__init__.py b/contrib/libs/grpc/src/python/grpcio_status/grpc_status/__init__.py
index 38fdfc9c5c..10b401503b 100644
--- a/contrib/libs/grpc/src/python/grpcio_status/grpc_status/__init__.py
+++ b/contrib/libs/grpc/src/python/grpcio_status/grpc_status/__init__.py
@@ -1,13 +1,13 @@
-# Copyright 2018 The gRPC 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.
+# Copyright 2018 The gRPC 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/contrib/libs/grpc/src/python/grpcio_status/grpc_status/rpc_status.py b/contrib/libs/grpc/src/python/grpcio_status/grpc_status/rpc_status.py
index d0ec08e3a5..3d4fcfd9b6 100644
--- a/contrib/libs/grpc/src/python/grpcio_status/grpc_status/rpc_status.py
+++ b/contrib/libs/grpc/src/python/grpcio_status/grpc_status/rpc_status.py
@@ -1,78 +1,78 @@
-# Copyright 2018 The gRPC 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.
-"""Reference implementation for status mapping in gRPC Python."""
-
-import collections
+# Copyright 2018 The gRPC 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.
+"""Reference implementation for status mapping in gRPC Python."""
+
+import collections
import sys
-
-import grpc
-
-from google.rpc import status_pb2
+
+import grpc
+
+from google.rpc import status_pb2
from ._common import code_to_grpc_status_code, GRPC_DETAILS_METADATA_KEY
-
-
-class _Status(
+
+
+class _Status(
collections.namedtuple('_Status',
('code', 'details', 'trailing_metadata')),
grpc.Status):
- pass
-
-
-def from_call(call):
- """Returns a google.rpc.status.Status message corresponding to a given grpc.Call.
-
- This is an EXPERIMENTAL API.
-
- Args:
- call: A grpc.Call instance.
-
- Returns:
- A google.rpc.status.Status message representing the status of the RPC.
-
- Raises:
- ValueError: If the gRPC call's code or details are inconsistent with the
- status code and message inside of the google.rpc.status.Status.
- """
+ pass
+
+
+def from_call(call):
+ """Returns a google.rpc.status.Status message corresponding to a given grpc.Call.
+
+ This is an EXPERIMENTAL API.
+
+ Args:
+ call: A grpc.Call instance.
+
+ Returns:
+ A google.rpc.status.Status message representing the status of the RPC.
+
+ Raises:
+ ValueError: If the gRPC call's code or details are inconsistent with the
+ status code and message inside of the google.rpc.status.Status.
+ """
if call.trailing_metadata() is None:
return None
- for key, value in call.trailing_metadata():
+ for key, value in call.trailing_metadata():
if key == GRPC_DETAILS_METADATA_KEY:
- rich_status = status_pb2.Status.FromString(value)
- if call.code().value[0] != rich_status.code:
- raise ValueError(
- 'Code in Status proto (%s) doesn\'t match status code (%s)'
+ rich_status = status_pb2.Status.FromString(value)
+ if call.code().value[0] != rich_status.code:
+ raise ValueError(
+ 'Code in Status proto (%s) doesn\'t match status code (%s)'
% (code_to_grpc_status_code(rich_status.code), call.code()))
- if call.details() != rich_status.message:
- raise ValueError(
- 'Message in Status proto (%s) doesn\'t match status details (%s)'
- % (rich_status.message, call.details()))
- return rich_status
- return None
-
-
-def to_status(status):
- """Convert a google.rpc.status.Status message to grpc.Status.
-
- This is an EXPERIMENTAL API.
-
- Args:
- status: a google.rpc.status.Status message representing the non-OK status
- to terminate the RPC with and communicate it to the client.
-
- Returns:
- A grpc.Status instance representing the input google.rpc.status.Status message.
- """
+ if call.details() != rich_status.message:
+ raise ValueError(
+ 'Message in Status proto (%s) doesn\'t match status details (%s)'
+ % (rich_status.message, call.details()))
+ return rich_status
+ return None
+
+
+def to_status(status):
+ """Convert a google.rpc.status.Status message to grpc.Status.
+
+ This is an EXPERIMENTAL API.
+
+ Args:
+ status: a google.rpc.status.Status message representing the non-OK status
+ to terminate the RPC with and communicate it to the client.
+
+ Returns:
+ A grpc.Status instance representing the input google.rpc.status.Status message.
+ """
return _Status(code=code_to_grpc_status_code(status.code),
details=status.message,
trailing_metadata=((GRPC_DETAILS_METADATA_KEY,
diff --git a/contrib/libs/grpc/src/python/grpcio_status/grpc_version.py b/contrib/libs/grpc/src/python/grpcio_status/grpc_version.py
index 2b6ec9c659..4f586aee97 100644
--- a/contrib/libs/grpc/src/python/grpcio_status/grpc_version.py
+++ b/contrib/libs/grpc/src/python/grpcio_status/grpc_version.py
@@ -1,17 +1,17 @@
-# Copyright 2018 The gRPC 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.
-
-# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!!
-
+# Copyright 2018 The gRPC 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.
+
+# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!!
+
VERSION = '1.33.2'
diff --git a/contrib/libs/grpc/src/python/grpcio_status/setup.py b/contrib/libs/grpc/src/python/grpcio_status/setup.py
index eb49069c34..052b470a3f 100644
--- a/contrib/libs/grpc/src/python/grpcio_status/setup.py
+++ b/contrib/libs/grpc/src/python/grpcio_status/setup.py
@@ -1,88 +1,88 @@
-# Copyright 2018 The gRPC 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.
-"""Setup module for the GRPC Python package's status mapping."""
-
-import os
-
-import setuptools
-
+# Copyright 2018 The gRPC 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.
+"""Setup module for the GRPC Python package's status mapping."""
+
+import os
+
+import setuptools
+
_PACKAGE_PATH = os.path.realpath(os.path.dirname(__file__))
_README_PATH = os.path.join(_PACKAGE_PATH, 'README.rst')
-# Ensure we're in the proper directory whether or not we're being used by pip.
-os.chdir(os.path.dirname(os.path.abspath(__file__)))
-
-# Break import-style to ensure we can actually find our local modules.
-import grpc_version
-
-
-class _NoOpCommand(setuptools.Command):
- """No-op command."""
-
- description = ''
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- pass
-
-
-CLASSIFIERS = [
- 'Development Status :: 5 - Production/Stable',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
+# Ensure we're in the proper directory whether or not we're being used by pip.
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+
+# Break import-style to ensure we can actually find our local modules.
+import grpc_version
+
+
+class _NoOpCommand(setuptools.Command):
+ """No-op command."""
+
+ description = ''
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ pass
+
+
+CLASSIFIERS = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
- 'License :: OSI Approved :: Apache Software License',
-]
-
-PACKAGE_DIRECTORIES = {
- '': '.',
-}
-
-INSTALL_REQUIRES = (
- 'protobuf>=3.6.0',
- 'grpcio>={version}'.format(version=grpc_version.VERSION),
- 'googleapis-common-protos>=1.5.5',
-)
-
-try:
- import status_commands as _status_commands
- # we are in the build environment, otherwise the above import fails
- COMMAND_CLASS = {
- # Run preprocess from the repository *before* doing any packaging!
- 'preprocess': _status_commands.Preprocess,
- 'build_package_protos': _NoOpCommand,
- }
-except ImportError:
- COMMAND_CLASS = {
- # wire up commands to no-op not to break the external dependencies
- 'preprocess': _NoOpCommand,
- 'build_package_protos': _NoOpCommand,
- }
-
+ 'License :: OSI Approved :: Apache Software License',
+]
+
+PACKAGE_DIRECTORIES = {
+ '': '.',
+}
+
+INSTALL_REQUIRES = (
+ 'protobuf>=3.6.0',
+ 'grpcio>={version}'.format(version=grpc_version.VERSION),
+ 'googleapis-common-protos>=1.5.5',
+)
+
+try:
+ import status_commands as _status_commands
+ # we are in the build environment, otherwise the above import fails
+ COMMAND_CLASS = {
+ # Run preprocess from the repository *before* doing any packaging!
+ 'preprocess': _status_commands.Preprocess,
+ 'build_package_protos': _NoOpCommand,
+ }
+except ImportError:
+ COMMAND_CLASS = {
+ # wire up commands to no-op not to break the external dependencies
+ 'preprocess': _NoOpCommand,
+ 'build_package_protos': _NoOpCommand,
+ }
+
setuptools.setup(name='grpcio-status',
version=grpc_version.VERSION,
description='Status proto mapping for gRPC',
diff --git a/contrib/libs/grpc/src/python/grpcio_status/status_commands.py b/contrib/libs/grpc/src/python/grpcio_status/status_commands.py
index 8306f3c027..fe2e36a1e5 100644
--- a/contrib/libs/grpc/src/python/grpcio_status/status_commands.py
+++ b/contrib/libs/grpc/src/python/grpcio_status/status_commands.py
@@ -1,43 +1,43 @@
-# Copyright 2018 The gRPC 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.
-"""Provides distutils command classes for the GRPC Python setup process."""
-
-import os
-import shutil
-
-import setuptools
-
-ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
+# Copyright 2018 The gRPC 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.
+"""Provides distutils command classes for the GRPC Python setup process."""
+
+import os
+import shutil
+
+import setuptools
+
+ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
STATUS_PROTO = os.path.join(
ROOT_DIR, '../../../third_party/googleapis/google/rpc/status.proto')
PACKAGE_STATUS_PROTO_PATH = 'grpc_status/google/rpc'
-LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
-
-
-class Preprocess(setuptools.Command):
- """Command to copy LICENSE from root directory."""
-
- description = ''
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
+LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
+
+
+class Preprocess(setuptools.Command):
+ """Command to copy LICENSE from root directory."""
+
+ description = ''
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
if os.path.isfile(STATUS_PROTO):
if not os.path.isdir(PACKAGE_STATUS_PROTO_PATH):
os.makedirs(PACKAGE_STATUS_PROTO_PATH)
@@ -45,5 +45,5 @@ class Preprocess(setuptools.Command):
STATUS_PROTO,
os.path.join(ROOT_DIR, PACKAGE_STATUS_PROTO_PATH,
'status.proto'))
- if os.path.isfile(LICENSE):
- shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))
+ if os.path.isfile(LICENSE):
+ shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))