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
573573 'https://raw.githubusercontent.com/padrino/padrino-framework/master/padrino/LICENSE.txt'
574574 ], [
575575 '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',
577577 'BSD',
578578 'https://raw.githubusercontent.com/pydata/pandas/master/LICENSE'
579579 ], [
lib/docs/filters/pandas/clean_html.rb+14−8
@@ -2,16 +2,22 @@ module Docs · 1 unmodified line
22 class Pandas
33 class CleanHtmlFilter < Filter
44 def call
5− @doc = at_css('.body')
65
7− if root_page?
8− css('a[href$=".zip"]', 'a[href$=".pdf"]', '.toctree-wrapper').remove
9− at_css('h1').content = 'pandas'
10− end
6+ css('#navbar-main').remove
117
12− css('h2 > a.reference', 'h3 > a.reference').each do |node|
13− node.before(node.children).remove
14− end
8+ css('form').remove
9+
10+ # 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
1521
1622 doc
1723 end
lib/docs/filters/pandas/clean_html_old.rb+20−0
@@ -0,0 +1,20 @@
1+module 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
20+end
lib/docs/filters/pandas/entries.rb+18−18
@@ -1,29 +1,29 @@
11 module Docs
22 class Pandas
33 class EntriesFilter < Docs::EntriesFilter
4+
45 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
6+ at_css('h1').content
187 end
198
209 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
10+ return 'Manual' if slug.include?('user_guide')
11+ return 'General utility functions' if slug.match?('option|assert|errors|types|show_versions')
12+ return 'Extensions' if slug.match?(/extensions|check_array/)
13+ return 'Style' if slug.match?(/style/)
14+ 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'
2625 end
26+
2727 end
2828 end
2929 end
lib/docs/filters/pandas/entries_old.rb+29−0
@@ -0,0 +1,29 @@
1+module 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
29+end
lib/docs/scrapers/pandas.rb+62−6
@@ -4,61 +4,117 @@ module Docs · 3 unmodified lines
44 self.type = 'sphinx'
55 self.root_path = 'index.html'
66 self.links = {
7− home: 'http://pandas.pydata.org/',
7+ home: 'https://pandas.pydata.org/',
88 code: 'https://github.com/pydata/pandas'
99 }
1010
11− html_filters.push 'pandas/entries', 'pandas/clean_html', 'sphinx/clean_html'
12−
13− # Cannot take only the body, as the sidebar gives info about the type.
14− options[:container] = '.document'
11+ html_filters.push 'pandas/clean_html', 'pandas/entries'
1512
1613 options[:skip] = %w(internals.html release.html contributing.html whatsnew.html)
1714 options[:skip_patterns] = [/whatsnew\//]
1815
1916 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>
2118 Licensed under the 3-clause BSD License.
2219 HTML
2320
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+
2442 version '0.25' do
2543 self.release = '0.25.0'
2644 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+
2750 end
2851
2952 version '0.24' do
3053 self.release = '0.24.2'
3154 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+
3259 end
3360
3461 version '0.23' do
3562 self.release = '0.23.4'
3663 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+
3768 end
3869
3970 version '0.22' do
4071 self.release = '0.22.0'
4172 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+
4278 end
4379
4480 version '0.21' do
4581 self.release = '0.21.1'
4682 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+
4788 end
4889
4990 version '0.20' do
5091 self.release = '0.20.3'
5192 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+
5298 end
5399
54100 version '0.19' do
55101 self.release = '0.19.2'
56102 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+
57108 end
58109
59110 version '0.18' do
60111 self.release = '0.18.1'
61112 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+
62118 end
63119
64120 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 @@
1−http://pandas.pydata.org/_static/pandas_logo.png
1+https://commons.wikimedia.org/wiki/File:Pandas_mark.svg