Class: Dependabot::Python::FileParser

Inherits:
FileParsers::Base
  • Object
show all
Defined in:
lib/dependabot/python/file_parser.rb,
lib/dependabot/python/file_parser/setup_file_parser.rb,
lib/dependabot/python/file_parser/poetry_files_parser.rb,
lib/dependabot/python/file_parser/pipfile_files_parser.rb,
lib/dependabot/python/file_parser/python_requirement_parser.rb

Defined Under Namespace

Classes: PipfileFilesParser, PoetryFilesParser, PythonRequirementParser, SetupFileParser

Constant Summary collapse

POETRY_DEPENDENCY_TYPES =
%w(tool.poetry.dependencies tool.poetry.dev-dependencies).freeze
DEPENDENCY_GROUP_KEYS =
[
  {
    pipfile: "packages",
    lockfile: "default"
  },
  {
    pipfile: "dev-packages",
    lockfile: "develop"
  }
].freeze
REQUIREMENT_FILE_EVALUATION_ERRORS =
%w(
  InstallationError RequirementsFileParseError InvalidMarker
  InvalidRequirement ValueError RecursionError
).freeze

Instance Method Summary collapse

Instance Method Details

#parseObject


38
39
40
41
42
43
44
45
46
47
# File 'lib/dependabot/python/file_parser.rb', line 38

def parse
  dependency_set = DependencySet.new

  dependency_set += pipenv_dependencies if pipfile
  dependency_set += poetry_dependencies if using_poetry?
  dependency_set += requirement_dependencies if requirement_files.any?
  dependency_set += setup_file_dependencies if setup_file

  dependency_set.dependencies
end