SymbolUtils { public static String fullyQualifiedModuleName(String packageName, String fileName) { String moduleName = getModuleFileName(fileName); if (moduleName.equals("__init__")) { return packageName; } return packageName.isEmpty() ? moduleName : (packageName + "." + moduleName); } private  SymbolUtils(); static String getModuleFileName(String fileName); static String fullyQualifiedModuleName(String packageName, String fileName); static List<Expression> assignmentsLhs(AssignmentStatement assignmentStatement); static String pythonPackageName(File file, File projectBaseDir); @CheckForNull static Path pathOf(PythonFile pythonFile); static boolean isTypeShedFile(PythonFile pythonFile); static int firstParameterOffset(FunctionSymbol functionSymbol, boolean isStaticCall); static Optional<FunctionSymbol> getOverriddenMethod(FunctionSymbol functionSymbol);  }
@Test public void fqn_by_package_with_subpackage() { assertThat(SymbolUtils.fullyQualifiedModuleName("", "foo.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "__init__.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo.py")).isEqualTo("foo.foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo")).isEqualTo("foo.foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("curses", "ascii.py")).isEqualTo("curses.ascii"); }