Skip to content

Commit

Permalink
Merge pull request #3 from jaumebonet/ifndef
Browse files Browse the repository at this point in the history
added ifndef python variant and own error types.
  • Loading branch information
jaumebonet authored Nov 23, 2018
2 parents 02f41b1 + b2a762c commit eab0a1e
Show file tree
Hide file tree
Showing 33 changed files with 637 additions and 120 deletions.
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ matrix:
- python: 3.7-dev
env: TOXENV=py37
os: linux
- language: generic
env: TOXENV=py27
os: osx
- language: generic
env: TOXENV=py36
os: osx

before_install:
- bash ./ci/travis_before_install.sh
install:
- pip install tox
- if [[ $TOXENV == py36 ]]; then pip install pyyaml; fi
- if [[ $TOXENV == py36 ]]; then pip install coveralls; fi
- if [[ $TOXENV == py36 ]]; then pip install python-coveralls; fi
- if [[ $TOXENV == py36 ]]; then pip install codacy-coverage; fi
- bash ./ci/travis_install.sh

script:
- tox
Expand Down
18 changes: 18 additions & 0 deletions ci/requirements_devel.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pytest>=3.5
pytest-cov>=2.5
pytest-mpl>=0.9
tox>=3.0
coverage>=4.0.3
coveralls
python-coveralls
codacy-coverage

Ipython==7.1.1;python_version>="3.4"
Ipython==5.8.0;python_version<="2.7"
sphinx>=1.7
sphinx_bootstrap_theme>=0.6
sphinx-argparse>=0.2.2

six
pyyaml
pandas
15 changes: 15 additions & 0 deletions ci/travis_before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
if [[ $TOXENV == 'py27' ]]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
fi
bash miniconda.sh -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
conda config --set always_yes yes --set changeps1 no;
conda install --yes python=$TRAVIS_PYTHON_VERSION;
mkdir $HOME/.matplotlib;
echo 'backend: TkAgg' > $HOME/.matplotlib/matplotlibrc;
fi
12 changes: 12 additions & 0 deletions ci/travis_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

pip install tox

