[Python-modules-commits] [pyjokes] 01/01: New upstream version 0.5.0
Ethan Ward
ethanward-guest at moszumanska.debian.org
Mon Aug 21 23:23:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
ethanward-guest pushed a commit to annotated tag upstream/0.5.0
in repository pyjokes.
commit 6b14ee8d4aa7f318beb14baae33904dd7eb786ba
Author: Ethan Ward <ethan.ward at mycroft.ai>
Date: Mon Aug 21 18:23:23 2017 -0500
New upstream version 0.5.0
---
.gitignore | 6 ++
.travis.yml | 12 ++++
CONTRIBUTING.md | 30 ++++++++++
LICENCE.txt | 27 +++++++++
PKG-INFO | 110 ----------------------------------
docs/api.md | 37 ++++++++++++
docs/images/pyjokes.png | Bin 0 -> 114923 bytes
docs/images/society.jpg | Bin 0 -> 148866 bytes
docs/index.md | 49 +++++++++++++++
docs/install.md | 57 ++++++++++++++++++
docs/society.md | 12 ++++
mkdocs.yml | 13 ++++
pyjokes.egg-info/PKG-INFO | 110 ----------------------------------
pyjokes.egg-info/SOURCES.txt | 14 -----
pyjokes.egg-info/dependency_links.txt | 1 -
pyjokes.egg-info/top_level.txt | 1 -
setup.cfg | 5 --
tests/test_cli_error.py | 19 ++++++
tests/test_get_joke.py | 40 +++++++++++++
tests/test_joke_length.py | 18 ++++++
20 files changed, 320 insertions(+), 241 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..92a7d45
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+*.pyc
+*.egg-info/
+build/
+dist/
+website
+.idea/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..0bdc4f2
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,12 @@
+language: python
+
+python:
+ - "2.7"
+ - "3.4"
+
+env:
+ - PIP_USE_MIRRORS=true
+
+install: python setup.py install
+
+script: python setup.py test
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..6d33ddf
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,30 @@
+# Contributing
+
+## Jokes
+
+New jokes should be proposed in the [proposal issue](https://github.com/pyjokes/pyjokes/issues/10) or via pull request.
+
+New languages are welcome and should follow the existing format.
+
+New categories should be proposed in a [GitHub issue](https://github.com/pyjokes/pyjokes/issues).
+
+### Joke policy
+
+- Maximum joke length: 140 characters
+- Gender neutrality (mix of he/she/they)
+- No assumption of gender or sexuality
+- No racism
+
+## Technical Issues
+
+Please report bugs and other issues as [GitHub issues](https://github.com/pyjokes/pyjokes/issues) ensuring to give as much detail about your problem as possible.
+
+## Complaints
+
+If you have a problem with the content of the jokes, please raise a [GitHub issue](https://github.com/pyjokes/pyjokes/issues) for us to discuss.
+
+## Development Policy
+
+- Python 2/3 compatibility
+- PEP8-compliance (with exceptions)
+- Tests should be passing
diff --git a/LICENCE.txt b/LICENCE.txt
new file mode 100644
index 0000000..ed4c4d6
--- /dev/null
+++ b/LICENCE.txt
@@ -0,0 +1,27 @@
+Copyright 2014- Pyjokes Society
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the copyright holder nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/PKG-INFO b/PKG-INFO
deleted file mode 100644
index 9bbccf8..0000000
--- a/PKG-INFO
+++ /dev/null
@@ -1,110 +0,0 @@
-Metadata-Version: 1.1
-Name: pyjokes
-Version: 0.5.0
-Summary: One line jokes for programmers (jokes as a service)
-Home-page: https://github.com/pyjokes/pyjokes
-Author: Pyjokes Society
-Author-email: UNKNOWN
-License: BSD
-Description: .. image:: https://travis-ci.org/pyjokes/pyjokes.svg
- :target: https://travis-ci.org/pyjokes/pyjokes
-
- =======
- pyjokes
- =======
-
- One line jokes for programmers (jokes as a service)
-
- Installation
- ============
-
- Install the `pyjokes` module with pip.
-
- See the `documentation`_ for installation instructions.
-
- Usage
- =====
-
- Once installed, simply call `pyjoke` from the command line.
-
- Alternatively use the `-c` flag to get jokes from a specific category. Options::
-
- -c neutral [default] (neutral geek jokes)
- -c adult (adult geek jokes)
- -c chuck (Chuck Norris geek jokes)
- -c all (all jokes)
-
- You can also access the jokes in your own project by importing `pyjokes` and using the functions `get_joke` and `get_jokes`
-
- Comprehensive documentation is available at `http://pyjoke.es`_
-
- Contributors
- ============
-
- Development:
-
- * `Ben Nuttall`_
- * `Alex Savio`_
- * `Borja Ayerdi`_
- * `Oier Etxaniz`_
-
- Jokes:
-
- * `Luke Wren`_
- * `Sarah Bird`_
- * `Yash Mehrotra`_
- * `Marc Kirkwood`_
- * `Gregory Parker`_
-
- Contributing
- ============
-
- * The code is licensed under the `BSD Licence`_
- * The project source code is hosted on `GitHub`_
- * Please use `GitHub issues`_ to submit bugs and report issues
- * Feel free to `contribute`_ to the code
- * Feel free to contribute jokes (via pull request or `proposal issue`_)
- * See the `contributing policy`_ on GitHub
-
- Tests
- =====
-
- Install requirements (pytest)
-
- Run tests::
-
- python setup.py test
-
- Pyjokes Society
- ===============
-
- This project is was founded at `PySS 2014`_ and is directed by the `Pyjokes Society`_.
-
-
- .. _documentation: http://pyjoke.es/install/
- .. _http://pyjoke.es: http://pyjoke.es
- .. _Ben Nuttall: https://github.com/bennuttall
- .. _Alex Savio: https://github.com/alexsavio
- .. _Borja Ayerdi: https://github.com/borjaayerdi
- .. _Oier Etxaniz: https://github.com/oiertwo
- .. _Luke Wren: https://github.com/wren6991
- .. _Sarah Bird: https://github.com/birdsarah
- .. _Yash Mehrotra: https://github.com/yashmehrotra
- .. _Marc Kirkwood: https://github.com/trojjer
- .. _Gregory Parker: https://github.com/ElectronicsGeek
- .. _BSD Licence: http://opensource.org/licenses/BSD-3-Clause
- .. _GitHub: https://github.com/pyjokes/pyjokes
- .. _GitHub Issues: https://github.com/pyjokes/pyjokes/issues
- .. _contribute: https://github.com/pyjokes/pyjokes/tree/master/CONTRIBUTING.md
- .. _proposal issue: https://github.com/pyjokes/pyjokes/issues/10
- .. _contributing policy: https://github.com/pyjokes/pyjokes/tree/master/CONTRIBUTING.md
- .. _PySS 2014: http://www.pyss.org/
- .. _Pyjokes Society: http://pyjok.es/society/
-
-Keywords: pyjokes,jokes
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Topic :: Utilities
-Classifier: License :: OSI Approved :: BSD License
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
diff --git a/docs/api.md b/docs/api.md
new file mode 100644
index 0000000..bbfbe44
--- /dev/null
+++ b/docs/api.md
@@ -0,0 +1,37 @@
+# API Reference
+
+Import the pyjokes module to access `pyjokes` in any Python application:
+
+```python
+import pyjokes
+```
+
+## pyjokes.get_joke()
+
+Returns a random joke from the given category in the given language.
+
+| Parameters | Types | Values | Default |
+| ---------- | ----- | ------ | ------- |
+| language | str | 'en', 'de', 'es' | 'en' |
+| category | str | 'neutral', 'adult', 'chuck', 'all' | 'neutral' |
+
+Return type: str
+
+If the `language` value provided is not available, a `LanguageNotFoundError` exception is raised.
+
+If the `category` value provided is not available, a `CategoryNotFoundError` exception is raised.
+
+## pyjokes.get_jokes()
+
+Returns a list of jokes from the given category in the given language.
+
+| Parameters | Types | Values | Default |
+| ---------- | ----- | ------ | ------- |
+| language | str | 'en', 'de', 'es' | 'en' |
+| category | str | 'neutral', 'adult', 'chuck', 'all' | 'neutral' |
+
+Return type: list
+
+If the `language` value provided is not available, a `LanguageNotFoundError` exception is raised.
+
+If the `category` value provided is not available, a `CategoryNotFoundError` exception is raised.
diff --git a/docs/images/pyjokes.png b/docs/images/pyjokes.png
new file mode 100644
index 0000000..d33ec0b
Binary files /dev/null and b/docs/images/pyjokes.png differ
diff --git a/docs/images/society.jpg b/docs/images/society.jpg
new file mode 100644
index 0000000..af5a3fa
Binary files /dev/null and b/docs/images/society.jpg differ
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..50ac104
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,49 @@
+# pyjokes
+
+One line jokes for programmers (jokes as a service)
+
+![pyjokes](images/pyjokes.png)
+
+## Install
+
+Install with pip:
+
+```bash
+sudo pip install pyjokes
+```
+
+See the [install](install.md) page for information on installing on different platforms.
+
+## Usage
+
+### Command line
+
+Run `pyjoke` at the command line to get a random joke:
+
+```
+$ pyjoke
+Why did the programmer quit his job? Because he didn't get arrays.
+```
+
+### Python
+
+Import the `pyjokes` module in a Python file and use the `get_joke` function to easily drop a random joke into your application:
+
+```python
+import pyjokes
+
+print(pyjokes.get_joke())
+```
+
+See the [API reference](api.md) for full documentation.
+
+## Proposal of new jokes
+
+New jokes should be proposed in the [proposal issue](https://github.com/pyjokes/pyjokes/issues/10) or via pull request.
+
+## Reference
+
+- [GitHub](https://github.com/pyjokes/pyjokes)
+- [Wiki](https://github.com/pyjokes/pyjokes/wiki)
+- [PyPi](https://pypi.python.org/pypi/pyjokes)
+- [Twitter](https://twitter.com/pyjokes_bot)
diff --git a/docs/install.md b/docs/install.md
new file mode 100644
index 0000000..ff8b3de
--- /dev/null
+++ b/docs/install.md
@@ -0,0 +1,57 @@
+# Install pyjokes
+
+## Pip or virtualenv
+
+If you have `pip` installed, or you're using a virtualenv, just install `pyjokes`:
+
+```bash
+pip3 install pyjokes
+```
+
+or
+
+```bash
+pip install pyjokes
+```
+
+## Linux (Ubuntu)
+
+First install `pip`, Python's package manager using Ubuntu's package manager:
+
+```bash
+sudo apt-get install python3-pip
+```
+
+then install `pyjokes` using `pip`:
+
+```bash
+sudo pip3 install pyjokes
+```
+
+The instructions for Python 2 are similar:
+
+```bash
+sudo apt-get install python-pip
+sudo pip install pyjokes
+```
+
+## Raspberry Pi (Raspbian)
+
+First install `pip`, Python's package manager using your Raspbian's package manager:
+
+```bash
+sudo apt-get install python3-pip
+```
+
+then install `pyjokes` using `pip`:
+
+```bash
+sudo pip-3.2 install pyjokes
+```
+
+The instructions for Python 2 are similar:
+
+```bash
+sudo apt-get install python-pip
+sudo pip install pyjokes
+```
diff --git a/docs/society.md b/docs/society.md
new file mode 100644
index 0000000..1db9c4b
--- /dev/null
+++ b/docs/society.md
@@ -0,0 +1,12 @@
+# Pyjokes Society
+
+Founders:
+
+- [Ben Nuttall](https://twitter.com/ben_nuttall) - Chairperson
+- [Alex Savio](https://twitter.com/alex_savio) - Vice-chairperson
+- [Borja Ayerdi](https://twitter.com/bayerdi) - Treasurer
+- [Oier Etxaniz](https://twitter.com/oiertwo) - Spokesperson
+
+![Pyjokes Society](images/society.jpg)
+
+See members on the [wiki](https://github.com/pyjokes/pyjokes/wiki).
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 0000000..e0af10f
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,13 @@
+site_name: pyjokes
+theme: mkdocs
+site_url: http://pyjok.es/
+repo_url: https://github.com/pyjokes/pyjokes
+site_description: One-line programmer jokes (jokes-as-a-service)
+site_author: Pyjokes Society
+site_dir: website
+google_analytics: ['UA-65996819-1', 'pyjok.es']
+pages:
+- 'Home': 'index.md'
+- 'Install': 'install.md'
+- 'API Reference': 'api.md'
+- 'Pyjokes Society': 'society.md'
diff --git a/pyjokes.egg-info/PKG-INFO b/pyjokes.egg-info/PKG-INFO
deleted file mode 100644
index 9bbccf8..0000000
--- a/pyjokes.egg-info/PKG-INFO
+++ /dev/null
@@ -1,110 +0,0 @@
-Metadata-Version: 1.1
-Name: pyjokes
-Version: 0.5.0
-Summary: One line jokes for programmers (jokes as a service)
-Home-page: https://github.com/pyjokes/pyjokes
-Author: Pyjokes Society
-Author-email: UNKNOWN
-License: BSD
-Description: .. image:: https://travis-ci.org/pyjokes/pyjokes.svg
- :target: https://travis-ci.org/pyjokes/pyjokes
-
- =======
- pyjokes
- =======
-
- One line jokes for programmers (jokes as a service)
-
- Installation
- ============
-
- Install the `pyjokes` module with pip.
-
- See the `documentation`_ for installation instructions.
-
- Usage
- =====
-
- Once installed, simply call `pyjoke` from the command line.
-
- Alternatively use the `-c` flag to get jokes from a specific category. Options::
-
- -c neutral [default] (neutral geek jokes)
- -c adult (adult geek jokes)
- -c chuck (Chuck Norris geek jokes)
- -c all (all jokes)
-
- You can also access the jokes in your own project by importing `pyjokes` and using the functions `get_joke` and `get_jokes`
-
- Comprehensive documentation is available at `http://pyjoke.es`_
-
- Contributors
- ============
-
- Development:
-
- * `Ben Nuttall`_
- * `Alex Savio`_
- * `Borja Ayerdi`_
- * `Oier Etxaniz`_
-
- Jokes:
-
- * `Luke Wren`_
- * `Sarah Bird`_
- * `Yash Mehrotra`_
- * `Marc Kirkwood`_
- * `Gregory Parker`_
-
- Contributing
- ============
-
- * The code is licensed under the `BSD Licence`_
- * The project source code is hosted on `GitHub`_
- * Please use `GitHub issues`_ to submit bugs and report issues
- * Feel free to `contribute`_ to the code
- * Feel free to contribute jokes (via pull request or `proposal issue`_)
- * See the `contributing policy`_ on GitHub
-
- Tests
- =====
-
- Install requirements (pytest)
-
- Run tests::
-
- python setup.py test
-
- Pyjokes Society
- ===============
-
- This project is was founded at `PySS 2014`_ and is directed by the `Pyjokes Society`_.
-
-
- .. _documentation: http://pyjoke.es/install/
- .. _http://pyjoke.es: http://pyjoke.es
- .. _Ben Nuttall: https://github.com/bennuttall
- .. _Alex Savio: https://github.com/alexsavio
- .. _Borja Ayerdi: https://github.com/borjaayerdi
- .. _Oier Etxaniz: https://github.com/oiertwo
- .. _Luke Wren: https://github.com/wren6991
- .. _Sarah Bird: https://github.com/birdsarah
- .. _Yash Mehrotra: https://github.com/yashmehrotra
- .. _Marc Kirkwood: https://github.com/trojjer
- .. _Gregory Parker: https://github.com/ElectronicsGeek
- .. _BSD Licence: http://opensource.org/licenses/BSD-3-Clause
- .. _GitHub: https://github.com/pyjokes/pyjokes
- .. _GitHub Issues: https://github.com/pyjokes/pyjokes/issues
- .. _contribute: https://github.com/pyjokes/pyjokes/tree/master/CONTRIBUTING.md
- .. _proposal issue: https://github.com/pyjokes/pyjokes/issues/10
- .. _contributing policy: https://github.com/pyjokes/pyjokes/tree/master/CONTRIBUTING.md
- .. _PySS 2014: http://www.pyss.org/
- .. _Pyjokes Society: http://pyjok.es/society/
-
-Keywords: pyjokes,jokes
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Topic :: Utilities
-Classifier: License :: OSI Approved :: BSD License
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
diff --git a/pyjokes.egg-info/SOURCES.txt b/pyjokes.egg-info/SOURCES.txt
deleted file mode 100644
index 4175342..0000000
--- a/pyjokes.egg-info/SOURCES.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-MANIFEST.in
-README.rst
-setup.py
-pyjokes/__init__.py
-pyjokes/jokes_de.py
-pyjokes/jokes_en.py
-pyjokes/jokes_es.py
-pyjokes/pyjokes.py
-pyjokes.egg-info/PKG-INFO
-pyjokes.egg-info/SOURCES.txt
-pyjokes.egg-info/dependency_links.txt
-pyjokes.egg-info/top_level.txt
-scripts/pyjoke
-scripts/pyjokes
\ No newline at end of file
diff --git a/pyjokes.egg-info/dependency_links.txt b/pyjokes.egg-info/dependency_links.txt
deleted file mode 100644
index 8b13789..0000000
--- a/pyjokes.egg-info/dependency_links.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pyjokes.egg-info/top_level.txt b/pyjokes.egg-info/top_level.txt
deleted file mode 100644
index 67cf03a..0000000
--- a/pyjokes.egg-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-pyjokes
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 72f9d44..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[egg_info]
-tag_svn_revision = 0
-tag_date = 0
-tag_build =
-
diff --git a/tests/test_cli_error.py b/tests/test_cli_error.py
new file mode 100644
index 0000000..b674602
--- /dev/null
+++ b/tests/test_cli_error.py
@@ -0,0 +1,19 @@
+import pytest
+import subprocess
+from subprocess import PIPE
+
+
+def test_pyjokes_call_exception():
+ pytest.raises(
+ subprocess.CalledProcessError, "subprocess.check_call('pyjokes')"
+ )
+
+
+def test_pyjokes_call_output():
+ try:
+ p = subprocess.Popen('pyjokes', stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ except:
+ out, err = p.communicate()
+ assert out == b'Did you mean pyjoke?'
+ assert p.returncode == 1
+ pass
diff --git a/tests/test_get_joke.py b/tests/test_get_joke.py
new file mode 100644
index 0000000..9d0a350
--- /dev/null
+++ b/tests/test_get_joke.py
@@ -0,0 +1,40 @@
+import pytest
+from pyjokes import get_joke
+from pyjokes.pyjokes import LanguageNotFoundError, CategoryNotFoundError
+
+
+languages = ['en', 'de', 'es']
+categories = ['neutral', 'adult', 'all']
+test_data = ['', 'abc', '123']
+
+
+def test_get_joke():
+ assert get_joke()
+
+ for language in languages:
+ assert get_joke(language=language)
+
+ for category in categories:
+ assert get_joke(category=category)
+
+
+def test_get_joke_with_language_raises():
+ for language in test_data:
+ assert pytest.raises(
+ LanguageNotFoundError, get_joke, language=language
+ )
+
+
+def test_get_joke_with_category_raises():
+ for category in test_data:
+ assert pytest.raises(
+ CategoryNotFoundError, get_joke, category=category
+ )
+
+
+def test_get_joke_in_language_with_category_raises():
+ for category in test_data:
+ assert pytest.raises(
+ CategoryNotFoundError, get_joke,
+ language='en', category=category
+ )
diff --git a/tests/test_joke_length.py b/tests/test_joke_length.py
new file mode 100644
index 0000000..db832df
--- /dev/null
+++ b/tests/test_joke_length.py
@@ -0,0 +1,18 @@
+from pyjokes.jokes_en import jokes_en
+from pyjokes.jokes_de import jokes_de
+from pyjokes.jokes_es import jokes_es
+
+
+def _test_joke_length(joke):
+ assert len(joke) <= 140
+
+
+def _test_joke_group(jokes):
+ for joke in jokes:
+ _test_joke_length(joke)
+
+
+def test_jokes_lengths():
+ jokes_sets = [jokes_en, jokes_es, jokes_de]
+ for jokes in jokes_sets:
+ _test_joke_group(jokes['all'])
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pyjokes.git
More information about the Python-modules-commits
mailing list