From 75bdc159b0e7ffd5f8451dc50d1ad227a2f5b604 Mon Sep 17 00:00:00 2001 From: kstanger Date: Thu, 13 Aug 2015 06:52:26 -0700 Subject: [PATCH] Fixes the Java camel-casing of protocol buffer filenames. Change on 2015/08/13 by kstanger ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=100571065 --- scripts/parse_proto.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/parse_proto.py b/scripts/parse_proto.py index b23b2076d2..4fdb19130c 100755 --- a/scripts/parse_proto.py +++ b/scripts/parse_proto.py @@ -24,7 +24,15 @@ def CamelCase(name): - return ''.join(string.capwords(name, '_').split('_')) + result = [] + cap_next = True + for ch in name: + if cap_next and ch.islower(): + result.append(ch.upper()) + elif ch.isalnum(): + result.append(ch) + cap_next = not ch.isalpha() + return ''.join(result) class ProtoMetadata: