From 662fb2032b2f7499ec4f76377cb239df79addedf Mon Sep 17 00:00:00 2001 From: Travis CI Date: Tue, 25 Aug 2015 10:14:41 +0200 Subject: [PATCH] automated doc upload --- .travis.yml | 6 ++-- doc/Readme.md | 9 ------ doc/deploy_ghpages.py | 6 ++-- jobmanager/decorators.py | 62 ++++++++++++++++++++-------------------- 4 files changed, 37 insertions(+), 46 deletions(-) diff --git a/.travis.yml b/.travis.yml index 630123b..f2e5216 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,6 +48,6 @@ script: after_success: - git config credential.helper "store --file=.git/credentials" - echo "https://${GH_TOKEN}:@github.com" > .git/credentials -- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then travis_retry conda install --yes sphinx; fi -- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install numpydoc; fi -- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then python doc/deploy_ghpages.py; fi +- if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then travis_retry conda install --yes sphinx; fi +- if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then pip install numpydoc; fi +- if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then python doc/deploy_ghpages.py; fi diff --git a/doc/Readme.md b/doc/Readme.md index 976ec85..a585922 100644 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -6,12 +6,3 @@ Install [numpydoc](https://pypi.python.org/pypi/numpydoc): To compile the documentation, run python setup.py build_sphinx - - -To upload the documentation to gh-pages, run - - python setup.py commit_doc - -or - - python doc/commit_gh-pages.py diff --git a/doc/deploy_ghpages.py b/doc/deploy_ghpages.py index 8875aa0..6cfa320 100644 --- a/doc/deploy_ghpages.py +++ b/doc/deploy_ghpages.py @@ -40,8 +40,8 @@ Prerequisites after_success: - git config credential.helper "store --file=.git/credentials" - echo "https://${GH_TOKEN}:@github.com" > .git/credentials - - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install numpydoc sphinx; fi - - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then python doc/deploy_ghpages.py; fi + - if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then pip install numpydoc sphinx; fi + - if [[ $TRAVIS_PYTHON_VERSION == 3.4 ]]; then python doc/deploy_ghpages.py; fi """ from __future__ import print_function @@ -77,4 +77,4 @@ except: pass #nothing to do else: sp.check_output("git push --force --quiet origin gh-pages", shell=True) - \ No newline at end of file + diff --git a/jobmanager/decorators.py b/jobmanager/decorators.py index f39c2db..5b3a1d4 100644 --- a/jobmanager/decorators.py +++ b/jobmanager/decorators.py @@ -158,38 +158,38 @@ class ProgressBar(object): class ProgressBarExtended(ProgressBar): """ - extends the ProgressBar such that - - on can turn of the ProgressBar by giving an extra argument, - namely 'progress_bar_off' and set its value to 'True'. - - further there will be an additional argument passed to the function - called 'progress_bar' which allows to stop the progress bar from - within the function. note that there will be an function signature error - if the function does not accept the extra argument 'progress_bar'. So a - general **kwargs at the end of the functions arguments will help. - That is also the reason why the extended version comes in an extra class - because it might otherwise break compatibility. - - Example - ------- - - >>> import jobmanager as jm - - >>> c = jm.progress.UnsignedIntValue(val=0) - >>> m = jm.progress.UnsignedIntValue(val=20) + extends the ProgressBar such that - >>> @jm.decorators.ProgressBarExtended # choose 'ProgressBarExtended' - >>> def my_func_kwargs(c, m, **kwargs): # simply add '**kwargs' here - >>> for i in range(m.value): - >>> c.value = i+1 - >>> time.sleep(0.1) - - >>> # same as when using ProgressBar - >>> my_func_kwargs(c, m) - - >>> # a simple kwarg will switch the progressBar off - >>> my_func_kwargs(c, m, progress_bar_off=True) + on can turn of the ProgressBar by giving an extra argument, + namely 'progress_bar_off' and set its value to 'True'. + + further there will be an additional argument passed to the function + called 'progress_bar' which allows to stop the progress bar from + within the function. note that there will be an function signature error + if the function does not accept the extra argument 'progress_bar'. So a + general **kwargs at the end of the functions arguments will help. + That is also the reason why the extended version comes in an extra class + because it might otherwise break compatibility. + + Example + ------- + + >>> import jobmanager as jm + + >>> c = jm.progress.UnsignedIntValue(val=0) + >>> m = jm.progress.UnsignedIntValue(val=20) + + >>> @jm.decorators.ProgressBarExtended # choose 'ProgressBarExtended' + >>> def my_func_kwargs(c, m, **kwargs): # simply add '**kwargs' here + >>> for i in range(m.value): + >>> c.value = i+1 + >>> time.sleep(0.1) + + >>> # same as when using ProgressBar + >>> my_func_kwargs(c, m) + + >>> # a simple kwarg will switch the progressBar off + >>> my_func_kwargs(c, m, progress_bar_off=True) """ def __call__(self, *args, **kwargs): # Bind the args and kwds to the argument names of self.func