Update NumPy documentation (1.17.0)

pull/1078/head
Jasper van Merle 5 years ago
parent ffb39cba54
commit 4eeca31791

@ -528,8 +528,8 @@ credits = [
'https://raw.githubusercontent.com/npm/npm/master/LICENSE' 'https://raw.githubusercontent.com/npm/npm/master/LICENSE'
], [ ], [
'NumPy', 'NumPy',
'2008-2017 NumPy Developers', '2005-2019 NumPy Developers',
'NumPy', 'BSD',
'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt' 'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt'
], [ ], [
'Octave', 'Octave',

@ -2,9 +2,7 @@ module Docs
class Numpy class Numpy
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
@doc = at_css('#spc-section-body') at_css('#spc-section-body')
doc
end end
end end
end end

@ -3,11 +3,7 @@ module Docs
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
if dt = at_css('dt') if dt = at_css('dt')
name = dt.content.strip name = dt_to_name(dt)
name.sub! %r{\(.*}, '()'
name.remove! %r{[\=\[].*}
name.remove! %r{\A(class(method)?|exception) }
name.remove! %r{\s—.*}
else else
name = at_css('h1').content.strip name = at_css('h1').content.strip
end end
@ -26,14 +22,26 @@ module Docs
type = at_css('h1').content.strip type = at_css('h1').content.strip
type.remove! "\u{00B6}" type.remove! "\u{00B6}"
# Handle some edge cases that arent proberly categorized in the docs # Handle some edge cases that aren't properly categorized in the docs
if type.start_with?('numpy.polynomial.') if type.start_with?('numpy.polynomial.') || type.start_with?('numpy.poly1d.')
type = 'Polynomials' type = 'Polynomials'
elsif type.start_with?('numpy.ufunc.') elsif type.start_with?('numpy.ufunc.')
type = 'Universal functions' type = 'Universal functions'
elsif type.start_with?('numpy.nditer.') elsif type.start_with?('numpy.nditer.') || type.start_with?('numpy.lib.Arrayterator.') || type.start_with?('numpy.flatiter.')
type = 'Indexing routines' type = 'Indexing routines'
elsif type == 'numpy.core.defchararray.chararray.argsort' elsif type.start_with?('numpy.record.') || type.start_with?('numpy.recarray.') || type.start_with?('numpy.broadcast.') || type.start_with?('numpy.matrix.')
type = 'Standard array subclasses'
elsif type.start_with?('numpy.busdaycalendar.')
type = 'Datetime support functions'
elsif type.start_with?('numpy.random.')
type = 'Random sampling'
elsif type.start_with?('numpy.iinfo.')
type = 'Data type routines'
elsif type.start_with?('numpy.dtype.')
type = 'Data type objects'
elsif type.start_with?('numpy.generic.')
type = 'Scalars'
elsif type.start_with?('numpy.char.chararray.') || type.start_with?('numpy.core.defchararray.chararray.')
type = 'String operations' type = 'String operations'
elsif type == 'numpy.memmap.shape' elsif type == 'numpy.memmap.shape'
type = 'Input and output' type = 'Input and output'
@ -50,6 +58,29 @@ module Docs
type.sub! 'swig', 'Swig' type.sub! 'swig', 'Swig'
type type
end end
def additional_entries
css('dl:not(:first-of-type) > dt[id]').each_with_object [] do |node, entries|
name = dt_to_name(node)
if type == 'NumPy C API'
name = name.rpartition(' ').last
name = name[2..-1] if name.start_with?('**')
name = name[1..-1] if name.start_with?('*')
end
entries << [name, node['id']]
end
end
def dt_to_name(dt)
name = dt.content.strip
name.sub! %r{\(.*}, '()'
name.remove! %r{[\=\[].*}
name.remove! %r{\A(class(method)?|exception) }
name.remove! %r{\s—.*}
name.remove! '¶'
end
end end
end end
end end

@ -4,7 +4,7 @@ module Docs
self.type = 'sphinx' self.type = 'sphinx'
self.root_path = 'index.html' self.root_path = 'index.html'
self.links = { self.links = {
home: 'http://www.numpy.org/', home: 'https://www.numpy.org/',
code: 'https://github.com/numpy/numpy' code: 'https://github.com/numpy/numpy'
} }
@ -21,12 +21,27 @@ module Docs
] ]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2008&ndash;2017 NumPy Developers<br> &copy; 2005&ndash;2019 NumPy Developers<br>
Licensed under the NumPy License. Licensed under the 3-clause BSD License.
HTML HTML
version '1.17' do
self.release = '1.17.0'
self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/"
end
version '1.16' do
self.release = '1.16.1'
self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/"
end
version '1.15' do
self.release = '1.15.4'
self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/"
end
version '1.14' do version '1.14' do
self.release = '1.14.2' self.release = '1.14.5'
self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/" self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/"
end end
@ -51,7 +66,8 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
get_latest_github_release('numpy', 'numpy', opts) html = fetch('https://docs.scipy.org/doc/', opts)
html.scan(/Numpy ([0-9.]+) Reference Guide/)[0][0]
end end
end end
end end

Loading…
Cancel
Save