Renamed cellgroup.py and CellConstraint.
authorEevee <eevee@nyarumaa.(none)>
Wed, 7 Jan 2009 13:44:00 +0000 (08:44 -0500)
committerEevee <eevee@nyarumaa.(none)>
Wed, 7 Jan 2009 13:44:00 +0000 (08:44 -0500)
They are now constrants.py and Constraint, respectively.

pseudoku/grid/__init__.py
pseudoku/grid/constraints.py [moved from pseudoku/grid/cellgroup.py with 95% similarity]

index a62f18f..3bf854b 100644 (file)
@@ -5,7 +5,7 @@ from operator import attrgetter
 import re
 from weakref import ref
 
-from cellgroup import CellConstraint, Row, Column, Box
+from constraints import Constraint, Row, Column, Box
 
 symbols = [str(x + 1) for x in range(9)] + [chr(x + 97) for x in xrange(26)]
 
@@ -144,7 +144,7 @@ class Grid(object):
 
     ### Accessors
 
-    def get_constraints(self, constraint_class=CellConstraint):
+    def get_constraints(self, constraint_class=Constraint):
         """Returns constraints of a certain type.  Returns all of them by
         default.
         """
similarity index 95%
rename from pseudoku/grid/cellgroup.py
rename to pseudoku/grid/constraints.py
index 841a490..91f8287 100644 (file)
@@ -2,7 +2,7 @@ from __future__ import division
 
 from weakref import ref
 
-class CellConstraint(object):
+class Constraint(object):
     """Represents any group of cells in a grid that cannot repeat a digit."""
 
     ### Accessors
@@ -46,7 +46,7 @@ class CellConstraint(object):
             target_cell.set(value)
 
 
-class Box(CellConstraint):
+class Box(Constraint):
     def _get_box_row(self):
         return self._pos // self.grid._box_width
     box_row = property(_get_box_row)
@@ -67,7 +67,7 @@ class Box(CellConstraint):
                 self._cells.append(ref(self.grid.cell(cell_row, cell_col)))
 
 
-class Row(CellConstraint):
+class Row(Constraint):
     def __init__(self, grid, position):
         self._grid = ref(grid)
         self._pos = position
@@ -76,7 +76,7 @@ class Row(CellConstraint):
         for col in xrange(self.grid._size):
             self._cells.append(ref(self.grid.cell(self._pos, col)))
 
-class Column(CellConstraint):
+class Column(Constraint):
     def __init__(self, grid, position):
         self._grid = ref(grid)
         self._pos = position
@@ -85,7 +85,7 @@ class Column(CellConstraint):
         for row in xrange(self.grid._size):
             self._cells.append(ref(self.grid.cell(row, self._pos)))
 
-class Diagonal(CellConstraint):
+class Diagonal(Constraint):
     def __init__(self, grid, direction='down', offset=0):
         self._grid = ref(grid)
         self._direction = direction