tools/android/modularization/convenience/lookup_dep.py
def _parse_full_java_class(source_path: pathlib.Path) -> str:
    """Guess the fully qualified class name from the path to the source file."""
    if source_path.suffix != '.java':
      logging.warning(f'"{source_path}" does not have the .java suffix')
      return None

    directory_path: pathlib.Path = source_path.parent
    package_list_reversed = []
    for part in reversed(directory_path.parts):
      if part == 'java':
        break
      package_list_reversed.append(part)
      if part in ('com', 'org'):
        break
    else:
      logging.debug(f'File {source_path} not in a subdir of "org" or "com", '
                    'cannot detect package heuristically.')
      return None

    package = '.'.join(reversed(package_list_reversed))
    class_name = source_path.stem
    return f'{package}.{class_name}'
Guess the fully qualified class name from the path to the source file.
Guess the fully qualified class name from the path to the source file.
Guess the fully qualified class name from the path to the source file .
def _parse_full_java_class(source_path: pathlib.Path) -> str:
    if source_path.suffix != '.java':
      logging.warning(f'"{source_path}" does not have the .java suffix')
      return None
    directory_path: pathlib.Path = source_path.parent
    package_list_reversed = []
    for part in reversed(directory_path.parts):
      if part == 'java':
        break
      package_list_reversed.append(part)
      if part in ('com', 'org'):
        break
    else:
      logging.debug(f'File {source_path} not in a subdir of "org" or "com", '
                    'cannot detect package heuristically.')
      return None
    package = '.'.join(reversed(package_list_reversed))
    class_name = source_path.stem
    return f'{package}.{class_name}'
def _parse_full_java_class ( source_path : pathlib . Path ) -> str : if source_path . suffix != '.java' : logging . warning ( f'"{source_path}" does not have the .java suffix' ) return None directory_path : pathlib . Path = source_path . parent package_list_reversed = [ ] for part in reversed ( directory_path . parts ) : if part == 'java' : break package_list_reversed . append ( part ) if part in ( 'com' , 'org' ) : break else : logging . debug ( f'File {source_path} not in a subdir of "org" or "com", ' 'cannot detect package heuristically.' ) return None package = '.' . join ( reversed ( package_list_reversed ) ) class_name = source_path . stem return f'{package}.{class_name}'
Guess the fully qualified class name from the path to the source file.
Guess the fully qualified class name from the path to the source file .
"""Guess the fully qualified class name from the path to the source file."""
source_path
pathlib.Path