[devdocsgjs/main: 915/1867] Update NumPy documentation (1.17.0)




commit 4eeca31791865032b9257e04fbda1b7796fe9dba
Author: Jasper van Merle <jaspervmerle gmail com>
Date:   Tue Sep 3 04:13:33 2019 +0200

    Update NumPy documentation (1.17.0)

 .../javascripts/templates/pages/about_tmpl.coffee  |  4 +-
 lib/docs/filters/numpy/clean_html.rb               |  4 +-
 lib/docs/filters/numpy/entries.rb                  | 49 ++++++++++++++++++----
 lib/docs/scrapers/numpy.rb                         | 26 +++++++++---
 4 files changed, 64 insertions(+), 19 deletions(-)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index 5c5d316f..173a9c19 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -528,8 +528,8 @@ credits = [
     'https://raw.githubusercontent.com/npm/npm/master/LICENSE'
   ], [
     'NumPy',
-    '2008-2017 NumPy Developers',
-    'NumPy',
+    '2005-2019 NumPy Developers',
+    'BSD',
     'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt'
   ], [
     'Octave',
diff --git a/lib/docs/filters/numpy/clean_html.rb b/lib/docs/filters/numpy/clean_html.rb
index a01a5e1b..65fb345c 100644
--- a/lib/docs/filters/numpy/clean_html.rb
+++ b/lib/docs/filters/numpy/clean_html.rb
@@ -2,9 +2,7 @@ module Docs
   class Numpy
     class CleanHtmlFilter < Filter
       def call
-        @doc = at_css('#spc-section-body')
-
-        doc
+        at_css('#spc-section-body')
       end
     end
   end
diff --git a/lib/docs/filters/numpy/entries.rb b/lib/docs/filters/numpy/entries.rb
index e1e4bdad..3819d644 100644
--- a/lib/docs/filters/numpy/entries.rb
+++ b/lib/docs/filters/numpy/entries.rb
@@ -3,11 +3,7 @@ module Docs
     class EntriesFilter < Docs::EntriesFilter
       def get_name
         if dt = at_css('dt')
-          name = dt.content.strip
-          name.sub! %r{\(.*}, '()'
-          name.remove! %r{[\=\[].*}
-          name.remove! %r{\A(class(method)?|exception) }
-          name.remove! %r{\s—.*}
+          name = dt_to_name(dt)
         else
           name = at_css('h1').content.strip
         end
@@ -26,14 +22,26 @@ module Docs
           type = at_css('h1').content.strip
           type.remove! "\u{00B6}"
 
-          # Handle some edge cases that arent proberly categorized in the docs
-          if type.start_with?('numpy.polynomial.')
+          # Handle some edge cases that aren't properly categorized in the docs
+          if type.start_with?('numpy.polynomial.') || type.start_with?('numpy.poly1d.')
             type = 'Polynomials'
           elsif type.start_with?('numpy.ufunc.')
             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'
-          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'
           elsif type == 'numpy.memmap.shape'
             type = 'Input and output'
@@ -50,6 +58,29 @@ module Docs
         type.sub! 'swig', 'Swig'
         type
       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
diff --git a/lib/docs/scrapers/numpy.rb b/lib/docs/scrapers/numpy.rb
index 84de6cab..6b65b714 100644
--- a/lib/docs/scrapers/numpy.rb
+++ b/lib/docs/scrapers/numpy.rb
@@ -4,7 +4,7 @@ module Docs
     self.type = 'sphinx'
     self.root_path = 'index.html'
     self.links = {
-      home: 'http://www.numpy.org/',
+      home: 'https://www.numpy.org/',
       code: 'https://github.com/numpy/numpy'
     }
 
@@ -21,12 +21,27 @@ module Docs
     ]
 
     options[:attribution] = <<-HTML
-      &copy; 2008&ndash;2017 NumPy Developers<br>
-      Licensed under the NumPy License.
+      &copy; 2005&ndash;2019 NumPy Developers<br>
+      Licensed under the 3-clause BSD License.
     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
-      self.release = '1.14.2'
+      self.release = '1.14.5'
       self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/";
     end
 
@@ -51,7 +66,8 @@ module Docs
     end
 
     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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]