Skip to content

Commit c0d3ae1

Browse files
committed
Update README to meet the previous changes of the code.
1 parent 72fb697 commit c0d3ae1

File tree

7 files changed

+56
-30
lines changed

7 files changed

+56
-30
lines changed

HelloWorld/__init__.py

Whitespace-only changes.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
init:
2-
pip install -r requirements.txt
2+
pip3 install -r requirements.txt
33

44
test:
55
nosetests tests

README.rst

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ A Minimal Hello World Class <Add>
2525

2626
.. code-block:: python
2727
28-
from challenges.challenge import Challenge
28+
from challenges import Challenge
2929
30-
class Add(Challenge):
30+
class AddChallenge(Challenge):
3131
sample = '''
3232
5, 6
3333
'''
@@ -41,16 +41,16 @@ A Minimal Hello World Class <Add>
4141
The class to write lets you focus on the core algorithms of the challenge while keeping stuff like opening, reading and
4242
writing of files out of the way. You inherit several methods to set up the model or to format your result for writing.
4343

44-
While the class variable `sample` just holds a minimal example of the input, the actual input is later injected by
44+
While the class attribute `sample` just holds a minimal example of the input, the actual input is later injected by
4545
the **Challenge Runner** via the command line. In Bioinformatics this is often a large file of DNA.
4646

4747
.. hint:: See a more verbose example of HelloWorld.
4848

49-
* HelloWorld_
50-
* HelloWorldTestCase_
49+
* HelloWorldChallenge_
50+
* HelloWorldTest_
5151

52-
.. _HelloWorld: https://github.com/elmar-hinz/Python.Challenges/blob/master/HelloWorld/HelloWorld.py
53-
.. _HelloWorldTestCase: https://github.com/elmar-hinz/Python.Challenges/blob/master/HelloWorld/HelloWorldTestCase.py
52+
.. _HelloWorldChallenge: https://github.com/elmar-hinz/Python.Challenges/blob/master/HelloWorld/challenge.py
53+
.. _HelloWorldTest: https://github.com/elmar-hinz/Python.Challenges/blob/master/HelloWorld/test.py
5454

5555

5656
The Challenge Runner Supports the Following Features
@@ -71,9 +71,9 @@ The Layout of Your Directory Looks Like This
7171
7272
myChallenges/
7373
Challenge1/challenge.py
74-
Challenge1/testcase.py
74+
Challenge1/test.py
7575
Challenge2/challenge.py
76-
Challenge2/testcase.py
76+
Challenge2/test.py
7777
... more challenges ...
7878
7979
The names `Challenge1` and `Challenge2` are just placeholders for the names you choose during scaffolding.
@@ -108,7 +108,7 @@ You now find the files:
108108
109109
myChallenges/
110110
Challenge3/challenge.py
111-
Challenge3/testcase.py
111+
Challenge3/test.py
112112
Challenge3/__init__.py
113113
114114
Check it's working by running the unit test case.
@@ -193,7 +193,15 @@ There are two deliberate exceptions:
193193

194194
In contradiction to the style guide directories of the challenges are not all lowercase. Especially the
195195
first character must be uppercase. This is used to find and list the challenge directories between other modules.
196-
The directory and the class name must use the same word, with the `.py` extension for the file.
196+
If the name of your challenge is **ExampleProblem** then this are the required names:
197+
198+
:Directory: ``ExampleProblem/``
199+
:Challenge file: ``ExampleProblem/challenge.py``
200+
:Unittest file: ``ExampleProblem/test.py``
201+
:Full qualified challenge class: ``ExampleProblem.challenge.ExampleProblemChallenge``
202+
:Full qualified test class: ``ExampleProblem.test.ExampleProblemTest``
203+
204+
This is automatially wired up during scaffolding.
197205

198206
2. Inherited class attributes and methods don't have a leading underscore:
199207

@@ -203,14 +211,14 @@ There are two deliberate exceptions:
203211

204212
.. tip::
205213

206-
On useful advantage of naming the directory just like your challenge class is, that you can use the path expansion
207-
mechanism of the shell. Write the first characters of the class/directory name and hit <TAB>. Now you can use the
214+
On useful advantage of naming the directory just like your challenge is, that you can use the path expansion
215+
mechanism of the shell. Write the first characters of the directory name and hit <TAB>. Now you can use the
208216
directory name as name of the challenge. A trailing slash is discarded. The following two inputs are equivalent.
209217

210218
.. code-block:: bash
211219
212-
prompt> challenge -k HelloWorld
213-
prompt> challenge -k HelloWorld/
220+
prompt> challenge -k ExampleProblem
221+
prompt> challenge -k ExampleProblem/
214222
215223
Installation
216224
============

challenges/challenge.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,20 @@
1111
class Challenge:
1212
"""Base class of all challenges
1313
14-
Designe concept is the Template Method Design Pattern (GOF).
14+
Design concept is the Template Method Design Pattern (GOF).
1515
16-
Attributes
17-
----------
16+
Attributes:
1817
1918
:sample: The input of the challenge.
2019
:output: The output of the challenge
2120
22-
Workflow
23-
--------
21+
Workflow:
2422
2523
The `main` method controls the overall workflow by calling the worker
2624
methods. This is the common character of all challenges.
2725
The base class controls the workflow of the derived workers.
2826
29-
Workers
30-
-------
27+
Workers:
3128
3229
The worker methods need to be implemented by the inheriting class.
3330
@@ -36,15 +33,13 @@ class Challenge:
3633
:calc: Run the main algorithm of the challenge.
3734
:format: Create the output string required by the grader.
3835
39-
Library
40-
-------
36+
Library:
4137
4238
The other methods support the implementation of the workers. They address
4339
the extraction of data from the input lines or the formatting of the
4440
output.
4541
46-
Sample
47-
------
42+
Sample:
4843
4944
The attribute `sample` is both used as class and as instance attribute.
5045
When the instance attribute is injected it shadows the class attribute. By

docs/HelloWorld.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ HelloWorld.challenge module
1212
:undoc-members:
1313
:show-inheritance:
1414

15-
HelloWorld.testcase module
16-
--------------------------
15+
HelloWorld.test module
16+
----------------------
1717

18-
.. automodule:: HelloWorld.testcase
18+
.. automodule:: HelloWorld.test
1919
:members:
2020
:undoc-members:
2121
:show-inheritance:

docs/modules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ API
66

77
HelloWorld
88
challenges
9+
tests

docs/tests.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
tests package
2+
=============
3+
4+
Submodules
5+
----------
6+
7+
tests.test_challenge module
8+
---------------------------
9+
10+
.. automodule:: tests.test_challenge
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
16+
Module contents
17+
---------------
18+
19+
.. automodule:: tests
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:

0 commit comments

Comments
 (0)