Skip to content

Commit

Permalink
Upsphix (zhanghang1989#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
StacyYang authored Apr 10, 2020
1 parent 7463e59 commit e11e8fa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sphix_build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master

- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx
sphinxcontrib-googleanalytics
sphinx-rtd-theme
-e git://github.com/zhanghang1989/autorch_sphinx_theme.git#egg=autorch_sphinx_theme
65 changes: 3 additions & 62 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import encoding
import sphinx_rtd_theme
import autorch_sphinx_theme


# -- General configuration ------------------------------------------------
Expand Down Expand Up @@ -102,8 +102,8 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = 'autorch_sphinx_theme'
html_theme_path = [autorch_sphinx_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -186,62 +186,3 @@
author, 'Encoding', 'One line description of project.',
'Miscellaneous'),
]


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/', None),
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
}

# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
# See http://stackoverflow.com/a/41184353/3343043

from docutils import nodes
from sphinx.util.docfields import TypedField
from sphinx import addnodes


def patched_make_field(self, types, domain, items, **kw):
# `kw` catches `env=None` needed for newer sphinx while maintaining
# backwards compatibility when passed along further down!

# type: (List, unicode, Tuple) -> nodes.field
def handle_item(fieldarg, content):
par = nodes.paragraph()
par += addnodes.literal_strong('', fieldarg) # Patch: this line added
# par.extend(self.make_xrefs(self.rolename, domain, fieldarg,
# addnodes.literal_strong))
if fieldarg in types:
par += nodes.Text(' (')
# NOTE: using .pop() here to prevent a single type node to be
# inserted twice into the doctree, which leads to
# inconsistencies later when references are resolved
fieldtype = types.pop(fieldarg)
if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):
typename = u''.join(n.astext() for n in fieldtype)
typename = typename.replace('int', 'python:int')
typename = typename.replace('long', 'python:long')
typename = typename.replace('float', 'python:float')
typename = typename.replace('type', 'python:type')
par.extend(self.make_xrefs(self.typerolename, domain, typename,
addnodes.literal_emphasis, **kw))
else:
par += fieldtype
par += nodes.Text(')')
par += nodes.Text(' -- ')
par += content
return par

fieldname = nodes.field_name('', self.label)
if len(items) == 1 and self.can_collapse:
fieldarg, content = items[0]
bodynode = handle_item(fieldarg, content)
else:
bodynode = self.list_type()
for fieldarg, content in items:
bodynode += nodes.list_item('', handle_item(fieldarg, content))
fieldbody = nodes.field_body('', bodynode)
return nodes.field('', fieldname, fieldbody)

TypedField.make_field = patched_make_field
2 changes: 1 addition & 1 deletion encoding/nn/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Encoding(Module):
Encoding Layer: a learnable residual encoder.
.. image:: _static/img/cvpr17.svg
:width: 50%
:width: 30%
:align: center
Encoding Layer accpets 3D or 4D inputs.
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

cwd = os.path.dirname(os.path.abspath(__file__))

version = '1.1.1'
version = '1.1.2'
try:
from datetime import date
today = date.today()
day = today.strftime("b%d%m%Y")
day = today.strftime("b%Y%m%d")
version += day
except Exception:
pass
Expand All @@ -40,13 +40,11 @@ class install(setuptools.command.install.install):
def run(self):
create_version_file()
setuptools.command.install.install.run(self)
#subprocess.check_call("python tests/unit_test.py".split())

class develop(setuptools.command.develop.develop):
def run(self):
create_version_file()
setuptools.command.develop.develop.run(self)
#subprocess.check_call("python tests/unit_test.py".split())

readme = open('README.md').read()

Expand Down

0 comments on commit e11e8fa

Please sign in to comment.