Class: Dependabot::Python::FileParser::PepDependency
- Inherits:
-
T::ImmutableStruct
- Object
- T::ImmutableStruct
- Dependabot::Python::FileParser::PepDependency
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/python/file_parser/pep_dependency.rb
Class Method Summary collapse
- .from_helper_result(result) ⇒ Object
- .from_object(value) ⇒ Object
- .from_requirements_helper_result(result) ⇒ Object
Class Method Details
.from_helper_result(result) ⇒ Object
25 26 27 28 29 |
# File 'lib/dependabot/python/file_parser/pep_dependency.rb', line 25 def self.from_helper_result(result) PyprojectValueParser.array(result, "PEP dependency result").map do |value| from_object(value) end end |
.from_object(value) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/dependabot/python/file_parser/pep_dependency.rb', line 43 def self.from_object(value) hash = PyprojectValueParser.object_hash(value, "PEP dependency") new( name: PyprojectValueParser.string(hash["name"], "PEP dependency name"), version: PyprojectValueParser.optional_string(hash["version"], "PEP dependency version"), markers: PyprojectValueParser.optional_string(hash["markers"], "PEP dependency markers"), file: PyprojectValueParser.string(hash["file"], "PEP dependency file"), requirement: PyprojectValueParser.optional_string(hash["requirement"], "PEP dependency requirement"), source_requirement: PyprojectValueParser.optional_string( hash["source_requirement"], "PEP dependency source_requirement" ), extras: PyprojectValueParser.string_array(hash["extras"], "PEP dependency extras"), requirement_type: PyprojectValueParser.optional_string( hash["requirement_type"], "PEP dependency requirement_type" ) ) end |
.from_requirements_helper_result(result) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/dependabot/python/file_parser/pep_dependency.rb', line 32 def self.from_requirements_helper_result(result) PyprojectValueParser.array(result, "parse_requirements result").each_with_index.map do |value, index| from_object(value) rescue TypeError => e raise Dependabot::DependencyFileNotEvaluatable, "parse_requirements result[#{index}]: #{e.}" end rescue TypeError => e raise Dependabot::DependencyFileNotEvaluatable, e. end |