if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
if [[ $TOXENV == 'py36' ]]; then
pip install pyyaml;
pip install coveralls;
pip install python-coveralls;
pip install codacy-coverage;
fi
fi
42 changes: 24 additions & 18 deletions docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,57 +120,63 @@
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.document_options.html#libconfig.document_options" title="libconfig.document_options"><code class="xref py py-obj docutils literal notranslate"><span class="pre">document_options</span></code></a>()</td>
<td>Generates a docstring table to add to the library documentation.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.get_option.html#libconfig.get_option" title="libconfig.get_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_option</span></code></a>(key,&nbsp;subkey[,&nbsp;in_path_none])</td>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.get_local_config_file.html#libconfig.get_local_config_file" title="libconfig.get_local_config_file"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_local_config_file</span></code></a>(filename)</td>
<td>Find local file to setup default values.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.get_option.html#libconfig.get_option" title="libconfig.get_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_option</span></code></a>(key,&nbsp;subkey[,&nbsp;in_path_none])</td>
<td>Get the current value of the option.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.get_option_default.html#libconfig.get_option_default" title="libconfig.get_option_default"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_option_default</span></code></a>(key,&nbsp;subkey)</td>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.get_option_default.html#libconfig.get_option_default" title="libconfig.get_option_default"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_option_default</span></code></a>(key,&nbsp;subkey)</td>
<td>Get the default value of the option.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.get_option_description.html#libconfig.get_option_description" title="libconfig.get_option_description"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_option_description</span></code></a>(key,&nbsp;subkey)</td>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.get_option_description.html#libconfig.get_option_description" title="libconfig.get_option_description"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_option_description</span></code></a>(key,&nbsp;subkey)</td>
<td>Get the string descriving a particular option.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.ifndef.html#libconfig.ifndef" title="libconfig.ifndef"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ifndef</span></code></a>()</td>
<td>Equivalent to C’s #IFNDEF.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.lock_option.html#libconfig.lock_option" title="libconfig.lock_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">lock_option</span></code></a>(key,&nbsp;subkey)</td>
<td>Make an option unmutable.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.register_option.html#libconfig.register_option" title="libconfig.register_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_option</span></code></a>(key,&nbsp;subkey,&nbsp;default,&nbsp;_type,&nbsp;…)</td>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.on_option_value.html#libconfig.on_option_value" title="libconfig.on_option_value"><code class="xref py py-obj docutils literal notranslate"><span class="pre">on_option_value</span></code></a>(*args)</td>
<td>Temporarily change the configuration values.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.register_option.html#libconfig.register_option" title="libconfig.register_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">register_option</span></code></a>(key,&nbsp;subkey,&nbsp;default,&nbsp;_type,&nbsp;…)</td>
<td>Create a new option.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.reset_option.html#libconfig.reset_option" title="libconfig.reset_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reset_option</span></code></a>(key,&nbsp;subkey)</td>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.reset_option.html#libconfig.reset_option" title="libconfig.reset_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reset_option</span></code></a>(key,&nbsp;subkey)</td>
<td>Resets a single option to the default values.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.reset_options.html#libconfig.reset_options" title="libconfig.reset_options"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reset_options</span></code></a>([empty])</td>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.reset_options.html#libconfig.reset_options" title="libconfig.reset_options"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reset_options</span></code></a>([empty])</td>
<td>Empty ALL options.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.set_option.html#libconfig.set_option" title="libconfig.set_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_option</span></code></a>(key,&nbsp;subkey,&nbsp;value)</td>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.set_option.html#libconfig.set_option" title="libconfig.set_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_option</span></code></a>(key,&nbsp;subkey,&nbsp;value)</td>
<td>Sets the value of an option.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.set_options_from_file.html#libconfig.set_options_from_file" title="libconfig.set_options_from_file"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_file</span></code></a>(filename[,&nbsp;format])</td>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.set_options_from_file.html#libconfig.set_options_from_file" title="libconfig.set_options_from_file"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_file</span></code></a>(filename[,&nbsp;format])</td>
<td>Load options from file.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.set_options_from_JSON.html#libconfig.set_options_from_JSON" title="libconfig.set_options_from_JSON"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_JSON</span></code></a>(filename)</td>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.set_options_from_JSON.html#libconfig.set_options_from_JSON" title="libconfig.set_options_from_JSON"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_JSON</span></code></a>(filename)</td>
<td>Load options from a YAML-formated file.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.set_options_from_YAML.html#libconfig.set_options_from_YAML" title="libconfig.set_options_from_YAML"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_YAML</span></code></a>(filename)</td>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.set_options_from_YAML.html#libconfig.set_options_from_YAML" title="libconfig.set_options_from_YAML"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_YAML</span></code></a>(filename)</td>
<td>Load options from a YAML-formated file.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.set_options_from_dict.html#libconfig.set_options_from_dict" title="libconfig.set_options_from_dict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_dict</span></code></a>(data_dict)</td>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.set_options_from_dict.html#libconfig.set_options_from_dict" title="libconfig.set_options_from_dict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_options_from_dict</span></code></a>(data_dict)</td>
<td>Load options from a dictionary.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.show_options.html#libconfig.show_options" title="libconfig.show_options"><code class="xref py py-obj docutils literal notranslate"><span class="pre">show_options</span></code></a>([key])</td>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.show_options.html#libconfig.show_options" title="libconfig.show_options"><code class="xref py py-obj docutils literal notranslate"><span class="pre">show_options</span></code></a>([key])</td>
<td>Returns a copy the options <a class="reference external" href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html#pandas.DataFrame" title="(in pandas v0.23.4)"><code class="xref py py-class docutils literal notranslate"><span class="pre">DataFrame</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.unregister_option.html#libconfig.unregister_option" title="libconfig.unregister_option"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unregister_option</span></code></a>(key,&nbsp;subkey)</td>
<td>Removes an option from the manager.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.write_options_to_JSON.html#libconfig.write_options_to_JSON" title="libconfig.write_options_to_JSON"><code class="xref py py-obj docutils literal notranslate"><span class="pre">write_options_to_JSON</span></code></a>(filename)</td>
<td>Writes the options in JSON format to a file.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.write_options_to_YAML.html#libconfig.write_options_to_YAML" title="libconfig.write_options_to_YAML"><code class="xref py py-obj docutils literal notranslate"><span class="pre">write_options_to_YAML</span></code></a>(filename)</td>
<td>Writes the options in YAML format to a file.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="generated/libconfig.get_local_config_file.html#libconfig.get_local_config_file" title="libconfig.get_local_config_file"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_local_config_file</span></code></a>(filename)</td>
<td>Find local file to setup default values.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="generated/libconfig.on_option_value.html#libconfig.on_option_value" title="libconfig.on_option_value"><code class="xref py py-obj docutils literal notranslate"><span class="pre">on_option_value</span></code></a>(*args)</td>
<td>Temporarily change the configuration values.</td>
</tr>
</tbody>
</table>
</div>
Expand Down
3 changes: 2 additions & 1 deletion docs/generated/libconfig.check_option.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ <h1>libconfig.check_option<a class="headerlink" href="#libconfig-check-option" t
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">KeyError:</th><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
<tr class="field-odd field"><th class="field-name" colspan="2">NotRegisteredError:</th></tr>
<tr class="field-odd field"><td>&#160;</td><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
</tr>
<tr class="field-even field"><th class="field-name">ValueError:</th><td class="field-body">If the provided value is not the expected
type for the option.</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/libconfig.document_options.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="libconfig.get_option" href="libconfig.get_option.html" />
<link rel="next" title="libconfig.get_local_config_file" href="libconfig.get_local_config_file.html" />
<link rel="prev" title="libconfig.check_option" href="libconfig.check_option.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/libconfig.get_local_config_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="libconfig.on_option_value" href="libconfig.on_option_value.html" />
<link rel="prev" title="libconfig.write_options_to_YAML" href="libconfig.write_options_to_YAML.html" />
<link rel="next" title="libconfig.get_option" href="libconfig.get_option.html" />
<link rel="prev" title="libconfig.document_options" href="libconfig.document_options.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
Expand Down
5 changes: 3 additions & 2 deletions docs/generated/libconfig.get_option.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="libconfig.get_option_default" href="libconfig.get_option_default.html" />
<link rel="prev" title="libconfig.document_options" href="libconfig.document_options.html" />
<link rel="prev" title="libconfig.get_local_config_file" href="libconfig.get_local_config_file.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
Expand Down Expand Up @@ -126,7 +126,8 @@ <h1>libconfig.get_option<a class="headerlink" href="#libconfig-get-option" title
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">KeyError:</th><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
<tr class="field-odd field"><th class="field-name" colspan="2">NotRegisteredError:</th></tr>
<tr class="field-odd field"><td>&#160;</td><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
</tr>
<tr class="field-even field"><th class="field-name">ValueError:</th><td class="field-body">If a <code class="docutils literal notranslate"><span class="pre">in_path</span></code> type with <a class="reference external" href="https://docs.python.org/2/library/constants.html#None" title="(in Python v2.7)"><code class="xref py py-data docutils literal notranslate"><span class="pre">None</span></code></a> value is
requested.</td>
Expand Down
3 changes: 2 additions & 1 deletion docs/generated/libconfig.get_option_default.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ <h1>libconfig.get_option_default<a class="headerlink" href="#libconfig-get-optio
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">KeyError:</th><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
<tr class="field-odd field"><th class="field-name" colspan="2">NotRegisteredError:</th></tr>
<tr class="field-odd field"><td>&#160;</td><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
</tr>
</tbody>
</table>
Expand Down
5 changes: 3 additions & 2 deletions docs/generated/libconfig.get_option_description.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="libconfig.lock_option" href="libconfig.lock_option.html" />
<link rel="next" title="libconfig.ifndef" href="libconfig.ifndef.html" />
<link rel="prev" title="libconfig.get_option_default" href="libconfig.get_option_default.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
Expand Down Expand Up @@ -124,7 +124,8 @@ <h1>libconfig.get_option_description<a class="headerlink" href="#libconfig-get-o
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">KeyError:</th><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
<tr class="field-odd field"><th class="field-name" colspan="2">NotRegisteredError:</th></tr>
<tr class="field-odd field"><td>&#160;</td><td class="field-body">If <code class="docutils literal notranslate"><span class="pre">key</span></code> or <code class="docutils literal notranslate"><span class="pre">subkey</span></code> do not define any option.</td>
</tr>
</tbody>
</table>
Expand Down
Loading

0 comments on commit eab0a1e

Please sign in to comment.