We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Docs build lottery
## 🐛 Bug

@ehofesmann We still seem to be getting this issue:
```
intersphinx inventory 'https://voxel51.com/docs/fiftyone/objects.inv' not fetchable due to <class 'requests.exceptions.ConnectionError'>: HTTPSConnectionPool(host='voxel51.com', port=443): Max retries exceeded with url: /docs/fiftyone/objects.inv (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5fbc2d56d0>: Failed to establish a new connection: [Errno 110] Connection timed out'))
```
Example here: https://github.com/PyTorchLightning/lightning-flash/pull/426/checks?check_run_id=2860706755

Is it because we have multiple CI trying to get it at once?

I think for now we can probably try to just ignore that warning, but would be interested to know the root cause. @Borda any idea how we can ignore just a specific warning in sphinx build? Or any idea what might be causing the issue?

(Just to provide some context, we typically get the error then I re-trigger the build and it's fine)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `flash/core/utilities/imports.py`
Content:
```
1 # Copyright The PyTorch Lightning team.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """General utilities"""
15 import importlib
16 import operator
17 from importlib.util import find_spec
18 
19 from pkg_resources import DistributionNotFound
20 
21 try:
22     from packaging.version import Version
23 except (ModuleNotFoundError, DistributionNotFound):
24     Version = None
25 
26 
27 def _module_available(module_path: str) -> bool:
28     """
29     Check if a path is available in your environment
30 
31     >>> _module_available('os')
32     True
33     >>> _module_available('bla.bla')
34     False
35     """
36     try:
37         return find_spec(module_path) is not None
38     except AttributeError:
39         # Python 3.6
40         return False
41     except ModuleNotFoundError:
42         # Python 3.7+
43         return False
44 
45 
46 def _compare_version(package: str, op, version) -> bool:
47     """
48     Compare package version with some requirements
49 
50     >>> _compare_version("torch", operator.ge, "0.1")
51     True
52     """
53     try:
54         pkg = importlib.import_module(package)
55     except (ModuleNotFoundError, DistributionNotFound, ValueError):
56         return False
57     try:
58         pkg_version = Version(pkg.__version__)
59     except TypeError:
60         # this is mock by sphinx, so it shall return True ro generate all summaries
61         return True
62     return op(pkg_version, Version(version))
63 
64 
65 _TORCH_AVAILABLE = _module_available("torch")
66 _BOLTS_AVAILABLE = _module_available("pl_bolts") and _compare_version("torch", operator.lt, "1.9.0")
67 _PANDAS_AVAILABLE = _module_available("pandas")
68 _SKLEARN_AVAILABLE = _module_available("sklearn")
69 _TABNET_AVAILABLE = _module_available("pytorch_tabnet")
70 _KORNIA_AVAILABLE = _module_available("kornia")
71 _COCO_AVAILABLE = _module_available("pycocotools")
72 _TIMM_AVAILABLE = _module_available("timm")
73 _TORCHVISION_AVAILABLE = _module_available("torchvision")
74 _PYTORCHVIDEO_AVAILABLE = _module_available("pytorchvideo")
75 _MATPLOTLIB_AVAILABLE = _module_available("matplotlib")
76 _TRANSFORMERS_AVAILABLE = _module_available("transformers")
77 _PYSTICHE_AVAILABLE = _module_available("pystiche")
78 _FIFTYONE_AVAILABLE = _module_available("fiftyone")
79 _FASTAPI_AVAILABLE = _module_available("fastapi")
80 _PYDANTIC_AVAILABLE = _module_available("pydantic")
81 _GRAPHVIZ_AVAILABLE = _module_available("graphviz")
82 _CYTOOLZ_AVAILABLE = _module_available("cytoolz")
83 _UVICORN_AVAILABLE = _module_available("uvicorn")
84 _PIL_AVAILABLE = _module_available("PIL")
85 
86 if Version:
87     _TORCHVISION_GREATER_EQUAL_0_9 = _compare_version("torchvision", operator.ge, "0.9.0")
88     _PYSTICHE_GREATER_EQUAL_0_7_2 = _compare_version("pystiche", operator.ge, "0.7.2")
89 
90 _IMAGE_STLYE_TRANSFER = _PYSTICHE_AVAILABLE
91 _TEXT_AVAILABLE = _TRANSFORMERS_AVAILABLE
92 _TABULAR_AVAILABLE = _TABNET_AVAILABLE and _PANDAS_AVAILABLE
93 _VIDEO_AVAILABLE = _PYTORCHVIDEO_AVAILABLE
94 _IMAGE_AVAILABLE = _TORCHVISION_AVAILABLE and _TIMM_AVAILABLE and _PIL_AVAILABLE and _KORNIA_AVAILABLE and\
95     _MATPLOTLIB_AVAILABLE and _COCO_AVAILABLE and _FIFTYONE_AVAILABLE
96 _SERVE_AVAILABLE = _FASTAPI_AVAILABLE and _PYDANTIC_AVAILABLE and _CYTOOLZ_AVAILABLE and _UVICORN_AVAILABLE
97
```

Path: `docs/source/conf.py`
Content:
```
1 # Configuration file for the Sphinx documentation builder.
2 #
3 # This file only contains a selection of the most common options. For a full
4 # list see the documentation:
5 # https://www.sphinx-doc.org/en/master/usage/configuration.html
6 
7 # -- Path setup --------------------------------------------------------------
8 
9 # If extensions (or modules to document with autodoc) are in another directory,
10 # add these directories to sys.path here. If the directory is relative to the
11 # documentation root, use os.path.abspath to make it absolute, like shown here.
12 #
13 import os
14 import sys
15 from importlib.util import module_from_spec, spec_from_file_location
16 
17 import pt_lightning_sphinx_theme
18 
19 _PATH_HERE = os.path.abspath(os.path.dirname(__file__))
20 _PATH_ROOT = os.path.join(_PATH_HERE, '..', '..')
21 sys.path.insert(0, os.path.abspath(_PATH_ROOT))
22 
23 try:
24     from flash import __about__ as about
25 
26 except ModuleNotFoundError:
27 
28     def _load_py_module(fname, pkg="flash"):
29         spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, pkg, fname))
30         py = module_from_spec(spec)
31         spec.loader.exec_module(py)
32         return py
33 
34     about = _load_py_module("__about__.py")
35 
36 SPHINX_MOCK_REQUIREMENTS = int(os.environ.get('SPHINX_MOCK_REQUIREMENTS', True))
37 
38 html_favicon = '_static/images/icon.svg'
39 
40 # -- Project information -----------------------------------------------------
41 
42 project = "Flash"
43 copyright = "2020-2021, PyTorch Lightning"
44 author = "PyTorch Lightning"
45 
46 # -- General configuration ---------------------------------------------------
47 
48 # Add any Sphinx extension module names here, as strings. They can be
49 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
50 # ones.
51 extensions = [
52     'sphinx.ext.autodoc',
53     'sphinx.ext.doctest',
54     'sphinx.ext.intersphinx',
55     # 'sphinx.ext.todo',
56     # 'sphinx.ext.coverage',
57     'sphinx.ext.viewcode',
58     'sphinx.ext.autosummary',
59     'sphinx.ext.napoleon',
60     'sphinx.ext.imgmath',
61     'recommonmark',
62     # 'sphinx.ext.autosectionlabel',
63     # 'nbsphinx',  # it seems some sphinx issue
64     'sphinx_autodoc_typehints',
65     'sphinx_copybutton',
66     'sphinx_paramlinks',
67     'sphinx_togglebutton',
68 ]
69 
70 # autodoc: Default to members and undoc-members
71 autodoc_default_options = {"members": True}
72 
73 # autodoc: Don't inherit docstrings (e.g. for nn.Module.forward)
74 autodoc_inherit_docstrings = False
75 
76 # Add any paths that contain templates here, relative to this directory.
77 templates_path = ["_templates"]
78 
79 # List of patterns, relative to source directory, that match files and
80 # directories to ignore when looking for source files.
81 # This pattern also affects html_static_path and html_extra_path.
82 exclude_patterns = []
83 
84 # The suffix(es) of source filenames.
85 # You can specify multiple suffix as a list of string:
86 #
87 source_suffix = [".rst", ".md"]
88 
89 needs_sphinx = "4.0"
90 
91 # -- Options for intersphinx extension ---------------------------------------
92 
93 # Example configuration for intersphinx: refer to the Python standard library.
94 intersphinx_mapping = {
95     "python": ("https://docs.python.org/3", None),
96     "torch": ("https://pytorch.org/docs/stable/", None),
97     "numpy": ("https://numpy.org/doc/stable/", None),
98     "PIL": ("https://pillow.readthedocs.io/en/stable/", None),
99     "pytorchvideo": ("https://pytorchvideo.readthedocs.io/en/latest/", None),
100     "pytorch_lightning": ("https://pytorch-lightning.readthedocs.io/en/stable/", None),
101     "fiftyone": ("https://voxel51.com/docs/fiftyone/", None),
102 }
103 
104 # -- Options for HTML output -------------------------------------------------
105 
106 # The theme to use for HTML and HTML Help pages.  See the documentation for
107 # a list of builtin themes.
108 #
109 html_theme = "pt_lightning_sphinx_theme"
110 html_theme_path = [pt_lightning_sphinx_theme.get_html_theme_path()]
111 
112 # Theme options are theme-specific and customize the look and feel of a theme
113 # further.  For a list of options available for each theme, see the
114 # documentation.
115 
116 html_theme_options = {
117     'pytorch_project': 'https://pytorchlightning.ai',
118     'canonical_url': about.__docs_url__,
119     "collapse_navigation": False,
120     "display_version": True,
121     "logo_only": False,
122 }
123 
124 # Add any paths that contain custom static files (such as style sheets) here,
125 # relative to this directory. They are copied after the builtin static files,
126 # so a file named "default.css" will overwrite the builtin "default.css".
127 html_static_path = ["_static"]
128 
129 html_css_files = []
130 
131 
132 def setup(app):
133     # this is for hiding doctest decoration,
134     # see: http://z4r.github.io/python/2011/12/02/hides-the-prompts-and-output/
135     app.add_js_file('copybutton.js')
136 
137 
138 # Ignoring Third-party packages
139 # https://stackoverflow.com/questions/15889621/sphinx-how-to-exclude-imports-in-automodule
140 def _package_list_from_file(pfile):
141     assert os.path.isfile(pfile)
142     with open(pfile, 'r') as fp:
143         lines = fp.readlines()
144     list_pkgs = []
145     for ln in lines:
146         found = [ln.index(ch) for ch in list(',=<>#@') if ch in ln]
147         pkg = ln[:min(found)] if found else ln
148         if pkg.strip():
149             list_pkgs.append(pkg.strip())
150     return list_pkgs
151 
152 
153 # define mapping from PyPI names to python imports
154 PACKAGE_MAPPING = {
155     'pytorch-lightning': 'pytorch_lightning',
156     'scikit-learn': 'sklearn',
157     'Pillow': 'PIL',
158     'PyYAML': 'yaml',
159     'rouge-score': 'rouge_score',
160     'lightning-bolts': 'pl_bolts',
161     'pytorch-tabnet': 'pytorch_tabnet',
162     'pyDeprecate': 'deprecate',
163 }
164 MOCK_PACKAGES = []
165 if SPHINX_MOCK_REQUIREMENTS:
166     # mock also base packages when we are on RTD since we don't install them there
167     MOCK_PACKAGES += _package_list_from_file(os.path.join(_PATH_ROOT, 'requirements.txt'))
168 # replace PyPI packages by importing ones
169 MOCK_PACKAGES = [PACKAGE_MAPPING.get(pkg, pkg) for pkg in MOCK_PACKAGES]
170 
171 autodoc_mock_imports = MOCK_PACKAGES
172 
173 # only run doctests marked with a ".. doctest::" directive
174 doctest_test_doctest_blocks = ''
175 doctest_global_setup = """
176 import torch
177 import pytorch_lightning as pl
178 import flash
179 """
180
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -98,7 +98,7 @@
     "PIL": ("https://pillow.readthedocs.io/en/stable/", None),
     "pytorchvideo": ("https://pytorchvideo.readthedocs.io/en/latest/", None),
     "pytorch_lightning": ("https://pytorch-lightning.readthedocs.io/en/stable/", None),
-    "fiftyone": ("https://voxel51.com/docs/fiftyone/", None),
+    "fiftyone": ("https://voxel51.com/docs/fiftyone/", "fiftyone_objects.inv"),
 }
 
 # -- Options for HTML output -------------------------------------------------
diff --git a/flash/core/utilities/imports.py b/flash/core/utilities/imports.py
--- a/flash/core/utilities/imports.py
+++ b/flash/core/utilities/imports.py
@@ -91,6 +91,13 @@
 _TEXT_AVAILABLE = _TRANSFORMERS_AVAILABLE
 _TABULAR_AVAILABLE = _TABNET_AVAILABLE and _PANDAS_AVAILABLE
 _VIDEO_AVAILABLE = _PYTORCHVIDEO_AVAILABLE
-_IMAGE_AVAILABLE = _TORCHVISION_AVAILABLE and _TIMM_AVAILABLE and _PIL_AVAILABLE and _KORNIA_AVAILABLE and\
-    _MATPLOTLIB_AVAILABLE and _COCO_AVAILABLE and _FIFTYONE_AVAILABLE
+_IMAGE_AVAILABLE = all([
+    _TORCHVISION_AVAILABLE,
+    _TIMM_AVAILABLE,
+    _PIL_AVAILABLE,
+    _KORNIA_AVAILABLE,
+    _MATPLOTLIB_AVAILABLE,
+    _COCO_AVAILABLE,
+    _FIFTYONE_AVAILABLE,
+])
 _SERVE_AVAILABLE = _FASTAPI_AVAILABLE and _PYDANTIC_AVAILABLE and _CYTOOLZ_AVAILABLE and _UVICORN_AVAILABLE

{"golden_diff": "diff --git a/docs/source/conf.py b/docs/source/conf.py\n--- a/docs/source/conf.py\n+++ b/docs/source/conf.py\n@@ -98,7 +98,7 @@\n     \"PIL\": (\"https://pillow.readthedocs.io/en/stable/\", None),\n     \"pytorchvideo\": (\"https://pytorchvideo.readthedocs.io/en/latest/\", None),\n     \"pytorch_lightning\": (\"https://pytorch-lightning.readthedocs.io/en/stable/\", None),\n-    \"fiftyone\": (\"https://voxel51.com/docs/fiftyone/\", None),\n+    \"fiftyone\": (\"https://voxel51.com/docs/fiftyone/\", \"fiftyone_objects.inv\"),\n }\n \n # -- Options for HTML output -------------------------------------------------\ndiff --git a/flash/core/utilities/imports.py b/flash/core/utilities/imports.py\n--- a/flash/core/utilities/imports.py\n+++ b/flash/core/utilities/imports.py\n@@ -91,6 +91,13 @@\n _TEXT_AVAILABLE = _TRANSFORMERS_AVAILABLE\n _TABULAR_AVAILABLE = _TABNET_AVAILABLE and _PANDAS_AVAILABLE\n _VIDEO_AVAILABLE = _PYTORCHVIDEO_AVAILABLE\n-_IMAGE_AVAILABLE = _TORCHVISION_AVAILABLE and _TIMM_AVAILABLE and _PIL_AVAILABLE and _KORNIA_AVAILABLE and\\\n-    _MATPLOTLIB_AVAILABLE and _COCO_AVAILABLE and _FIFTYONE_AVAILABLE\n+_IMAGE_AVAILABLE = all([\n+    _TORCHVISION_AVAILABLE,\n+    _TIMM_AVAILABLE,\n+    _PIL_AVAILABLE,\n+    _KORNIA_AVAILABLE,\n+    _MATPLOTLIB_AVAILABLE,\n+    _COCO_AVAILABLE,\n+    _FIFTYONE_AVAILABLE,\n+])\n _SERVE_AVAILABLE = _FASTAPI_AVAILABLE and _PYDANTIC_AVAILABLE and _CYTOOLZ_AVAILABLE and _UVICORN_AVAILABLE\n", "issue": "Docs build lottery\n## \ud83d\udc1b Bug\r\n\r\n@ehofesmann We still seem to be getting this issue:\r\n```\r\nintersphinx inventory 'https://voxel51.com/docs/fiftyone/objects.inv' not fetchable due to <class 'requests.exceptions.ConnectionError'>: HTTPSConnectionPool(host='voxel51.com', port=443): Max retries exceeded with url: /docs/fiftyone/objects.inv (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5fbc2d56d0>: Failed to establish a new connection: [Errno 110] Connection timed out'))\r\n```\r\nExample here: https://github.com/PyTorchLightning/lightning-flash/pull/426/checks?check_run_id=2860706755\r\n\r\nIs it because we have multiple CI trying to get it at once?\r\n\r\nI think for now we can probably try to just ignore that warning, but would be interested to know the root cause. @Borda any idea how we can ignore just a specific warning in sphinx build? Or any idea what might be causing the issue?\r\n\r\n(Just to provide some context, we typically get the error then I re-trigger the build and it's fine)\n", "before_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"General utilities\"\"\"\nimport importlib\nimport operator\nfrom importlib.util import find_spec\n\nfrom pkg_resources import DistributionNotFound\n\ntry:\n    from packaging.version import Version\nexcept (ModuleNotFoundError, DistributionNotFound):\n    Version = None\n\n\ndef _module_available(module_path: str) -> bool:\n    \"\"\"\n    Check if a path is available in your environment\n\n    >>> _module_available('os')\n    True\n    >>> _module_available('bla.bla')\n    False\n    \"\"\"\n    try:\n        return find_spec(module_path) is not None\n    except AttributeError:\n        # Python 3.6\n        return False\n    except ModuleNotFoundError:\n        # Python 3.7+\n        return False\n\n\ndef _compare_version(package: str, op, version) -> bool:\n    \"\"\"\n    Compare package version with some requirements\n\n    >>> _compare_version(\"torch\", operator.ge, \"0.1\")\n    True\n    \"\"\"\n    try:\n        pkg = importlib.import_module(package)\n    except (ModuleNotFoundError, DistributionNotFound, ValueError):\n        return False\n    try:\n        pkg_version = Version(pkg.__version__)\n    except TypeError:\n        # this is mock by sphinx, so it shall return True ro generate all summaries\n        return True\n    return op(pkg_version, Version(version))\n\n\n_TORCH_AVAILABLE = _module_available(\"torch\")\n_BOLTS_AVAILABLE = _module_available(\"pl_bolts\") and _compare_version(\"torch\", operator.lt, \"1.9.0\")\n_PANDAS_AVAILABLE = _module_available(\"pandas\")\n_SKLEARN_AVAILABLE = _module_available(\"sklearn\")\n_TABNET_AVAILABLE = _module_available(\"pytorch_tabnet\")\n_KORNIA_AVAILABLE = _module_available(\"kornia\")\n_COCO_AVAILABLE = _module_available(\"pycocotools\")\n_TIMM_AVAILABLE = _module_available(\"timm\")\n_TORCHVISION_AVAILABLE = _module_available(\"torchvision\")\n_PYTORCHVIDEO_AVAILABLE = _module_available(\"pytorchvideo\")\n_MATPLOTLIB_AVAILABLE = _module_available(\"matplotlib\")\n_TRANSFORMERS_AVAILABLE = _module_available(\"transformers\")\n_PYSTICHE_AVAILABLE = _module_available(\"pystiche\")\n_FIFTYONE_AVAILABLE = _module_available(\"fiftyone\")\n_FASTAPI_AVAILABLE = _module_available(\"fastapi\")\n_PYDANTIC_AVAILABLE = _module_available(\"pydantic\")\n_GRAPHVIZ_AVAILABLE = _module_available(\"graphviz\")\n_CYTOOLZ_AVAILABLE = _module_available(\"cytoolz\")\n_UVICORN_AVAILABLE = _module_available(\"uvicorn\")\n_PIL_AVAILABLE = _module_available(\"PIL\")\n\nif Version:\n    _TORCHVISION_GREATER_EQUAL_0_9 = _compare_version(\"torchvision\", operator.ge, \"0.9.0\")\n    _PYSTICHE_GREATER_EQUAL_0_7_2 = _compare_version(\"pystiche\", operator.ge, \"0.7.2\")\n\n_IMAGE_STLYE_TRANSFER = _PYSTICHE_AVAILABLE\n_TEXT_AVAILABLE = _TRANSFORMERS_AVAILABLE\n_TABULAR_AVAILABLE = _TABNET_AVAILABLE and _PANDAS_AVAILABLE\n_VIDEO_AVAILABLE = _PYTORCHVIDEO_AVAILABLE\n_IMAGE_AVAILABLE = _TORCHVISION_AVAILABLE and _TIMM_AVAILABLE and _PIL_AVAILABLE and _KORNIA_AVAILABLE and\\\n    _MATPLOTLIB_AVAILABLE and _COCO_AVAILABLE and _FIFTYONE_AVAILABLE\n_SERVE_AVAILABLE = _FASTAPI_AVAILABLE and _PYDANTIC_AVAILABLE and _CYTOOLZ_AVAILABLE and _UVICORN_AVAILABLE\n", "path": "flash/core/utilities/imports.py"}, {"content": "# Configuration file for the Sphinx documentation builder.\n#\n# This file only contains a selection of the most common options. For a full\n# list see the documentation:\n# https://www.sphinx-doc.org/en/master/usage/configuration.html\n\n# -- Path setup --------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\nimport os\nimport sys\nfrom importlib.util import module_from_spec, spec_from_file_location\n\nimport pt_lightning_sphinx_theme\n\n_PATH_HERE = os.path.abspath(os.path.dirname(__file__))\n_PATH_ROOT = os.path.join(_PATH_HERE, '..', '..')\nsys.path.insert(0, os.path.abspath(_PATH_ROOT))\n\ntry:\n    from flash import __about__ as about\n\nexcept ModuleNotFoundError:\n\n    def _load_py_module(fname, pkg=\"flash\"):\n        spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, pkg, fname))\n        py = module_from_spec(spec)\n        spec.loader.exec_module(py)\n        return py\n\n    about = _load_py_module(\"__about__.py\")\n\nSPHINX_MOCK_REQUIREMENTS = int(os.environ.get('SPHINX_MOCK_REQUIREMENTS', True))\n\nhtml_favicon = '_static/images/icon.svg'\n\n# -- Project information -----------------------------------------------------\n\nproject = \"Flash\"\ncopyright = \"2020-2021, PyTorch Lightning\"\nauthor = \"PyTorch Lightning\"\n\n# -- General configuration ---------------------------------------------------\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    'sphinx.ext.autodoc',\n    'sphinx.ext.doctest',\n    'sphinx.ext.intersphinx',\n    # 'sphinx.ext.todo',\n    # 'sphinx.ext.coverage',\n    'sphinx.ext.viewcode',\n    'sphinx.ext.autosummary',\n    'sphinx.ext.napoleon',\n    'sphinx.ext.imgmath',\n    'recommonmark',\n    # 'sphinx.ext.autosectionlabel',\n    # 'nbsphinx',  # it seems some sphinx issue\n    'sphinx_autodoc_typehints',\n    'sphinx_copybutton',\n    'sphinx_paramlinks',\n    'sphinx_togglebutton',\n]\n\n# autodoc: Default to members and undoc-members\nautodoc_default_options = {\"members\": True}\n\n# autodoc: Don't inherit docstrings (e.g. for nn.Module.forward)\nautodoc_inherit_docstrings = False\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This pattern also affects html_static_path and html_extra_path.\nexclude_patterns = []\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\nsource_suffix = [\".rst\", \".md\"]\n\nneeds_sphinx = \"4.0\"\n\n# -- Options for intersphinx extension ---------------------------------------\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n    \"numpy\": (\"https://numpy.org/doc/stable/\", None),\n    \"PIL\": (\"https://pillow.readthedocs.io/en/stable/\", None),\n    \"pytorchvideo\": (\"https://pytorchvideo.readthedocs.io/en/latest/\", None),\n    \"pytorch_lightning\": (\"https://pytorch-lightning.readthedocs.io/en/stable/\", None),\n    \"fiftyone\": (\"https://voxel51.com/docs/fiftyone/\", None),\n}\n\n# -- Options for HTML output -------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\nhtml_theme = \"pt_lightning_sphinx_theme\"\nhtml_theme_path = [pt_lightning_sphinx_theme.get_html_theme_path()]\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n\nhtml_theme_options = {\n    'pytorch_project': 'https://pytorchlightning.ai',\n    'canonical_url': about.__docs_url__,\n    \"collapse_navigation\": False,\n    \"display_version\": True,\n    \"logo_only\": False,\n}\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = [\"_static\"]\n\nhtml_css_files = []\n\n\ndef setup(app):\n    # this is for hiding doctest decoration,\n    # see: http://z4r.github.io/python/2011/12/02/hides-the-prompts-and-output/\n    app.add_js_file('copybutton.js')\n\n\n# Ignoring Third-party packages\n# https://stackoverflow.com/questions/15889621/sphinx-how-to-exclude-imports-in-automodule\ndef _package_list_from_file(pfile):\n    assert os.path.isfile(pfile)\n    with open(pfile, 'r') as fp:\n        lines = fp.readlines()\n    list_pkgs = []\n    for ln in lines:\n        found = [ln.index(ch) for ch in list(',=<>#@') if ch in ln]\n        pkg = ln[:min(found)] if found else ln\n        if pkg.strip():\n            list_pkgs.append(pkg.strip())\n    return list_pkgs\n\n\n# define mapping from PyPI names to python imports\nPACKAGE_MAPPING = {\n    'pytorch-lightning': 'pytorch_lightning',\n    'scikit-learn': 'sklearn',\n    'Pillow': 'PIL',\n    'PyYAML': 'yaml',\n    'rouge-score': 'rouge_score',\n    'lightning-bolts': 'pl_bolts',\n    'pytorch-tabnet': 'pytorch_tabnet',\n    'pyDeprecate': 'deprecate',\n}\nMOCK_PACKAGES = []\nif SPHINX_MOCK_REQUIREMENTS:\n    # mock also base packages when we are on RTD since we don't install them there\n    MOCK_PACKAGES += _package_list_from_file(os.path.join(_PATH_ROOT, 'requirements.txt'))\n# replace PyPI packages by importing ones\nMOCK_PACKAGES = [PACKAGE_MAPPING.get(pkg, pkg) for pkg in MOCK_PACKAGES]\n\nautodoc_mock_imports = MOCK_PACKAGES\n\n# only run doctests marked with a \".. doctest::\" directive\ndoctest_test_doctest_blocks = ''\ndoctest_global_setup = \"\"\"\nimport torch\nimport pytorch_lightning as pl\nimport flash\n\"\"\"\n", "path": "docs/source/conf.py"}], "after_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"General utilities\"\"\"\nimport importlib\nimport operator\nfrom importlib.util import find_spec\n\nfrom pkg_resources import DistributionNotFound\n\ntry:\n    from packaging.version import Version\nexcept (ModuleNotFoundError, DistributionNotFound):\n    Version = None\n\n\ndef _module_available(module_path: str) -> bool:\n    \"\"\"\n    Check if a path is available in your environment\n\n    >>> _module_available('os')\n    True\n    >>> _module_available('bla.bla')\n    False\n    \"\"\"\n    try:\n        return find_spec(module_path) is not None\n    except AttributeError:\n        # Python 3.6\n        return False\n    except ModuleNotFoundError:\n        # Python 3.7+\n        return False\n\n\ndef _compare_version(package: str, op, version) -> bool:\n    \"\"\"\n    Compare package version with some requirements\n\n    >>> _compare_version(\"torch\", operator.ge, \"0.1\")\n    True\n    \"\"\"\n    try:\n        pkg = importlib.import_module(package)\n    except (ModuleNotFoundError, DistributionNotFound, ValueError):\n        return False\n    try:\n        pkg_version = Version(pkg.__version__)\n    except TypeError:\n        # this is mock by sphinx, so it shall return True ro generate all summaries\n        return True\n    return op(pkg_version, Version(version))\n\n\n_TORCH_AVAILABLE = _module_available(\"torch\")\n_BOLTS_AVAILABLE = _module_available(\"pl_bolts\") and _compare_version(\"torch\", operator.lt, \"1.9.0\")\n_PANDAS_AVAILABLE = _module_available(\"pandas\")\n_SKLEARN_AVAILABLE = _module_available(\"sklearn\")\n_TABNET_AVAILABLE = _module_available(\"pytorch_tabnet\")\n_KORNIA_AVAILABLE = _module_available(\"kornia\")\n_COCO_AVAILABLE = _module_available(\"pycocotools\")\n_TIMM_AVAILABLE = _module_available(\"timm\")\n_TORCHVISION_AVAILABLE = _module_available(\"torchvision\")\n_PYTORCHVIDEO_AVAILABLE = _module_available(\"pytorchvideo\")\n_MATPLOTLIB_AVAILABLE = _module_available(\"matplotlib\")\n_TRANSFORMERS_AVAILABLE = _module_available(\"transformers\")\n_PYSTICHE_AVAILABLE = _module_available(\"pystiche\")\n_FIFTYONE_AVAILABLE = _module_available(\"fiftyone\")\n_FASTAPI_AVAILABLE = _module_available(\"fastapi\")\n_PYDANTIC_AVAILABLE = _module_available(\"pydantic\")\n_GRAPHVIZ_AVAILABLE = _module_available(\"graphviz\")\n_CYTOOLZ_AVAILABLE = _module_available(\"cytoolz\")\n_UVICORN_AVAILABLE = _module_available(\"uvicorn\")\n_PIL_AVAILABLE = _module_available(\"PIL\")\n\nif Version:\n    _TORCHVISION_GREATER_EQUAL_0_9 = _compare_version(\"torchvision\", operator.ge, \"0.9.0\")\n    _PYSTICHE_GREATER_EQUAL_0_7_2 = _compare_version(\"pystiche\", operator.ge, \"0.7.2\")\n\n_IMAGE_STLYE_TRANSFER = _PYSTICHE_AVAILABLE\n_TEXT_AVAILABLE = _TRANSFORMERS_AVAILABLE\n_TABULAR_AVAILABLE = _TABNET_AVAILABLE and _PANDAS_AVAILABLE\n_VIDEO_AVAILABLE = _PYTORCHVIDEO_AVAILABLE\n_IMAGE_AVAILABLE = all([\n    _TORCHVISION_AVAILABLE,\n    _TIMM_AVAILABLE,\n    _PIL_AVAILABLE,\n    _KORNIA_AVAILABLE,\n    _MATPLOTLIB_AVAILABLE,\n    _COCO_AVAILABLE,\n    _FIFTYONE_AVAILABLE,\n])\n_SERVE_AVAILABLE = _FASTAPI_AVAILABLE and _PYDANTIC_AVAILABLE and _CYTOOLZ_AVAILABLE and _UVICORN_AVAILABLE\n", "path": "flash/core/utilities/imports.py"}, {"content": "# Configuration file for the Sphinx documentation builder.\n#\n# This file only contains a selection of the most common options. For a full\n# list see the documentation:\n# https://www.sphinx-doc.org/en/master/usage/configuration.html\n\n# -- Path setup --------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\nimport os\nimport sys\nfrom importlib.util import module_from_spec, spec_from_file_location\n\nimport pt_lightning_sphinx_theme\n\n_PATH_HERE = os.path.abspath(os.path.dirname(__file__))\n_PATH_ROOT = os.path.join(_PATH_HERE, '..', '..')\nsys.path.insert(0, os.path.abspath(_PATH_ROOT))\n\ntry:\n    from flash import __about__ as about\n\nexcept ModuleNotFoundError:\n\n    def _load_py_module(fname, pkg=\"flash\"):\n        spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, pkg, fname))\n        py = module_from_spec(spec)\n        spec.loader.exec_module(py)\n        return py\n\n    about = _load_py_module(\"__about__.py\")\n\nSPHINX_MOCK_REQUIREMENTS = int(os.environ.get('SPHINX_MOCK_REQUIREMENTS', True))\n\nhtml_favicon = '_static/images/icon.svg'\n\n# -- Project information -----------------------------------------------------\n\nproject = \"Flash\"\ncopyright = \"2020-2021, PyTorch Lightning\"\nauthor = \"PyTorch Lightning\"\n\n# -- General configuration ---------------------------------------------------\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    'sphinx.ext.autodoc',\n    'sphinx.ext.doctest',\n    'sphinx.ext.intersphinx',\n    # 'sphinx.ext.todo',\n    # 'sphinx.ext.coverage',\n    'sphinx.ext.viewcode',\n    'sphinx.ext.autosummary',\n    'sphinx.ext.napoleon',\n    'sphinx.ext.imgmath',\n    'recommonmark',\n    # 'sphinx.ext.autosectionlabel',\n    # 'nbsphinx',  # it seems some sphinx issue\n    'sphinx_autodoc_typehints',\n    'sphinx_copybutton',\n    'sphinx_paramlinks',\n    'sphinx_togglebutton',\n]\n\n# autodoc: Default to members and undoc-members\nautodoc_default_options = {\"members\": True}\n\n# autodoc: Don't inherit docstrings (e.g. for nn.Module.forward)\nautodoc_inherit_docstrings = False\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This pattern also affects html_static_path and html_extra_path.\nexclude_patterns = []\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\nsource_suffix = [\".rst\", \".md\"]\n\nneeds_sphinx = \"4.0\"\n\n# -- Options for intersphinx extension ---------------------------------------\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n    \"numpy\": (\"https://numpy.org/doc/stable/\", None),\n    \"PIL\": (\"https://pillow.readthedocs.io/en/stable/\", None),\n    \"pytorchvideo\": (\"https://pytorchvideo.readthedocs.io/en/latest/\", None),\n    \"pytorch_lightning\": (\"https://pytorch-lightning.readthedocs.io/en/stable/\", None),\n    \"fiftyone\": (\"https://voxel51.com/docs/fiftyone/\", \"fiftyone_objects.inv\"),\n}\n\n# -- Options for HTML output -------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\nhtml_theme = \"pt_lightning_sphinx_theme\"\nhtml_theme_path = [pt_lightning_sphinx_theme.get_html_theme_path()]\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n\nhtml_theme_options = {\n    'pytorch_project': 'https://pytorchlightning.ai',\n    'canonical_url': about.__docs_url__,\n    \"collapse_navigation\": False,\n    \"display_version\": True,\n    \"logo_only\": False,\n}\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = [\"_static\"]\n\nhtml_css_files = []\n\n\ndef setup(app):\n    # this is for hiding doctest decoration,\n    # see: http://z4r.github.io/python/2011/12/02/hides-the-prompts-and-output/\n    app.add_js_file('copybutton.js')\n\n\n# Ignoring Third-party packages\n# https://stackoverflow.com/questions/15889621/sphinx-how-to-exclude-imports-in-automodule\ndef _package_list_from_file(pfile):\n    assert os.path.isfile(pfile)\n    with open(pfile, 'r') as fp:\n        lines = fp.readlines()\n    list_pkgs = []\n    for ln in lines:\n        found = [ln.index(ch) for ch in list(',=<>#@') if ch in ln]\n        pkg = ln[:min(found)] if found else ln\n        if pkg.strip():\n            list_pkgs.append(pkg.strip())\n    return list_pkgs\n\n\n# define mapping from PyPI names to python imports\nPACKAGE_MAPPING = {\n    'pytorch-lightning': 'pytorch_lightning',\n    'scikit-learn': 'sklearn',\n    'Pillow': 'PIL',\n    'PyYAML': 'yaml',\n    'rouge-score': 'rouge_score',\n    'lightning-bolts': 'pl_bolts',\n    'pytorch-tabnet': 'pytorch_tabnet',\n    'pyDeprecate': 'deprecate',\n}\nMOCK_PACKAGES = []\nif SPHINX_MOCK_REQUIREMENTS:\n    # mock also base packages when we are on RTD since we don't install them there\n    MOCK_PACKAGES += _package_list_from_file(os.path.join(_PATH_ROOT, 'requirements.txt'))\n# replace PyPI packages by importing ones\nMOCK_PACKAGES = [PACKAGE_MAPPING.get(pkg, pkg) for pkg in MOCK_PACKAGES]\n\nautodoc_mock_imports = MOCK_PACKAGES\n\n# only run doctests marked with a \".. doctest::\" directive\ndoctest_test_doctest_blocks = ''\ndoctest_global_setup = \"\"\"\nimport torch\nimport pytorch_lightning as pl\nimport flash\n\"\"\"\n", "path": "docs/source/conf.py"}]}