Class: Contextizer::Analyzers::PythonAnalyzer

Inherits:
Base
  • Object
show all
Defined in:
lib/contextizer/analyzers/python_analyzer.rb

Constant Summary collapse

LANGUAGE =
:python
SIGNALS =
[
  { type: :file, path: "requirements.txt", weight: 10 },
  { type: :file, path: "pyproject.toml", weight: 10 },
].freeze
FRAMEWORK_SIGNALS =
{
  # rails: [{ type: :file, path: "bin/rails", weight: 15 }]
}.freeze

Instance Method Summary collapse

Methods inherited from Base

call, #initialize

Constructor Details

This class inherits a constructor from Contextizer::Analyzers::Base

Instance Method Details

#analyzeObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/contextizer/analyzers/python_analyzer.rb', line 17

def analyze
  SIGNALS.each { |signal| @score += signal[:weight] if check_signal(signal) }

  return nil if @score.zero?

  {
    language: LANGUAGE,
    framework: detect_framework,
    score: @score
  }
end