Properly case project name from pypi.org.
344667
def proper_case(package_name):
    """"""
    # Hit the simple API.
    r = _get_requests_session().get(
        "https://pypi.org/pypi/{0}/json".format(package_name), timeout=0.3, stream=True
    )
    if not r.ok:
        raise IOError(
            "Unable to find package {0} in PyPI repository.".format(package_name)
        )

    r = parse.parse("https://pypi.org/pypi/{name}/json", r.url)
    good_name = r["name"]
    return good_name
169417
def pypi(
    click_ctx,
    requirements,
    index=None,
    python_version=3,
    exclude_packages=None,
    output=None,
    subgraph_check_api=None,
    no_transitive=True,
    no_pretty=False,
):
    """"""
    requirements = [requirement.strip() for requirement in requirements.split("\\n") if requirement]

    if not requirements:
        _LOG.error("No requirements specified, exiting")
        sys.exit(1)

    if not subgraph_check_api:
        _LOG.info(
            "No subgraph check API provided, no queries will be done for dependency subgraphs that should be avoided"
        )  # Ignore PycodestyleBear (E501)

    result = resolve_python(
        requirements,
        index_urls=index.split(",") if index else ("https://pypi.org/simple",),
        python_version=int(python_version),
        transitive=not no_transitive,
        exclude_packages=set(map(str.strip, (exclude_packages or "").split(","))),
        subgraph_check_api=subgraph_check_api,
    )

    print_command_result(
        click_ctx,
        result,
        analyzer=analyzer_name,
        analyzer_version=analyzer_version,
        output=output or "-",
        pretty=not no_pretty,
    )
537162
def nice_pkg_name(name):
    
    logger.debug("%s", name)

    root, ext = os.path.splitext(name)
    logger.debug("root :'%s', ext: '%s'", root, ext)

    if ext in ugly_ext:
        logger.debug("remove ext %s to get %s", ext, root)
        return root

    logger.debug("no change %s", name)
    return name
421249
def dependencies(project_name):
    """"""
    log = logging.getLogger('ciu')
    log.info('Locating dependencies for {}'.format(project_name))
    located = distlib.locators.locate(project_name, prereleases=True)
    if not located:
        log.warning('{0} not found'.format(project_name))
        return None
    return {packaging.utils.canonicalize_name(pypi.just_name(dep))
            for dep in located.run_requires}
522664
def check_project_name
        if @project_name == "b"
          @project_name = nil
          jumpstart_menu
        elsif @project_name == "x"
          @project_name = nil
          exit_normal
        elsif @project_name.nil? || @project_name.empty?
          puts "\n  Enter a name for your project.".yellow
          @project_name = gets.chomp.strip
          check_project_name
        elsif @project_name.length < 3
          puts "\n  The name #{@project_name} is too short. Please enter a name at least 3 characters long.".red
          @project_name = gets.chomp.strip
          check_project_name
        elsif @project_name.match(/^\W/)
          puts "\n  #{@project_name} begins with an invalid character. Please enter a name thats starts with a letter or a number.".red
          @project_name = gets.chomp.strip
          check_project_name
        else
          @project_name
        end
      end
621789
function getProjectName () {
  const pkgJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), {encoding: 'utf8'}))
  return pkgJson.name
}
1288273
def check_pypi(modeladmin, request, queryset):
    """"""
    for p in queryset:
        if p.is_editable:
            logger.debug("Ignoring version update '%s' is editable", p.package_name)
        else:
            p.update_from_pypi()
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.')
709278
def _handle_special_yaml_cases(v):
    
    if "::" in v:
        out = {}
        for part in v.split("::"):
            k_part, v_part = part.split(":")
            out[k_part] = v_part.split(";")
        v = out
    elif ";" in v:
        # split lists and remove accidental empty values
        v = [x for x in v.split(";") if x != ""]
    elif isinstance(v, list):
        v = v
    else:
        try:
            v = int(v)
        except ValueError:
            if v.lower() == "true":
                v = True
            elif v.lower() == "false":
                    v = False
    return v
99658
def _resolve_name(name, package, level):
    """"""
    if not hasattr(package, 'rindex'):
        raise ValueError("'package' not set to a string")
    dot = len(package)
    for x in xrange(level, 1, -1):
        try:
            dot = package.rindex('.', 0, dot)
        except ValueError:
            raise ValueError("attempted relative import beyond top-level "
                              "package")
    return "%s.%s" % (package[:dot], name)
109850
def name(self):
        
        python = self._python
        if self._python.startswith('pypy'):
            # get_env_name adds py-prefix
            python = python[2:]
        return environment.get_env_name(self.tool_name, python, self._requirements)
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 ""
502873
def filter_pypi(self, entry):
        """"""
        for package in self.packages:
            if entry.title.lower().startswith(package):
                return entry
544235
def vary_name(name: Text):
    

    snake = re.match(r'^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$', name)

    if not snake:
        fail('The project name is not a valid snake-case Python variable name')

    camel = [x[0].upper() + x[1:] for x in name.split('_')]

    return {
        'project_name_snake': name,
        'project_name_camel': ''.join(camel),
        'project_name_readable': ' '.join(camel),
    }
1340032
def package_releases(self, project_name):
        
        try:
            return self._connection.package_releases(project_name)
        except Exception as err:
            raise PyPIClientError(err)
647954
def generate_folder_names(name, project):
    """"""

    out_data_dir = prms.Paths.outdatadir
    project_dir = os.path.join(out_data_dir, project)
    batch_dir = os.path.join(project_dir, name)
    raw_dir = os.path.join(batch_dir, "raw_data")
    return out_data_dir, project_dir, batch_dir, raw_dir
1213520
def query_versions_pypi(self, package_name):
        """"""
        if not package_name in self.pkg_list:
            self.logger.debug("Package %s not in cache, querying PyPI..." \
                    % package_name)
            self.fetch_pkg_list()
        #I have to set version=[] for edge cases like "Magic file extensions"
        #but I'm not sure why this happens. It's included with Python or
        #because it has a space in it's name?
        versions = []
        for pypi_pkg in self.pkg_list:
            if pypi_pkg.lower() == package_name.lower():
                if self.debug:
                    self.logger.debug("DEBUG: %s" % package_name)
                versions = self.package_releases(pypi_pkg)
                package_name = pypi_pkg
                break
        return (package_name, versions)