Skip to content

Commit

Permalink
update annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
manuphatak committed Dec 18, 2015
1 parent 7ce69cf commit 87eeb09
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 27 deletions.
4 changes: 2 additions & 2 deletions docs/source/readme_title.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ python_hangman
:alt: Documentation Status


A python version agnostic, tox tested, travis-backed program! Documented and distributed.

Has **very high** unit test coverage, with passing tests on every relevant version of python including PyPy.

A well tested, cli, python version-agnostic, multi-platform hangman game. It's built following a TDD workflow and a MVC design pattern. Each component services a sensibly distinct logical purpose. Python Hangman is a version agnostic, tox tested, travis-backed program! Documented and distributed.
7 changes: 4 additions & 3 deletions hangman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
python_hangman
==============
A well tested, cli, python version-agnostic, multi-platform hangman game.
It's built following TDD principles and each component services a
sensibly distinct logical purpose.
A well tested, cli, python version-agnostic, multi-platform hangman game. It's built following a TDD workflow and a
MVC design pattern. Each component services a sensibly distinct logical purpose. Python Hangman is a version
agnostic, tox tested, travis-backed program! Documented and distributed.
"""
from __future__ import absolute_import

import logging

from ._compat import NullHandler
Expand Down
3 changes: 0 additions & 3 deletions hangman/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

@click.command()
def cli():
"""
Start a new game.
"""
controller.run()


Expand Down
8 changes: 3 additions & 5 deletions hangman/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"""
hangman.controller
~~~~~~~~~~~~~~~~~~
This module is responsible for guiding the user through the game.
"""
from __future__ import absolute_import

Expand Down Expand Up @@ -31,9 +29,9 @@ def game_loop(game=Hangman(), flash=FlashMessage()):

def run(game=Hangman(), flash=FlashMessage()):
"""
Run ``game_loop``, handle exit.
Run ``game_loop`` and handle exiting.
Logic is separated from game_loop to cleanly avoid recursion limits.
Logic is separated from game_loop to cleanly avoid python recursion limits.
:param hangman.model.Hangman game: Hangman game instance.
:param hangman.utils.FlashMessage flash: FlashMessage utility
Expand All @@ -45,7 +43,7 @@ def run(game=Hangman(), flash=FlashMessage()):
try:
game_loop(game=game, flash=flash)
except KeyboardInterrupt:
# Exit immediately
# exit immediately
return view.say_goodbye()

if not view.prompt_play_again():
Expand Down
2 changes: 0 additions & 2 deletions hangman/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"""
hangman.model
~~~~~~~~~~~~~
This module contains all of the game logic.
"""
from __future__ import absolute_import
import re
Expand Down
17 changes: 6 additions & 11 deletions hangman/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def set(cls, *values):
"""
Set `WordBank` word list.
Useful for testing.
:param tuple values:
"""
cls.WORDS = list(values)
Expand All @@ -56,28 +58,21 @@ class FlashMessage(object):
game_answer = ''

def __call__(self, message):
"""
Set message to be flashed.
"""Set message to be flashed."""

:param str message:
"""
self.message = str(message)

def __str__(self):
"""
Returns and clears the message
"""Returns and clears the message"""

:return: Flashed message.
:rtype: str
"""
message, self.message = self.message, ''
return str(message)

def __bool__(self):
# Python3 compatibility
return bool(self.message)
return self.__nonzero__()

def __nonzero__(self): # pragma: no cover
def __nonzero__(self):
# Python2 compatibility
return bool(self.message)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run_tests(self):
setup( # :off
name='python_hangman',
version='2.2.0',
description='Python Hangman TDD demonstration.',
description='Python Hangman TDD/MVC demonstration.',
long_description='\n\n'.join([readme, history]),
author='Manu Phatak',
author_email='bionikspoon@gmail.com',
Expand Down

0 comments on commit 87eeb09

Please sign in to comment.