mirror of https://github.com/freeCodeCamp/devdocs
parent
e1937ff575
commit
1dbc03fab4
@ -0,0 +1,54 @@
|
||||
module Docs
|
||||
class ScikitLearn
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
# Classes, functions and methods
|
||||
if subpath.start_with?('modules/generated')
|
||||
name = at_css('dt').content.strip
|
||||
name.sub! %r{\(.*}, '()' # Remove function arguments
|
||||
name.remove! %r{[\=\[].*} # Remove [source] anchor
|
||||
# name.remove! %r{\s=.*} # Remove the occasional '=' in class names
|
||||
name.remove! %r{\A(class(method)?) (sklearn\.)?}
|
||||
else
|
||||
# User guide
|
||||
name = at_css('h1').content.strip
|
||||
end
|
||||
|
||||
name.remove! "\u{00B6}"
|
||||
name
|
||||
end
|
||||
|
||||
def get_type
|
||||
# Classes, functions and methods
|
||||
if subpath.start_with?('modules/generated')
|
||||
type = at_css('dt > .descclassname').content.strip
|
||||
type.remove! 'sklearn.'
|
||||
type.remove! '.'
|
||||
type
|
||||
else
|
||||
'Guide'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
entries = []
|
||||
|
||||
css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node|
|
||||
entries << [node['id'].remove('sklearn.'), node['id']]
|
||||
end
|
||||
|
||||
css('.data > dt[id]').each do |node|
|
||||
if node['id'].split('.').last.upcase! # skip constants
|
||||
entries << [node['id'].remove('sklearn.'), node['id']]
|
||||
end
|
||||
end
|
||||
|
||||
css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node|
|
||||
entries << [node['id'].remove('sklearn.') + '()', node['id']]
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,36 @@
|
||||
module Docs
|
||||
class ScikitLearn < UrlScraper
|
||||
self.name = 'scikit-learn'
|
||||
self.slug = 'scikit_learn'
|
||||
self.type = 'sphinx'
|
||||
self.release = '0.17.1'
|
||||
self.base_url = "http://scikit-learn.org/0.17/"
|
||||
self.root_path = 'documentation.html'
|
||||
self.initial_paths = %w(
|
||||
user_guide.html
|
||||
supervised_learning.html
|
||||
unsupervised_learning.html
|
||||
model_selection.html
|
||||
data_transforms.html)
|
||||
|
||||
self.links = {
|
||||
home: 'http://scikit-learn.org/',
|
||||
code: 'https://github.com/scikit-learn/scikit-learn'
|
||||
}
|
||||
|
||||
html_filters.push 'scikit_learn/entries', 'sphinx/clean_html'
|
||||
|
||||
options[:container] = '.body'
|
||||
|
||||
options[:root_title] = self.name
|
||||
|
||||
options[:only] = self.initial_paths
|
||||
options[:only_patterns] = [/\Amodules/, /\Adatasets/]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2007–2016 The scikit-learn deveopers<br>
|
||||
Licensed under the 3-clause BSD License.
|
||||
HTML
|
||||
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 270 B |
After Width: | Height: | Size: 636 B |
@ -0,0 +1 @@
|
||||
http://scikit-learn.org/stable/_static/favicon.ico
|
Loading…
Reference in new issue