Class: Dependabot::Python::UpdateChecker::IndexFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/python/update_checker/index_finder.rb

Constant Summary collapse

PYPI_BASE_URL =
"https://pypi.org/simple/"
ENVIRONMENT_VARIABLE_REGEX =
/\$\{.+\}/

Instance Method Summary collapse

Constructor Details

#initialize(dependency_files:, credentials:, dependency:) ⇒ IndexFinder

Returns a new instance of IndexFinder.



15
16
17
18
19
# File 'lib/dependabot/python/update_checker/index_finder.rb', line 15

def initialize(dependency_files:, credentials:, dependency:)
  @dependency_files = dependency_files
  @credentials      = credentials
  @dependency       = dependency
end

Instance Method Details

#index_urlsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/dependabot/python/update_checker/index_finder.rb', line 21

def index_urls
  extra_index_urls =
    config_variable_index_urls[:extra] +
    pipfile_index_urls[:extra] +
    requirement_file_index_urls[:extra] +
    pip_conf_index_urls[:extra] +
    pyproject_index_urls[:extra]

  extra_index_urls = extra_index_urls.map do |url|
    clean_check_and_remove_environment_variables(url)
  end

  # URL encode any `@` characters within registry URL creds.
  # TODO: The test that fails if the `map` here is removed is likely a
  # bug in Ruby's URI parser, and should be fixed there.
  [main_index_url, *extra_index_urls].map do |url|
    url.rpartition("@").tap { |a| a.first.gsub!("@", "%40") }.join
  end.uniq
end