Return the inverse path for a package.
For example, if the package is java.lang,
the inverse path is ../...
497954
public static DocPath forRoot(PackageDoc pd) {
        String name = (pd == null) ? "" : pd.name();
        if (name.isEmpty())
            return empty;
        return new DocPath(name.replace('.', '/').replaceAll("[^/]+", ".."));
    }
1074670
def find_subdirectories(package):
    
    try:
        subdirectories = os.walk(package_to_path(package)).next()[1]
    except StopIteration:
        subdirectories = []
    return subdirectories
484341
def getModulePath(project_path,module_name,verbose):
    ''''''
    if not module_name:
        return None
    sys.path.append(project_path)
    try:
        package = pkgutil.get_loader(module_name)
    except ImportError:
        if verbose:
            print("Parent module for "+module_name+" not found.")
        return None
    except:
        if verbose:
            print(module_name+" not loaded for bizarre reasons")
    try:
        if package: 
                if package.get_code(module_name):
                    filename = package.get_code(module_name).co_filename
                    return filename
                elif package.find_spec(module_name).has_location==False:
                    return None #built-in module such as itertools
                else:
                    pass #perhaps filename is in package.find_spec(module_name).origin?
                    pass #a good reference is https://www.python.org/dev/peps/pep-0302/
    except ImportError:
        if verbose:
            print("Code object unavailable for "+module_name)
        return None
    except AttributeError:
        if verbose:
            print(module_name+" is an ExtensionFileLoader object")
        return None
    except:
        if verbose:
            print(module_name+" not loaded for bizarre reasons")
        return None
    else:
        if verbose:
            print ("Module "+module_name+" not found.")
        return None
988155
public function asPath()
    {
        if ($this->isClass() || $this->isInterface() || $this->isTrait() || $this->isException()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$this->_name.'.html');
        } elseif ($this->isField()) {
            $class =& $this->containingClass();
            if ($class) {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$class->name().'.html#').$this->_name;
            } else {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-globals.html#').$this->_name;
            }
        } elseif ($this->isConstructor() || $this->isMethod()) {
            $class =& $this->containingClass();
            if ($class) {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$class->name().'.html#').$this->_name.'()';
            } else {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-functions.html#').$this->_name.'()';
            }
        } elseif ($this->isGlobal()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-globals.html#').$this->_name;
        } elseif ($this->isFunction()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-functions.html#').$this->_name.'()';
        }

        return NULL;
    }
461423
def getversion(package):
    
    distribution = get_distribution(package)
    if distribution is None:
        raise RuntimeError("Can't find distribution {0}".format(package))
    repo_type = get_repo_type(distribution.location)
    if repo_type is None:
        return distribution.version

    return repo_type.get_version(distribution.location)
1239347
static String getServletPath(HttpServletRequest request) {
    String servletPath = request.getServletPath();
    if (hackWorks && PACKAGE.equals(request.getClass().getPackage().getName())) {
      try {
        Object outer = get(request, "this$0");
        Object servletPipeline = get(outer, "servletPipeline");
        Object servletDefs = get(servletPipeline, "servletDefinitions");
        int length = Array.getLength(servletDefs);
        for (int i = 0; i < length; ++i) {
          Object pattern = get(Array.get(servletDefs, i), "patternMatcher");
          if (matches(pattern, servletPath)) {
            servletPath = extractPath(pattern, servletPath);
            break;
          }
        }
      } catch (Exception e) {
        hackWorks = false;
      }
    }
    return servletPath;
  }
838607
def modulepath(filename):
    
    filepath = os.path.abspath(filename)
    prepath = filepath[:filepath.rindex('/')]
    postpath = '/'
    if prepath.count('/') == 0 or not os.path.exists(prepath + '/__init__.py'):
        flag = False
    else:
        flag = True
    while True:
        if prepath.endswith('/lib') or prepath.endswith('/bin') or prepath.endswith('/site-packages'):
            break
        elif flag and (prepath.count('/') == 0 or not os.path.exists(prepath + '/__init__.py')):
            break
        else:
            for f in os.listdir(prepath):
                if '.py' in f:
                    break
            else:
                break
            postpath = prepath[prepath.rindex('/'):].split('-')[0].split('_')[0] + postpath
            prepath = prepath[:prepath.rindex('/')]
    return postpath.lstrip('/') + filename.split('/')[-1].replace('.pyc', '').replace('.py', '') + '/'
575945
def get_notebook_rel_path(pkg=None):
    """"""
    pkg = pkg or open_source_package()
    pkg_path = str(pkg.package_url.fspath)
    nb_path = get_notebook_path()

    return nb_path.replace(pkg_path, '').strip('/')
755310
protected String getPackaging(String packaging) {
        return this.packaging == null || this.packaging.length() == 0
                ? packaging
                : this.packaging;
    }
137424
protected function getPackagePath()
    {
        $reflection = new ReflectionObject($this);
        $fileName = $reflection->getFileName();
        $packagePath = dirname(dirname(dirname(dirname(dirname(dirname($fileName))))));
        return $packagePath;
    }
227585
function findProjectRoot(currentPath) {
  var result = undefined;

  try {
    var packageStats = lstatSync(path.join(currentPath, 'package.json'));

    if (packageStats.isFile()) {
      result = currentPath;
    }
  } catch (error) {
    if (currentPath !== path.resolve('/')) {
      result = findProjectRoot(path.join(currentPath, '..'));
    }
  }

  return result;
}
21605
private static String calculatePackagePrefix() {
        String maybeShaded = Library.class.getName();
        // Use ! instead of . to avoid shading utilities from modifying the string
        String expected = "io!netty!internal!tcnative!Library".replace('!', '.');
        if (!maybeShaded.endsWith(expected)) {
            throw new UnsatisfiedLinkError(String.format(
                    "Could not find prefix added to %s to get %s. When shading, only adding a "
                            + "package prefix is supported", expected, maybeShaded));
        }
        return maybeShaded.substring(0, maybeShaded.length() - expected.length());
    }
1101369
public String getRelativePath() {
    StringBuilder sb = new StringBuilder();
    String pkg = typeRef.getPackageName().replace('.', '/');
    if (pkg.length() > 0) {
      sb.append(pkg);
      sb.append('/');
    }
    appendDeclaringTypes(typeRef, '$', sb);
    sb.append(typeRef.getSimpleName());
    sb.append(".class");
    return sb.toString();
  }
939164
def get_from_package(package_name, path):
    
    filepath = pkg_resources.resource_filename(package_name, path)
    return os.path.abspath(filepath)
1146672
function packageNameFromPath(path) {
  var matches = moduleRegex.exec(path);
  return matches && matches.length > 1 ? matches[1] : null;
}
252256
Module findModuleFromPackageName(String pkg) {
        int cp = pkg.indexOf(':');
        assert(cp != -1);
        String mod = pkg.substring(0, cp);
        return lookupModule(mod);
    }
733624
def inverse(self):
        
        result = G1Element()
        librelic.g1_neg_abi(byref(result), byref(self))
        return result