scikit_learn.rb 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. module Docs
  2. class ScikitLearn < UrlScraper
  3. self.name = 'scikit-learn'
  4. self.slug = 'scikit_learn'
  5. self.type = 'sphinx'
  6. self.release = '0.20.0'
  7. self.base_url = 'http://scikit-learn.org/stable/'
  8. self.root_path = 'documentation.html'
  9. self.force_gzip = true
  10. self.links = {
  11. home: 'http://scikit-learn.org/',
  12. code: 'https://github.com/scikit-learn/scikit-learn'
  13. }
  14. html_filters.push 'scikit_learn/entries', 'scikit_learn/clean_html', 'sphinx/clean_html'
  15. options[:container] = ->(filter) { filter.root_page? ? '.container-index' : '.body' }
  16. options[:skip] = %w(tutorial/statistical_inference/finding_help.html)
  17. options[:only_patterns] = [/\Amodules/, /\Adatasets/, /\Atutorial/, /\Aauto_examples/]
  18. options[:skip_patterns] = [/\Adatasets\/(?!index)/]
  19. options[:max_image_size] = 256_000
  20. options[:attribution] = <<-HTML
  21. &copy; 2007&ndash;2018 The scikit-learn developers<br>
  22. Licensed under the 3-clause BSD License.
  23. HTML
  24. def get_latest_version(opts)
  25. doc = fetch_doc('https://scikit-learn.org/stable/documentation.html', opts)
  26. doc.at_css('.body h1').content.scan(/([0-9.]+)/)[0][0]
  27. end
  28. end
  29. end