return special API by package's name
549967
def api(self, name):
        ''''''

        assert name, 'name is none'
        if flow.__name__ == name:
            api = flow.FlowApi()
        elif sign.__name__ == name:
            api = sign.SignApi()
        elif sms.__name__ == name:
            api = sms.SmsApi()
        elif tpl.__name__ == name:
            api = tpl.TplApi()
        elif user.__name__ == name:
            api = user.UserApi()
        elif voice.__name__ == name:
            api = voice.VoiceApi()

        assert api, "not found api-" + name

        api._init(self._clnt)
        return api
756625
@Override
    public String toApiImport(String name) {
        if (!apiPackage().isEmpty())
            return apiPackage();
        else if (trimApiPaths)
            return trimmedPaths.get(name).substring(1).replace('/', '.');
        else
            return super.toApiImport(name);
    }
348631
def find_macro_by_name(self, name, package):
        
        return self._find_by_name(name, package, 'macros', [NodeType.Macro])
876373
def _resolve_name(name, package, level):
    """"""
    bits = package.rsplit('.', level - 1)
    if len(bits) < level:
        raise ValueError('attempted relative import beyond top-level package')
    base = bits[0]
    return '{}.{}'.format(base, name) if name else base
730592
def get_package_id(self, name):
        
        json_scheme = self.gen_def_json_scheme('GetPreConfiguredPackages', dict(HypervisorType=4))
        json_obj = self.call_method_post(method='GetPreConfiguredPackages ', json_scheme=json_scheme)
        for package in json_obj['Value']:
            packageId  = package['PackageID']
            for description in package['Descriptions']:
                languageID = description['LanguageID']
                packageName = description['Text']
                if languageID == 2 and packageName.lower() == name.lower():
                    return packageId
1274128
def package_info(self, package, abspath=True):
        """"""
        return self._call_and_parse(['info', package, '--json'],
                                    abspath=abspath)
121802
function getPackageMetaFile(answers) {
    const packageFields = ['name', 'version', 'license', 'category'];
    const packageObject = merge(pick(packageFields, answers),
        { dependencies: { 'rung-cli': '1.0.0' } });

    return {
        filename: path.join(answers.name, 'package.json'),
        content: JSON.stringify(packageObject, null, 2)
    };
}
627478
function getInfo(d) {
  var p = path.join(d, 'package.json')
  return exists(p) ? require(p) : false
}
413860
def packagenameify(s):
  
  return ''.join(w if w in ACRONYMS else w.title() for w in s.split('.')[-1:])
163026
def find_package(name: str) -> Tuple[Optional[Path], Path]:
    
    module = name.split(".")[0]
    loader = pkgutil.get_loader(module)
    if name == "__main__" or loader is None:
        package_path = Path.cwd()
    else:
        if hasattr(loader, 'get_filename'):
            filename = loader.get_filename(module)  # type: ignore
        else:
            __import__(name)
            filename = sys.modules[name].__file__
        package_path = Path(filename).resolve().parent
        if hasattr(loader, 'is_package'):
            is_package = loader.is_package(module)  # type: ignore
            if is_package:
                package_path = Path(package_path).resolve().parent
    sys_prefix = Path(sys.prefix).resolve()
    try:
        package_path.relative_to(sys_prefix)
    except ValueError:
        return None, package_path
    else:
        return sys_prefix, package_path
1106514
def find_name():
    """"""
    name_file = read_file('__init__.py')
    name_match = re.search(r'^__package_name__ = ["\']([^"\']*)["\']',
                           name_file, re.M)
    if name_match:
        return name_match.group(1)
    raise RuntimeError('Unable to find name string.')
294850
function getPackageInfoFrom(string) {
  if (string[0] === '@') {
    const [scope, rawName] = string.split('/');
    const { name, version } = getVersionFromString(rawName);
    return {
      name: `${scope}/${name}`,
      version,
    };
  }

  return getVersionFromString(string);
}
269010
def get_packages(self, offset=None, limit=None, api=None):
        
        api = api or self._API
        return AutomationPackage.query(
            automation=self.id, offset=offset, limit=limit, api=api
        )
1034130
def extract(self, package_name):
        """"""
        for cmd in ['rpm2cpio', 'cpio']:
            if not Cmd.which(cmd):
                message = '{0} command not found. Install {0}.'.format(cmd)
                raise InstallError(message)

        pattern = '{0}*{1}.rpm'.format(package_name, self.arch)
        rpm_files = Cmd.find('.', pattern)
        if not rpm_files:
            raise InstallError('PRM file not found.')
        cmd = 'rpm2cpio {0} | cpio -idmv'.format(rpm_files[0])
        Cmd.sh_e(cmd)
1280683
def search_pkg(name, repo):
    
    PACKAGES_TXT = Utils().read_file(_meta_.lib_path + "{0}_repo/"
                                     "PACKAGES.TXT".format(repo))
    names = Utils().package_name(PACKAGES_TXT)
    blacklist = BlackList().packages(pkgs=names, repo=repo)
    for line in PACKAGES_TXT.splitlines():
        status(0)
        if line.startswith("PACKAGE NAME:  ") and len(line) > 16:
            pkg_name = split_package(line[15:])[0].strip()
            if name == pkg_name and name not in blacklist:
                return pkg_name
1123011
function findPackage(dir, packageName) {
    let d = dir || '.';
    do {
        let f = path.join(d, 'package.json');
        if ( fs.existsSync(f) ) {
            // require(f) would look for paths relative to this module,
            // but we need it to be relative to process.cwd()
            if ( !path.isAbsolute(f) ) {
                f = fs.realpathSync(f);
            }
            const p = requireJSON(f);
            // Look for a specific project name
            if ( packageName ) {
                if ( p ) {
                    if ( p.name == packageName ) {
                        return f;
                    }
                }
            }
            // Look for any project except this one (verup)
            else {
                if ( p ) {
                    if ( (p.extra && p.extra.verup || p.verup) && p.name != 'verup' ) {
                        return f;
                    }
                }
            }
        }
        dir = d;
        d = path.join(d, '..');
    } while (d != dir && dir.slice(0,2) != '..');
    return false;
}
944382
def parse_package_name(self):  # type: () -> Optional[str]
        
        if not self.setup_source:
            return None
        for row in self.setup_source.split("\n"):
            simplified_row = row.replace(" ", "").replace("'", '"').strip(" \t\n")
            if "name=" in simplified_row:
                if '"' in simplified_row:
                    return simplified_row.split('"')[1]

        name = self.execute_setup_name()
        if name:
            return name

        return ""