Class: Dependabot::Uv::FileParser

Inherits:
FileParsers::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/uv/file_parser.rb,
lib/dependabot/uv/file_parser/setup_file_parser.rb,
lib/dependabot/uv/file_parser/pipfile_files_parser.rb,
lib/dependabot/uv/file_parser/pyproject_files_parser.rb,
lib/dependabot/uv/file_parser/python_requirement_parser.rb

Defined Under Namespace

Classes: PipfileFilesParser, PyprojectFilesParser, PythonRequirementParser, SetupFileParser

Constant Summary collapse

DEPENDENCY_GROUP_KEYS =
T.let([
  {
    pipfile: "packages",
    lockfile: "default"
  },
  {
    pipfile: "dev-packages",
    lockfile: "develop"
  }
].freeze, T::Array[T::Hash[Symbol, String]])
REQUIREMENT_FILE_EVALUATION_ERRORS =
%w(
  InstallationError RequirementsFileParseError InvalidMarker
  InvalidRequirement ValueError RecursionError
).freeze
UNDETECTED_PACKAGE_MANAGER_VERSION =

we use this placeholder version in case we are not able to detect any PIP version from shell, we are ensuring that the actual update is not blocked in any way if any metric collection exception start happening

"0.0"

Instance Method Summary collapse

Instance Method Details

#ecosystemObject



61
62
63
64
65
66
67
68
69
70
# File 'lib/dependabot/uv/file_parser.rb', line 61

def ecosystem
  @ecosystem ||= T.let(
    Ecosystem.new(
      name: ECOSYSTEM,
      package_manager: package_manager,
      language: language
    ),
    T.nilable(Ecosystem)
  )
end

#parseObject

Raises:

  • (Dependabot::UnexpectedExternalCode)


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/dependabot/uv/file_parser.rb', line 48

def parse
  # TODO: setup.py from external dependencies is evaluated. Provide guards before removing this.
  raise Dependabot::UnexpectedExternalCode if @reject_external_code

  dependency_set = DependencySet.new

  dependency_set += pyproject_file_dependencies if pyproject
  dependency_set += requirement_dependencies if requirement_files.any?

  dependency_set.dependencies
end