Commit 298d4c60 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

blinkbuild: Remove dead code in name_utilities.py

snake_case() and enum_type_name() are not used. Remove them and their
dependent.

Bug: 843927
Change-Id: If93fcb25e1cf26299ed06dc65a9de387c528b15b
Reviewed-on: https://chromium-review.googlesource.com/1080351Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563147}
parent 8024ec7a
...@@ -249,7 +249,6 @@ class Writer(object): ...@@ -249,7 +249,6 @@ class Writer(object):
self.gperf_path = gperf_path self.gperf_path = gperf_path
def get_file_basename(self, name): def get_file_basename(self, name):
# Use NameStyleConverter instead of name_utilities for consistency.
return NameStyleConverter(name).to_snake_case() return NameStyleConverter(name).to_snake_case()
def make_header_guard(self, path): def make_header_guard(self, path):
......
...@@ -27,16 +27,8 @@ ...@@ -27,16 +27,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os.path import os.path
import re
from blinkbuild.name_style_converter import NameStyleConverter, tokenize_name from blinkbuild.name_style_converter import NameStyleConverter
def _upper_first_letter(name):
"""Return name with first letter uppercased."""
if not name:
return ''
return name[0].upper() + name[1:]
def script_name(entry): def script_name(entry):
...@@ -69,43 +61,3 @@ def enum_for_css_property(property_name): ...@@ -69,43 +61,3 @@ def enum_for_css_property(property_name):
def enum_for_css_property_alias(property_name): def enum_for_css_property_alias(property_name):
return 'CSSPropertyAlias' + property_name.to_upper_camel_case() return 'CSSPropertyAlias' + property_name.to_upper_camel_case()
# FIXME: Merge these with the above methods.
# and update all the generators to use these ones.
# FIXME: Switch external callers of these methods to use the high level
# API below instead.
def naming_style(f):
"""Decorator for name utility functions.
Wraps a name utility function in a function that takes one or more names,
splits them into a list of words, and passes the list to the utility function.
"""
def inner(name_or_names):
names = name_or_names if isinstance(name_or_names, list) else [name_or_names]
words = []
for name in names:
if name:
words.extend(tokenize_name(name))
return f(words)
return inner
@naming_style
def _upper_camel_case(words):
return ''.join(_upper_first_letter(word) for word in words)
@naming_style
def snake_case(words):
return '_'.join(word.lower() for word in words)
# Use these high level naming functions which describe the semantics of the name,
# rather than a particular style.
@naming_style
def enum_type_name(words):
return _upper_camel_case(words)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment