History

Update Pandas to 1.1.4

- Add version 1 of pandas, add new filters for this version - Pandas' web page changed but the page for older version is the same, for that reason new filters are added and the name old ones are changed

MasterEnoc committed 5 years ago

Commit 9c2ca1f1 parent 4d3bae49 files · +143 −32Browse files

Unified · Split

9 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +1 −1
  2. lib/docs/filters/pandas/clean_html.rb +14 −8
  3. lib/docs/filters/pandas/clean_html_old.rb +20 −0
  4. lib/docs/filters/pandas/entries.rb +18 −18
  5. lib/docs/filters/pandas/entries_old.rb +29 −0
  6. lib/docs/scrapers/pandas.rb +62 −6
  7. public/icons/docs/pandas/16.png +0 −0
  8. public/icons/docs/pandas/16@2x.png +0 −0
  9. public/icons/docs/pandas/SOURCE +1 −1
assets/javascripts/templates/pages/about_tmpl.coffee+1−1
@@ -573,7 +573,7 @@ credits = [ · 572 unmodified lines
573 'https://raw.githubusercontent.com/padrino/padrino-framework/master/padrino/LICENSE.txt'573 'https://raw.githubusercontent.com/padrino/padrino-framework/master/padrino/LICENSE.txt'
574 ], [574 ], [
575 'pandas',575 'pandas',
576 '2008-2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team',576 '2008-2020, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team',
577 'BSD',577 'BSD',
578 'https://raw.githubusercontent.com/pydata/pandas/master/LICENSE'578 'https://raw.githubusercontent.com/pydata/pandas/master/LICENSE'
579 ], [579 ], [
lib/docs/filters/pandas/clean_html.rb+14−8
@@ -2,16 +2,22 @@ module Docs · 1 unmodified line
2 class Pandas2 class Pandas
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 @doc = at_css('.body')
6 5
7 if root_page?6 css('#navbar-main').remove
8 css('a[href$=".zip"]', 'a[href$=".pdf"]', '.toctree-wrapper').remove
9 at_css('h1').content = 'pandas'
10 end
11 7
12 css('h2 > a.reference', 'h3 > a.reference').each do |node|8 css('form').remove
13 node.before(node.children).remove9
14 end10 # sidebar
11 css('ul.nav.bd-sidenav').remove
12
13 # title side symbol
14 css('.headerlink').remove
15
16 # next and previous section buttons
17 css('next-link').remove
18 css('prev-link').remove
19
20 css('footer').remove
15 21
16 doc22 doc
17 end23 end
lib/docs/filters/pandas/clean_html_old.rb+20−0
@@ -0,0 +1,20 @@
1module Docs
2 class Pandas
3 class CleanHtmlOldFilter < Filter
4 def call
5 @doc = at_css('.body')
6
7 if root_page?
8 css('a[href$=".zip"]', 'a[href$=".pdf"]', '.toctree-wrapper').remove
9 at_css('h1').content = 'pandas'
10 end
11
12 css('h2 > a.reference', 'h3 > a.reference').each do |node|
13 node.before(node.children).remove
14 end
15
16 doc
17 end
18 end
19 end
20end
lib/docs/filters/pandas/entries.rb+18−18
@@ -1,29 +1,29 @@
1module Docs1module Docs
2 class Pandas2 class Pandas
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4
4 def get_name5 def get_name
5 if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index'))6 at_css('h1').content
6 name_node = at_css('dt')
7 name_node = at_css('h1') if name_node.nil?
8 name = name_node.content.strip
9 name.sub! %r{\(.*}, '()'
10 name.remove! %r{\s=.*}
11 name.remove! %r{\A(class(method)?) (pandas\.)?}
12 else
13 name = at_css('h1').content.strip
14 name.prepend "#{css('.toctree-l1 > a:not([href^="http"])').to_a.index(at_css('.toctree-l1.current > a')) + 1}. "
15 end
16 name.remove! "\u{00B6}"
17 name
18 end7 end
19 8
20 def get_type9 def get_type
21 if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index'))10 return 'Manual' if slug.include?('user_guide')
22 css('.toctree-l2.current > a').last.content.remove(/\s\(.+?\)/)11 return 'General utility functions' if slug.match?('option|assert|errors|types|show_versions')
23 else12 return 'Extensions' if slug.match?(/extensions|check_array/)
24 'Manual'13 return 'Style' if slug.match?(/style/)
25 end14 return 'Input/output' if slug.match?(/read|io|HDFStore/)
15 return 'Series' if slug.match?(/Series/)
16 return 'GroupBy' if slug.match?(/groupby|Grouper/)
17 return 'DataFrame' if slug.match?(/DataFrame|frame/)
18 return 'Window' if slug.match?(/window|indexers/)
19 return 'Index Objects' if slug.match?(/Index|indexing/)
20 return 'Data offsets' if slug.match?(/offsets?/)
21 return 'Resampling' if slug.match?(/resample/)
22 return 'Plotting' if slug.match?(/plotting/)
23 return 'Pandas arrays' if slug.match?(/arrays?|Timestamp|Datetime|Timedelta|Period|Interval|Categorical|Dtype/)
24 'General functions'
26 end25 end
26
27 end27 end
28 end28 end
29end29end
lib/docs/filters/pandas/entries_old.rb+29−0
@@ -0,0 +1,29 @@
1module Docs
2 class Pandas
3 class EntriesOldFilter < Docs::EntriesFilter
4 def get_name
5 if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index'))
6 name_node = at_css('dt')
7 name_node = at_css('h1') if name_node.nil?
8 name = name_node.content.strip
9 name.sub! %r{\(.*}, '()'
10 name.remove! %r{\s=.*}
11 name.remove! %r{\A(class(method)?) (pandas\.)?}
12 else
13 name = at_css('h1').content.strip
14 name.prepend "#{css('.toctree-l1 > a:not([href^="http"])').to_a.index(at_css('.toctree-l1.current > a')) + 1}. "
15 end
16 name.remove! "\u{00B6}"
17 name
18 end
19
20 def get_type
21 if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index'))
22 css('.toctree-l2.current > a').last.content.remove(/\s\(.+?\)/)
23 else
24 'Manual'
25 end
26 end
27 end
28 end
29end
lib/docs/scrapers/pandas.rb+62−6
@@ -4,61 +4,117 @@ module Docs · 3 unmodified lines
4 self.type = 'sphinx'4 self.type = 'sphinx'
5 self.root_path = 'index.html'5 self.root_path = 'index.html'
6 self.links = {6 self.links = {
7 home: 'http://pandas.pydata.org/',7 home: 'https://pandas.pydata.org/',
8 code: 'https://github.com/pydata/pandas'8 code: 'https://github.com/pydata/pandas'
9 }9 }
10 10
11 html_filters.push 'pandas/entries', 'pandas/clean_html', 'sphinx/clean_html'11 html_filters.push 'pandas/clean_html', 'pandas/entries'
12
13 # Cannot take only the body, as the sidebar gives info about the type.
14 options[:container] = '.document'
15 12
16 options[:skip] = %w(internals.html release.html contributing.html whatsnew.html)13 options[:skip] = %w(internals.html release.html contributing.html whatsnew.html)
17 options[:skip_patterns] = [/whatsnew\//]14 options[:skip_patterns] = [/whatsnew\//]
18 15
19 options[:attribution] = <<-HTML16 options[:attribution] = <<-HTML
20 &copy; 2008&ndash;2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team<br>17 &copy; 2008&ndash;2020, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team<br>
21 Licensed under the 3-clause BSD License.18 Licensed under the 3-clause BSD License.
22 HTML19 HTML
23 20
21 version '1' do
22 self.release = '1.1.4'
23 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
24
25 html_filters.push 'pandas/clean_html', 'pandas/entries'
26
27 options[:skip_patterns] = [
28 /development/,
29 /getting_started/,
30 /whatsnew/
31 ]
32
33 options[:skip] = [
34 'panel.html',
35 'pandas.pdf',
36 'pandas.zip',
37 'ecosystem.html'
38 ]
39
40 end
41
24 version '0.25' do42 version '0.25' do
25 self.release = '0.25.0'43 self.release = '0.25.0'
26 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"44 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
45
46 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
47
48 options[:container] = '.document'
49
27 end50 end
28 51
29 version '0.24' do52 version '0.24' do
30 self.release = '0.24.2'53 self.release = '0.24.2'
31 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"54 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
55
56 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
57 options[:container] = '.document'
58
32 end59 end
33 60
34 version '0.23' do61 version '0.23' do
35 self.release = '0.23.4'62 self.release = '0.23.4'
36 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"63 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
64
65 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
66 options[:container] = '.document'
67
37 end68 end
38 69
39 version '0.22' do70 version '0.22' do
40 self.release = '0.22.0'71 self.release = '0.22.0'
41 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"72 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
73
74 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
75
76 options[:container] = '.document'
77
42 end78 end
43 79
44 version '0.21' do80 version '0.21' do
45 self.release = '0.21.1'81 self.release = '0.21.1'
46 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"82 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
83
84 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
85
86 options[:container] = '.document'
87
47 end88 end
48 89
49 version '0.20' do90 version '0.20' do
50 self.release = '0.20.3'91 self.release = '0.20.3'
51 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"92 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
93
94 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
95
96 options[:container] = '.document'
97
52 end98 end
53 99
54 version '0.19' do100 version '0.19' do
55 self.release = '0.19.2'101 self.release = '0.19.2'
56 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"102 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
103
104 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
105
106 options[:container] = '.document'
107
57 end108 end
58 109
59 version '0.18' do110 version '0.18' do
60 self.release = '0.18.1'111 self.release = '0.18.1'
61 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"112 self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
113
114 html_filters.push 'pandas/entries_old', 'pandas/clean_html_old', 'sphinx/clean_html'
115
116 options[:container] = '.document'
117
62 end118 end
63 119
64 def get_latest_version(opts)120 def get_latest_version(opts)
public/icons/docs/pandas/16.png+0−0

Binary file not shown.

public/icons/docs/pandas/16@2x.png+0−0

Binary file not shown.

public/icons/docs/pandas/SOURCE+1−1
@@ -1 +1 @@
1http://pandas.pydata.org/_static/pandas_logo.png1https://commons.wikimedia.org/wiki/File:Pandas_mark.svg