aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/google/protobuf/internal/well_known_types.py
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2016-04-28 14:34:59 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2016-04-28 14:34:59 -0700
commitcf14183bcd5485b4a71541599ddce0b35eb71352 (patch)
tree12f6e5eb731d7a70cdac4cdafc8b3131629413e2 /python/google/protobuf/internal/well_known_types.py
parentf00300d7f04f1c38a7d70e271f9232b94dd0e326 (diff)
Down integrate from Google internal.
Diffstat (limited to 'python/google/protobuf/internal/well_known_types.py')
-rw-r--r--python/google/protobuf/internal/well_known_types.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/google/protobuf/internal/well_known_types.py b/python/google/protobuf/internal/well_known_types.py
index d35fcc5f..7c5dffd0 100644
--- a/python/google/protobuf/internal/well_known_types.py
+++ b/python/google/protobuf/internal/well_known_types.py
@@ -82,10 +82,14 @@ class Any(object):
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."""
- # Only last part is to be used: b/25630112
- return self.type_url.split('/')[-1] == descriptor.full_name
+ return self.TypeName() == descriptor.full_name
class Timestamp(object):