chrome_names.py 742 B

12345678910111213141516171819
  1. # Lint as: python3
  2. # Copyright 2020 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """Functions dealing with Chrome-specific naming conventions."""
  6. def shorten_class(class_name: str) -> str:
  7. """Returns a shortened version of the fully qualilied class name."""
  8. return class_name.replace('org.chromium.',
  9. '.').replace('chrome.browser.', 'c.b.')
  10. def shorten_build_target(build_target: str) -> str:
  11. """Returns a shortened version of the build target."""
  12. if build_target == '//chrome/android:chrome_java':
  13. return 'chrome_java'
  14. return build_target.replace('//chrome/browser/', '//c/b/')