Upgrade TensorFlow 2.1
Showing the changes to lib/docs (3 of 7 files). Show all
Unified · Split
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | def call |
| 5 | 5 | @doc = at_css('.devsite-article-inner') |
| 6 | 6 | |
| 7 | − css('hr', '.devsite-nav', '.devsite-content-footer', '.devsite-article-body > br').remove | |
| 7 | + css('hr', '.devsite-nav', '.devsite-content-footer', '.devsite-article-body > br', '.devsite-article-meta', 'devsite-nav-buttons').remove | |
| 8 | 8 | |
| 9 | 9 | css('aside.note').each do |node| |
| 10 | 10 | node.name = 'blockquote' |
| @@ -7,35 +7,108 @@ module Docs · 6 unmodified lines | ||
| 7 | 7 | name = at_css('h1').content.strip |
| 8 | 8 | name.remove! 'class ' |
| 9 | 9 | name.remove! 'struct ' |
| 10 | − name.remove! 'module: ' | |
| 10 | + name.remove! 'Module: ' | |
| 11 | 11 | name.remove! %r{ \(.+\)} |
| 12 | 12 | name.sub! %r{(?<!\ )\(.+\)}, '()' |
| 13 | 13 | name.remove! %r{\.\z} |
| 14 | − name.sub! 'tf.contrib', 'contrib' unless version == 'Guide' | |
| 15 | 14 | name |
| 16 | 15 | end |
| 17 | 16 | |
| 18 | − TYPE_BY_DIR = { | |
| 19 | − 'get_started' => 'Get Started', | |
| 20 | − 'programmers_guide' => 'Guide', | |
| 21 | − 'tutorials' => 'Tutorials', | |
| 22 | − 'performance' => 'Performance', | |
| 23 | − 'deploy' => 'Deploy', | |
| 24 | − 'extend' => 'Extend' | |
| 25 | − } | |
| 26 | − | |
| 27 | 17 | def get_type |
| 28 | − return 'Guides' if base_url.path.start_with?('/api_guides') | |
| 29 | − | |
| 30 | − if version == 'Guide' | |
| 31 | − TYPE_BY_DIR[subpath.split('/').first] | |
| 18 | + if version == 'Guide' and base_url.path.start_with?('/guide') | |
| 19 | + 'Guides' | |
| 20 | + elsif version == 'Guide' and base_url.path.start_with?('/tutorials') | |
| 21 | + 'Tutorials' | |
| 22 | + elsif slug.start_with?('tf/audio') | |
| 23 | + 'tf.audio' | |
| 24 | + elsif slug.start_with?('tf/autograph') | |
| 25 | + 'tf.autograph' | |
| 26 | + elsif slug.start_with?('tf/bitwise') | |
| 27 | + 'tf.bitwise' | |
| 28 | + elsif slug.start_with?('tf/compat') | |
| 29 | + 'tf.compat' | |
| 30 | + elsif slug.start_with?('tf/config') | |
| 31 | + 'tf.config' | |
| 32 | + elsif slug.start_with?('tf/data') | |
| 33 | + 'tf.data' | |
| 34 | + elsif slug.start_with?('tf/debugging') | |
| 35 | + 'tf.debugging' | |
| 36 | + elsif slug.start_with?('tf/distribute') | |
| 37 | + 'tf.distribute' | |
| 38 | + elsif slug.start_with?('tf/dtypes') | |
| 39 | + 'tf.dtypes' | |
| 40 | + elsif slug.start_with?('tf/errors') | |
| 41 | + 'tf.errors' | |
| 42 | + elsif slug.start_with?('tf/estimator') | |
| 43 | + 'tf.estimator' | |
| 44 | + elsif slug.start_with?('tf/experimental') | |
| 45 | + 'tf.experimental' | |
| 46 | + elsif slug.start_with?('tf/feature_column') | |
| 47 | + 'tf.feature_column' | |
| 48 | + elsif slug.start_with?('tf/graph_util') | |
| 49 | + 'tf.graph_util' | |
| 50 | + elsif slug.start_with?('tf/image') | |
| 51 | + 'tf.image' | |
| 52 | + elsif slug.start_with?('tf/initializers') | |
| 53 | + 'tf.initializers' | |
| 54 | + elsif slug.start_with?('tf/io') | |
| 55 | + 'tf.io' | |
| 56 | + elsif slug.start_with?('tf/keras') | |
| 57 | + 'tf.keras' | |
| 58 | + elsif slug.start_with?('tf/linalg') | |
| 59 | + 'tf.linalg' | |
| 60 | + elsif slug.start_with?('tf/lite') | |
| 61 | + 'tf.lite' | |
| 62 | + elsif slug.start_with?('tf/lookup') | |
| 63 | + 'tf.lookup' | |
| 64 | + elsif slug.start_with?('tf/losses') | |
| 65 | + 'tf.losses' | |
| 66 | + elsif slug.start_with?('tf/math') | |
| 67 | + 'tf.math' | |
| 68 | + elsif slug.start_with?('tf/metrics') | |
| 69 | + 'tf.metrics' | |
| 70 | + elsif slug.start_with?('tf/nest') | |
| 71 | + 'tf.nest' | |
| 72 | + elsif slug.start_with?('tf/nn') | |
| 73 | + 'tf.nn' | |
| 74 | + elsif slug.start_with?('tf/optimizers') | |
| 75 | + 'tf.optimizers' | |
| 76 | + elsif slug.start_with?('tf/quantization') | |
| 77 | + 'tf.quantization' | |
| 78 | + elsif slug.start_with?('tf/queue') | |
| 79 | + 'tf.queue' | |
| 80 | + elsif slug.start_with?('tf/ragged') | |
| 81 | + 'tf.ragged' | |
| 82 | + elsif slug.start_with?('tf/random') | |
| 83 | + 'tf.random' | |
| 84 | + elsif slug.start_with?('tf/raw_ops') | |
| 85 | + 'tf.raw_ops' | |
| 86 | + elsif slug.start_with?('tf/saved_model') | |
| 87 | + 'tf.saved_model' | |
| 88 | + elsif slug.start_with?('tf/sets') | |
| 89 | + 'tf.sets' | |
| 90 | + elsif slug.start_with?('tf/signal') | |
| 91 | + 'tf.signal' | |
| 92 | + elsif slug.start_with?('tf/sparse') | |
| 93 | + 'tf.sparse' | |
| 94 | + elsif slug.start_with?('tf/strings') | |
| 95 | + 'tf.strings' | |
| 96 | + elsif slug.start_with?('tf/summary') | |
| 97 | + 'tf.summary' | |
| 98 | + elsif slug.start_with?('tf/sysconfig') | |
| 99 | + 'tf.sysconfig' | |
| 100 | + elsif slug.start_with?('tf/test') | |
| 101 | + 'tf.test' | |
| 102 | + elsif slug.start_with?('tf/tpu') | |
| 103 | + 'tf.tpu' | |
| 104 | + elsif slug.start_with?('tf/train') | |
| 105 | + 'tf.train' | |
| 106 | + elsif slug.start_with?('tf/version') | |
| 107 | + 'tf.version' | |
| 108 | + elsif slug.start_with?('tf/xla') | |
| 109 | + 'tf.xla' | |
| 32 | 110 | else |
| 33 | − node = at_css('.devsite-nav-item.devsite-nav-active') | |
| 34 | − node = node.ancestors('.devsite-nav-item').first.at_css('.devsite-nav-title') | |
| 35 | − type = node.content | |
| 36 | − type.remove! %r{\.\z} | |
| 37 | − type = 'tf.contrib' if type.start_with?('tf.contrib') | |
| 38 | − type | |
| 111 | + 'tf' | |
| 39 | 112 | end |
| 40 | 113 | end |
| 41 | 114 | end |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | class Tensorflow < UrlScraper |
| 5 | 5 | self.name = 'TensorFlow' |
| 6 | 6 | self.type = 'tensorflow' |
| 7 | − self.release = '1.8' | |
| 7 | + self.release = '2.1' | |
| 8 | 8 | self.root_path = 'index.html' |
| 9 | 9 | self.links = { |
| 10 | 10 | home: 'https://www.tensorflow.org/', |
| @@ -16,44 +16,23 @@ module Docs · 5 unmodified lines | ||
| 16 | 16 | options[:max_image_size] = 300_000 |
| 17 | 17 | options[:container] = '.devsite-main-content' |
| 18 | 18 | |
| 19 | − options[:fix_urls] = ->(url) do | |
| 20 | − url.sub! 'how_tos/../tutorials', 'tutorials' | |
| 21 | − url | |
| 22 | − end | |
| 23 | − | |
| 24 | 19 | options[:attribution] = <<-HTML |
| 25 | − © 2018 The TensorFlow Authors. All rights reserved.<br> | |
| 20 | + © 2019 The TensorFlow Authors. All rights reserved.<br> | |
| 26 | 21 | Licensed under the Creative Commons Attribution License 3.0.<br> |
| 27 | 22 | Code samples licensed under the Apache 2.0 License. |
| 28 | 23 | HTML |
| 29 | 24 | |
| 30 | 25 | version 'Python' do |
| 31 | − include MultipleBaseUrls | |
| 32 | − self.base_urls = ['https://www.tensorflow.org/api_docs/python/', 'https://www.tensorflow.org/api_guides/python/'] | |
| 26 | + self.base_url = 'https://www.tensorflow.org/api_docs/python/' | |
| 33 | 27 | end |
| 34 | 28 | |
| 35 | 29 | version 'C++' do |
| 36 | − include MultipleBaseUrls | |
| 37 | − self.base_urls = ['https://www.tensorflow.org/api_docs/cc/', 'https://www.tensorflow.org/api_guides/cc/'] | |
| 30 | + self.base_url = 'https://www.tensorflow.org/api_docs/cc/' | |
| 38 | 31 | end |
| 39 | 32 | |
| 40 | 33 | version 'Guide' do |
| 41 | − self.base_url = 'https://www.tensorflow.org/' | |
| 42 | − self.root_path = 'get_started/get_started' | |
| 43 | − self.initial_paths = %w( | |
| 44 | − programmers_guide/reading_data | |
| 45 | − tutorials/mandelbrot | |
| 46 | − performance/performance_guide | |
| 47 | − deploy/hadoop | |
| 48 | − extend/architecture) | |
| 49 | − | |
| 50 | − options[:only_patterns] = [ | |
| 51 | − /\Aget_started/, | |
| 52 | − /\Aprogrammers_guide/, | |
| 53 | − /\Atutorials/, | |
| 54 | − /\Aperformance/, | |
| 55 | − /\Adeploy/, | |
| 56 | − /\Aextend/] | |
| 34 | + include MultipleBaseUrls | |
| 35 | + self.base_urls = ['https://www.tensorflow.org/guide/', 'https://www.tensorflow.org/tutorials/'] | |
| 57 | 36 | end |
| 58 | 37 | |
| 59 | 38 | def get_latest_version(opts) |