Return the path for a package.
For example, if the package is java.lang,
the path is java/lang.
507000
public static DocPath forPackage(PackageElement pkgElement) {
        return pkgElement == null || pkgElement.isUnnamed()
                ? empty
                : DocPath.create(pkgElement.getQualifiedName().toString().replace('.', '/'));
    }
1256998
function getPackagePath(p) {
      if (p.path) {
        return p.path;
      } else if (p.polyfill) {
        return path.join('polyfills', p.namespace.toLowerCase(), p.name);
      } else if (p.type === 'fix') {
        return path.join(p.module.toLowerCase(), 'fixes', p.name);
      } else if (p.type === 'locale') {
        return path.join(p.module.toLowerCase(), p.code);
      } else if (sourcePackageIsDependency(p)) {
        return path.join(p.module.toLowerCase(), p.type, p.name);
      } else {
        return path.join(p.namespace.toLowerCase(), p.name);
      }
    }
1288513
private String findPackageName (final String grammar)
  {
    final String packageDeclaration = "package\\s+([^\\s.;]+(\\.[^\\s.;]+)*)\\s*;";
    final Matcher matcher = Pattern.compile (packageDeclaration).matcher (grammar);
    if (matcher.find ())
    {
      return matcher.group (1);
    }
    return "";
  }
516947
protected DocPath pathString(TypeElement te, DocPath name) {
        return pathString(utils.containingPackage(te), name);
    }
137424
protected function getPackagePath()
    {
        $reflection = new ReflectionObject($this);
        $fileName = $reflection->getFileName();
        $packagePath = dirname(dirname(dirname(dirname(dirname(dirname($fileName))))));
        return $packagePath;
    }
1274128
def package_info(self, package, abspath=True):
        """"""
        return self._call_and_parse(['info', package, '--json'],
                                    abspath=abspath)
413962
def locate_resource(name, lang, filter=None):
  
  task_dir = resource_dir.get(name, name)
  package_id = u"{}.{}".format(task_dir, lang)
  p = path.join(polyglot_path, task_dir, lang)
  if not path.isdir(p):
    if downloader.status(package_id) != downloader.INSTALLED:
      raise ValueError("This resource is available in the index "
                       "but not downloaded, yet. Try to run\n\n"
                       "polyglot download {}".format(package_id))
  return path.join(p, os.listdir(p)[0])
986316
@Nullable
  public static String getDirectoryFromPackage (@Nullable final Package aPackage)
  {
    // No differentiation
    return aPackage == null ? null : getPathFromClass (aPackage.getName ());
  }
939164
def get_from_package(package_name, path):
    
    filepath = pkg_resources.resource_filename(package_name, path)
    return os.path.abspath(filepath)
1298345
def package_path(self, team, user, package):
        
        return os.path.join(self.user_path(team, user), package)
1355895
function() {
        var basePath = window.location.pathname;
        basePath = basePath.substring(0, basePath.lastIndexOf('/')+1);
        return basePath+"packages/"+this.get("name");
    }
1214360
protected function getConfigPackagePath(string $dir, PackageInterface $package): ?string
    {
        $dir = preg_replace(
            '#^(' . preg_quote(getcwd() . DIRECTORY_SEPARATOR, '#') . ')#',
            '.' . DIRECTORY_SEPARATOR,
            $dir
        );

        $path = $this->getConfigPath($dir);
        if (file_exists($path))
        {
            $this->getLogger()->write(
                sprintf(
                    '  - Found in <info>%s</info>',
                    $package->getPrettyName()
                )
            );

            return $path;
        }

        return null;
    }
97262
String getZipFilePath() {
        return packageRootPrefix.isEmpty() ? zipFilePath
                : zipFilePath + "!/" + packageRootPrefix.substring(0, packageRootPrefix.length() - 1);
    }
396067
public function getPackagePath()
    {
        $packageHandle = $this->getPackageHandle();
        $result = $this->DIR_PACKAGES . '/' . $packageHandle;
        if (!is_dir($result)) {
            $result = $this->DIR_PACKAGES_CORE . '/' . $packageHandle;
        }

        return $result;
    }
709812
def package_name(package):
    # type: (str) -> str
    
    if not package:
        return ""

    lastdot = package.rfind(".")
    if lastdot == -1:
        return package

    return package[:lastdot]
1339217
def find_module(self, fullname, path=None):
        
        # path points to the top-level package path if any
        # and we can only import sub-modules/-packages
        if path is None:
            return
        if fullname.startswith(self.module_prefix):
            return self
        else:
            return None
341655
def get_paths(cls, packages):
        """"""
        allowable_packages = dict((app_config.name, app_config) for app_config in apps.get_app_configs())
        app_configs = [allowable_packages[p] for p in packages if p in allowable_packages]
        # paths of requested packages
        return [os.path.join(app.path, 'locale') for app in app_configs]