SIGN IN SIGN UP
2013-11-26 13:41:18 +01:00
module Docs
2024-07-24 23:57:30 +02:00
class Python < UrlScraper
self.type = 'python'
self.root_path = 'index.html'
self.links = {
home: 'https://www.python.org/',
code: 'https://github.com/python/cpython'
}
2013-11-26 13:41:18 +01:00
# bypass the clean_text filter as it removes empty span with ids
options[:clean_text] = false
# bypass sphinx modifying empty ids
options[:sphinx_keep_empty_ids] = true
options[:skip_patterns] = [/whatsnew/]
2013-11-26 13:41:18 +01:00
options[:skip] = %w(
library/2to3.html
library/formatter.html
library/intro.html
library/undoc.html
library/unittest.mock-examples.html
library/sunau.html)
options[:attribution] = <<-HTML
2025-03-06 09:51:31 +01:00
&copy; 2001&ndash;2025 Python Software Foundation<br>
2013-11-26 13:41:18 +01:00
Licensed under the PSF License.
HTML
2016-01-17 13:30:46 -05:00
version '3.14' do
2026-03-04 20:36:18 +01:00
self.release = '3.14.3'
self.base_url = "https://docs.python.org/#{self.version}/"
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
version '3.13' do
2025-10-08 08:59:07 +02:00
self.release = '3.13.8'
self.base_url = "https://docs.python.org/#{self.version}/"
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
2023-10-09 21:11:34 +02:00
version '3.12' do
2025-03-06 09:51:31 +01:00
self.release = '3.12.9'
2023-10-09 21:11:34 +02:00
self.base_url = "https://docs.python.org/#{self.version}/"
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
version '3.11' do
2025-03-06 09:51:31 +01:00
self.release = '3.11.11'
self.base_url = "https://docs.python.org/#{self.version}/"
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
2021-10-25 17:02:28 +02:00
version '3.10' do
2023-10-09 21:11:34 +02:00
self.release = '3.10.13'
2021-10-25 17:02:28 +02:00
self.base_url = "https://docs.python.org/#{self.version}/"
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
2021-04-30 00:02:19 +02:00
version '3.9' do
self.release = '3.9.14'
2020-11-13 00:23:28 +01:00
self.base_url = 'https://docs.python.org/3.9/'
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
2021-04-30 00:02:19 +02:00
version '3.8' do
self.release = '3.8.14'
2019-11-24 17:23:50 +01:00
self.base_url = 'https://docs.python.org/3.8/'
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
2021-04-30 00:02:19 +02:00
version '3.7' do
self.release = '3.7.14'
2018-07-08 16:34:29 -04:00
self.base_url = 'https://docs.python.org/3.7/'
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
2021-04-30 00:02:19 +02:00
version '3.6' do
2020-11-13 00:21:59 +01:00
self.release = '3.6.12'
self.base_url = 'https://docs.python.org/3.6/'
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
end
2021-04-30 00:02:19 +02:00
version '3.5' do
2019-11-24 17:23:50 +01:00
self.release = '3.5.9'
2016-01-17 13:30:46 -05:00
self.base_url = 'https://docs.python.org/3.5/'
2016-07-03 18:45:29 -04:00
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
2016-01-17 13:30:46 -05:00
end
2021-04-30 00:02:19 +02:00
version '2.7' do
self.release = '2.7.17'
2016-01-17 13:30:46 -05:00
self.base_url = 'https://docs.python.org/2.7/'
2016-07-03 18:45:29 -04:00
html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html'
2016-01-17 13:30:46 -05:00
end
2019-03-10 03:02:24 +01:00
def get_latest_version(opts)
doc = fetch_doc('https://docs.python.org/', opts)
doc.at_css('title').content.split(' ')[0]
end
2013-11-26 13:41:18 +01:00
end
end