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/pipfile_files_parser.rb,
lib/dependabot/python/file_parser/pyproject_files_parser.rb,
lib/dependabot/python/file_parser/python_requirement_parser.rb

Defined Under Namespace

Classes: PipfileFilesParser, PyprojectFilesParser, PythonRequirementParser, SetupFileParser

Constant Summary collapse

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

Raises:

  • (Dependabot::UnexpectedExternalCode)


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

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 += pipenv_dependencies if pipfile
  dependency_set += pyproject_file_dependencies if pyproject
  dependency_set += requirement_dependencies if requirement_files.any?
  dependency_set += setup_file_dependencies if setup_file || setup_cfg_file

  dependency_set.dependencies
end