canvascli package¶
Submodules¶
canvascli.canvas module¶
Drawing Canvas.
-
class
canvascli.canvas.
Canvas
(width=None, height=None)[source]¶ Bases:
object
Drawing Canvas.
An empty canvas can be defined but it needs to be created to allow drawing.
The canvas is based on 1-indexing, so all coordinates (x, y points) for drawing must be greater than 1.
The internal representation of the canvas is based on 0-indexing like all python containers and uses a list of lists.
- This canvas currently only support an integer coordinate system.
- Currently only horizontal or vertical lines are supported.
- Horizontal and vertical lines will be drawn using ‘x’
- The horizontal and vertical border of the canvas will be drawn using ‘-‘ and ‘|’ respectively.
-
DEFAULT_COLOR
= 'o'¶
-
HBORDER
= '-'¶
-
MARKER
= 'x'¶
-
VBORDER
= '|'¶
-
data
¶ Return the list of list holding the canvas data values..
-
fill
(x, y, color='o')[source]¶ Fill the entire area connected to x and y with color.
- This method uses the “Forest Fire” algorithm. Could be improved, but should suffice for this application.
-
height
¶ Return the current height of the canvas, or None if not set.
-
width
¶ Return the current width of the canvas, or None if not set.
canvascli.cli module¶
Console script for canvascli.
canvascli.parser module¶
CLI handler for canvas program based on a custom argparser.
-
exception
canvascli.parser.
ArgumentParserError
(message)[source]¶ Bases:
exceptions.Exception
Custom exception for ThrowingArgumentParser.
-
class
canvascli.parser.
CommandParserHandler
[source]¶ Bases:
object
CLI handler for canvas program based on argparse.
-
HELP
= "Type 'H' for help"¶
-
-
class
canvascli.parser.
ThrowingArgumentParser
(prog=None, usage=None, description=None, epilog=None, version=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True)[source]¶ Bases:
argparse.ArgumentParser
Custom argument parser that avoids exit on errors.
canvascli.utils module¶
Test cases.
Module contents¶
Top-level package for CanvasCLI.