pythonreports-checkins Mailing List for PythonReports (Page 6)
Brought to you by:
a1s
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(45) |
Dec
(56) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(3) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
(10) |
Apr
|
May
(18) |
Jun
(6) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: alexander s. <a1...@us...> - 2006-12-06 16:52:20
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5446 Modified Files: PILDrivers.py Log Message: sweep pylint warnings Index: PILDrivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/PILDrivers.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PILDrivers.py 1 Nov 2006 17:38:34 -0000 1.2 --- PILDrivers.py 6 Dec 2006 16:52:18 -0000 1.3 *************** *** 1,5 **** """Rendering utilities for Python Imaging Library (PIL) backend""" - """History (most recent first): 01-nov-2006 [als] driver classes have backend name property 05-oct-2006 [als] use base classes for the rendering drivers --- 1,5 ---- """Rendering utilities for Python Imaging Library (PIL) backend""" """History (most recent first): + 05-dec-2006 [als] sweep pylint warnings 01-nov-2006 [als] driver classes have backend name property 05-oct-2006 [als] use base classes for the rendering drivers *************** *** 13,17 **** 29-aug-2006 [als] TextDriver ported from previous implementation """ - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 13,16 ---- *************** *** 41,60 **** _image = None # PIL image object (not for external access) - # "compute once" property, setting object type from image content @property ! def type(self): _rv = self._image.format.lower() ! self.__dict__["type"] = _rv return _rv ! # Note: type argument is not used by object factories in PIL driver. @classmethod ! def fromfile(cls, filepath, type): """Create an image source from existing file Parameters: filepath: full path to the image file ! type: image type, e.g. "jpeg" or "png" (Note: not used by PIL driver.) --- 40,64 ---- _image = None # PIL image object (not for external access) @property ! def img_type(self): ! """image type, e.g. "jpeg" or "png" ! ! This is "compute once" property, ! setting object type from image content. ! ! """ _rv = self._image.format.lower() ! self.__dict__["img_type"] = _rv return _rv ! # Note: img_type argument is not used by object factories in PIL driver. @classmethod ! def fromfile(cls, filepath, img_type): """Create an image source from existing file Parameters: filepath: full path to the image file ! img_type: image type, e.g. "jpeg" or "png" (Note: not used by PIL driver.) *************** *** 62,65 **** --- 66,71 ---- """ + # pylint: disable-msg=W0613 + # W0613: Unused argument 'img_type' - the type is guessed from contents _rv = cls() _rv.filepath = filepath *************** *** 68,77 **** @classmethod ! def fromdata(cls, data, type, name=None): """Create an image source from data block Parameters: data: image data ! type: image type, e.g. "jpeg" or "png" (Note: not used by PIL driver.) name: optional name of a report block containing data --- 74,83 ---- @classmethod ! def fromdata(cls, data, img_type, name=None): """Create an image source from data block Parameters: data: image data ! img_type: image type, e.g. "jpeg" or "png" (Note: not used by PIL driver.) name: optional name of a report block containing data *************** *** 80,83 **** --- 86,91 ---- """ + # pylint: disable-msg=W0613 + # W0613: Unused argument 'img_type' - the type is guessed from contents _rv = cls() _rv.name = name *************** *** 93,101 **** return self._image.size ! def getdata(self, type=None): """Return image data as string Parameters: ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 101,109 ---- return self._image.size ! def getdata(self, img_type=None): """Return image data as string Parameters: ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 103,113 **** """ ! if not type: ! type = self.preferred_type _buffer = StringIO() ! self._image.save(_buffer, format=type) return _buffer.getvalue() ! def scale(self, width, height, type=None): """Return a scaled image --- 111,123 ---- """ ! if not img_type: ! # pylint: disable-msg=C0103 ! # C0103: Invalid name "img_type" ! img_type = self.preferred_type _buffer = StringIO() ! self._image.save(_buffer, format=img_type) return _buffer.getvalue() ! def scale(self, width, height, img_type=None): """Return a scaled image *************** *** 115,119 **** width: target image width height: target image height ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 125,129 ---- width: target image width height: target image height ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 121,132 **** """ ! if not type: ! type = self.preferred_type _img = self._image.resize((width, height), Image.ANTIALIAS) _buffer = StringIO() ! _img.save(_buffer, format=type) return _buffer.getvalue() ! def _cut(self, width, height, type): """Return an image cut to dimensions --- 131,144 ---- """ ! if not img_type: ! # pylint: disable-msg=C0103 ! # C0103: Invalid name "img_type" ! img_type = self.preferred_type _img = self._image.resize((width, height), Image.ANTIALIAS) _buffer = StringIO() ! _img.save(_buffer, format=img_type) return _buffer.getvalue() ! def _cut(self, width, height, img_type): """Return an image cut to dimensions *************** *** 134,138 **** width: target image width height: target image height ! type: image type, e.g. "jpeg" or "gif" Return value: image data as string. --- 146,150 ---- width: target image width height: target image height ! img_type: image type, e.g. "jpeg" or "gif" Return value: image data as string. *************** *** 146,150 **** _img = self._image.crop((0, 0, width, height)) _buffer = StringIO() ! _img.save(_buffer, format=type) return _buffer.getvalue() --- 158,162 ---- _img = self._image.crop((0, 0, width, height)) _buffer = StringIO() ! _img.save(_buffer, format=img_type) return _buffer.getvalue() |
From: alexander s. <a1...@us...> - 2006-12-06 16:48:59
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3974 Modified Files: pdf.py Log Message: sweep pylint warnings; remove pdf autostart (can be easily done in command line) Index: pdf.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/pdf.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pdf.py 7 Nov 2006 13:32:02 -0000 1.2 --- pdf.py 6 Dec 2006 16:48:56 -0000 1.3 *************** *** 2,5 **** --- 2,7 ---- """PDF output for PythonReports""" """History (most recent first): + 05-dec-2006 [als] sweep pylint warnings; + remove pdf autostart (can be easily done in command line) 07-Nov-2006 [phd] Added shebang. 20-oct-2006 [als] Barcode X dimension attr renamed to "module" *************** *** 54,58 **** wordspace = 0 ! def __init__(self, report, filepath=None): """Initialize the writer --- 56,60 ---- wordspace = 0 ! def __init__(self, report): """Initialize the writer *************** *** 63,80 **** super(PdfWriter, self).__init__() if isinstance(report, basestring): ! report = prp.load(report) ! self.report = report # element handlers self.handlers = { ! "line": self.DrawLine, ! "rectangle": self.DrawRectangle, ! "text": self.DrawText, ! "barcode": self.DrawBarcode, } if Image: # PIL is loaded - can process images ! self.handlers["image"] = self.DrawImage _images = {} ! for _element in report.findall("data"): _data = StringIO(Data.get_data(_element)) # data blocks may be used for other purposes too. --- 65,83 ---- super(PdfWriter, self).__init__() if isinstance(report, basestring): ! self.report = prp.load(report) ! else: ! self.report = report # element handlers self.handlers = { ! "line": self.drawLine, ! "rectangle": self.drawRectangle, ! "text": self.drawText, ! "barcode": self.drawBarcode, } if Image: # PIL is loaded - can process images ! self.handlers["image"] = self.drawImage _images = {} ! for _element in self.report.findall("data"): _data = StringIO(Data.get_data(_element)) # data blocks may be used for other purposes too. *************** *** 89,93 **** _fonts = {} _registered = set() ! for (_name, _font) in report.fonts.iteritems(): _typeface = _font.get("typeface") _bold = _font.get("bold") --- 92,96 ---- _fonts = {} _registered = set() ! for (_name, _font) in self.report.fonts.iteritems(): _typeface = _font.get("typeface") _bold = _font.get("bold") *************** *** 270,274 **** _box.get("width"), _height) ! def DrawLine(self, line): # set line style, return if the line is not visible if not (self.setStrokeColor(line.get("color")) --- 273,278 ---- _box.get("width"), _height) ! def drawLine(self, line): ! """Draw a line""" # set line style, return if the line is not visible if not (self.setStrokeColor(line.get("color")) *************** *** 287,291 **** self.canvas.line(_x1, _y1, _x2, _y2) ! def DrawRectangle(self, rect): _stroke = self.setStrokeColor(rect.get("pencolor")) \ and self.setPen(rect.get("pen")) --- 291,296 ---- self.canvas.line(_x1, _y1, _x2, _y2) ! def drawRectangle(self, rect): ! """Draw a rectangle""" _stroke = self.setStrokeColor(rect.get("pencolor")) \ and self.setPen(rect.get("pen")) *************** *** 298,302 **** self.canvas.rect(*(self.getDimensions(rect) + (_stroke, _fill))) ! def DrawImage(self, image): _scale = image.get("scale", True) _img = image.get("file") --- 303,308 ---- self.canvas.rect(*(self.getDimensions(rect) + (_stroke, _fill))) ! def drawImage(self, image): ! """Draw an image""" _scale = image.get("scale", True) _img = image.get("file") *************** *** 323,327 **** self.canvas.drawImage(ImageReader(_img), _x, _y) ! def DrawText(self, text): _content = text.find("data").text if not _content: --- 329,334 ---- self.canvas.drawImage(ImageReader(_img), _x, _y) ! def drawText(self, text): ! """Draw a text block""" _content = text.find("data").text if not _content: *************** *** 377,381 **** _tobj.textLine(_line) ! def DrawBarcode(self, barcode): _xdim = barcode.get("module") / 1000. * 72. _stripes = [int(_stripe) * _xdim --- 384,389 ---- _tobj.textLine(_line) ! def drawBarcode(self, barcode): ! """Draw Bar Code symbol""" _xdim = barcode.get("module") / 1000. * 72. _stripes = [int(_stripe) * _xdim *************** *** 412,415 **** --- 420,424 ---- def run(argv=sys.argv): + """Command line executable""" if len(argv) not in (2, 3): print "Usage: %s <printout> [<pdf>]" % argv[0] *************** *** 421,426 **** _pdf = os.path.splitext(_printout)[0] + ".pdf" write(_printout, _pdf) - # XXX DEBUG: run the pdf - os.system(_pdf) if __name__ == "__main__": --- 430,433 ---- |
From: alexander s. <a1...@us...> - 2006-12-06 16:46:25
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3205 Modified Files: fonts.py Log Message: fix style: remove empty line between history and __version__ Index: fonts.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/fonts.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fonts.py 1 Nov 2006 11:01:34 -0000 1.1 --- fonts.py 6 Dec 2006 16:46:22 -0000 1.2 *************** *** 5,9 **** 26-sep-2006 [als] created """ - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 5,8 ---- |
From: alexander s. <a1...@us...> - 2006-12-06 16:40:46
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv999 Modified Files: drivers.py Log Message: sweep pylint warnings Index: drivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/drivers.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** drivers.py 4 Nov 2006 14:24:01 -0000 1.5 --- drivers.py 6 Dec 2006 16:40:34 -0000 1.6 *************** *** 6,9 **** --- 6,10 ---- """ """History (most recent first): + 05-dec-2006 [als] sweep pylint warnings 04-nov-2006 [als] added text driver backend "Tk"; have different backend lists for texts and images *************** *** 15,19 **** 05-oct-2006 [als] created """ - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 16,19 ---- *************** *** 32,40 **** _text_drivers = {} ! def get_driver(type, backend=None): """Return a rendering driver Parameters: ! type: "Text" or "Image" backend: optional name of preferred backend, like "PIL" or "wx". If omitted or None, --- 32,40 ---- _text_drivers = {} ! def get_driver(driver_type, backend=None): """Return a rendering driver Parameters: ! driver_type: "Text" or "Image" backend: optional name of preferred backend, like "PIL" or "wx". If omitted or None, *************** *** 42,55 **** """ ! if type == "Text": _drivers = _text_drivers ! elif type == "Image": _drivers = _image_drivers else: ! raise ValueError("Invalid driver type: %r" % type) # if this is the first call for selected driver type, # load all available drivers if not _drivers: ! if type == "Image": # Use ImageDriver class from this module as dummy fallback driver # (will be overwritten as soon as any actual driver is found). --- 42,55 ---- """ ! if driver_type == "Text": _drivers = _text_drivers ! elif driver_type == "Image": _drivers = _image_drivers else: ! raise ValueError("Invalid driver type: %r" % driver_type) # if this is the first call for selected driver type, # load all available drivers if not _drivers: ! if driver_type == "Image": # Use ImageDriver class from this module as dummy fallback driver # (will be overwritten as soon as any actual driver is found). *************** *** 71,76 **** _vars = {} try: exec("from PythonReports.%sDrivers import %sDriver as Driver" ! % (_backend, type), _vars) except ImportError: continue --- 71,78 ---- _vars = {} try: + # pylint: disable-msg=W0122 + # W0122: Use of the exec statement exec("from PythonReports.%sDrivers import %sDriver as Driver" ! % (_backend, driver_type), _vars) except ImportError: continue *************** *** 79,83 **** _drivers[_backend] = _driver if _driver is None: ! raise RuntimeError("No %s driver found" % type) # last loaded driver is used by default _drivers[None] = _driver --- 81,85 ---- _drivers[_backend] = _driver if _driver is None: ! raise RuntimeError("No %s driver found" % driver_type) # last loaded driver is used by default _drivers[None] = _driver *************** *** 105,109 **** filepath = None # set when loaded from disk file name = None # name of data block ! type = None # image type, e.g. "jpeg" or "png" use_count = 0 # number of references to this source, set/read by builder --- 107,111 ---- filepath = None # set when loaded from disk file name = None # name of data block ! img_type = None # image type, e.g. "jpeg" or "png" use_count = 0 # number of references to this source, set/read by builder *************** *** 116,120 **** """ ! if self.type.lower() in ("jpeg", "jpg"): return "jpeg" else: --- 118,122 ---- """ ! if self.img_type.lower() in ("jpeg", "jpg"): return "jpeg" else: *************** *** 122,131 **** @classmethod ! def fromfile(cls, filepath, type): """Create an image source from existing file Parameters: filepath: full path to the image file ! type: image type, e.g. "jpeg" or "png" Return value: new image wrapper object. --- 124,133 ---- @classmethod ! def fromfile(cls, filepath, img_type): """Create an image source from existing file Parameters: filepath: full path to the image file ! img_type: image type, e.g. "jpeg" or "png" Return value: new image wrapper object. *************** *** 135,144 **** @classmethod ! def fromdata(cls, data, type, name=None): """Create an image source from data block Parameters: data: image data ! type: image type, e.g. "jpeg" or "png" name: optional name of a report block containing data --- 137,146 ---- @classmethod ! def fromdata(cls, data, img_type, name=None): """Create an image source from data block Parameters: data: image data ! img_type: image type, e.g. "jpeg" or "png" name: optional name of a report block containing data *************** *** 161,169 **** raise NotImplementedError ! def getdata(self, type=None): """Return image data as string Parameters: ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 163,171 ---- raise NotImplementedError ! def getdata(self, img_type=None): """Return image data as string Parameters: ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 173,177 **** raise NotImplementedError ! def scale(self, width, height, type=None): """Return a scaled image --- 175,179 ---- raise NotImplementedError ! def scale(self, width, height, img_type=None): """Return a scaled image *************** *** 179,183 **** width: target image width height: target image height ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 181,185 ---- width: target image width height: target image height ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 187,191 **** raise NotImplementedError ! def _cut(self, width, height, type): """Return an image cut to dimensions --- 189,193 ---- raise NotImplementedError ! def _cut(self, width, height, img_type): """Return an image cut to dimensions *************** *** 193,197 **** width: target image width height: target image height ! type: image type, e.g. "jpeg" or "gif" Return value: image data as string. --- 195,199 ---- width: target image width height: target image height ! img_type: image type, e.g. "jpeg" or "gif" Return value: image data as string. *************** *** 205,209 **** raise NotImplementedError ! def cut(self, width, height, type=None): """Return an image cut to dimensions --- 207,211 ---- raise NotImplementedError ! def cut(self, width, height, img_type=None): """Return an image cut to dimensions *************** *** 211,215 **** width: target image width height: target image height ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 213,217 ---- width: target image width height: target image height ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 224,233 **** """ ! if not type: ! type = self.preferred_type ! (_my_width, _my_height) = self._image.size ! return self._cut(min(width, _my_width), min(height, _my_height), type) ! def resize(self, width, height, scale=False, type=None): """Return resized image --- 226,238 ---- """ ! if not img_type: ! # pylint: disable-msg=C0103 ! # C0103: Invalid name "img_type" ! img_type = self.preferred_type ! (_my_width, _my_height) = self.getsize() ! return self._cut(min(width, _my_width), min(height, _my_height), ! img_type) ! def resize(self, width, height, scale=False, img_type=None): """Return resized image *************** *** 237,241 **** scale: if False (default), the image is cut to given size. If True, the image is scaled to the size. ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 242,246 ---- scale: if False (default), the image is cut to given size. If True, the image is scaled to the size. ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 244,249 **** """ ! if not type: ! type = self.preferred_type (_my_width, _my_height) = self.getsize() if (width == _my_width) and (height == _my_height): --- 249,256 ---- """ ! if not img_type: ! # pylint: disable-msg=C0103 ! # C0103: Invalid name "img_type" ! img_type = self.preferred_type (_my_width, _my_height) = self.getsize() if (width == _my_width) and (height == _my_height): *************** *** 252,258 **** elif scale: # may adjust to any size ! _rv = self.scale(width, height, type=type) ! elif (width > _my_width) or (heigth > _my_height): ! _rv = self.cut(width, height, type=type) else: # should cut, but the image is smaller than cut frame --- 259,265 ---- elif scale: # may adjust to any size ! _rv = self.scale(width, height, img_type=img_type) ! elif (width > _my_width) or (height > _my_height): ! _rv = self.cut(width, height, img_type=img_type) else: # should cut, but the image is smaller than cut frame *************** *** 281,284 **** --- 288,293 ---- """ + # pylint: disable-msg=W0613 + # W0613: Unused argument 'font' super(TextDriver, self).__init__() *************** *** 351,360 **** Return value: 2-element tuple (width, height). Returned width is less than or equal to passed width. ! Returned height may by less than or greater than passed height. """ if width > 0: ! text = self.wrap(text, width) ! return self.getsize(text) # vim: set et sts=4 sw=4 : --- 360,372 ---- Return value: 2-element tuple (width, height). Returned width is less than or equal to passed width. ! Returned height may be less than or greater than passed height. """ + # pylint: disable-msg=W0613 + # W0613: Unused argument 'height' if width > 0: ! return self.getsize(self.wrap(text, width)) ! else: ! return self.getsize(text) # vim: set et sts=4 sw=4 : |
From: alexander s. <a1...@us...> - 2006-12-06 16:35:26
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31541 Modified Files: design.py Log Message: fix errors and some warnings reported by pylint Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** design.py 7 Nov 2006 13:32:02 -0000 1.11 --- design.py 6 Dec 2006 16:35:20 -0000 1.12 *************** *** 1,6 **** #! /usr/bin/env python """PythonReports Template Designer""" - """History (most recent first): 07-Nov-2006 [phd] Added shebang. 04-nov-2006 [als] added About dialog --- 1,9 ---- #! /usr/bin/env python + # pylint: disable-msg=R0901,R0904 + # R0901: Too many ancestors in all classes derived from Tix widgets + # R0904: ditto, Too many public methods """PythonReports Template Designer""" """History (most recent first): + 05-dec-2006 [als] fix errors and some warnings reported by pylint 07-Nov-2006 [phd] Added shebang. 04-nov-2006 [als] added About dialog *************** *** 90,93 **** --- 93,99 ---- # since we're not interactive, sys does not have ps1 and ps2 try: + # pylint: disable-msg=E1101,W0104 + # E1101: Module 'sys' has no 'ps1' member - that's what we're trying here + # W0104: Statement seems to have no effect sys.ps1 except AttributeError: *************** *** 97,103 **** --- 103,113 ---- class Interpreter(InteractiveInterpreter): + """Python interpreter shell substituting standard streams for code run""" + def __init__(self, locals, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr ): + # pylint: disable-msg=W0622 + # W0622: Redefining built-in 'locals' - the name comes from base class InteractiveInterpreter.__init__(self, locals) self.stdin = stdin *************** *** 106,109 **** --- 116,120 ---- def runcode(self, code): + """Execute a code object""" # save current standard streams _stdin = sys.stdin *************** *** 146,152 **** --- 157,165 ---- @staticmethod def isatty(): + """Return True: the file is connected to a tty-like device""" return True def write(self, text): + """Output a text to the window""" self.window.insert("end", text, self.tag) # window must be refreshed in case we fall into raw_input somewhere *************** *** 155,158 **** --- 168,172 ---- def writelines(self, iterable): + """Write a sequence of strings to the window""" _write = self.write for _line in iterable: *************** *** 163,176 **** --- 177,201 ---- """Interactive shell widget""" + # pylint: disable-msg=E0102 + # E0102: redefinition of the Shell class imported from Tix + @property def shell_greeting(self): + """Interpreter greeting text""" return self._("Python %s on %s\n") % (sys.version, sys.platform) @property def greeting(self): + """PythonReports greeting text""" return self._( "Set \"data\" variable to report data sequence for preview.\n") def __init__(self, master=None, cnf={}, **kw): + # pylint: disable-msg=W0102,W0231,W0233 + # W0102: Dangerous default value {} as argument - that's Tk + # W0231: __init__ method from base class 'ScrolledText' is not called + # W0233: __init__ method from a non direct base class 'ScrolledText' + # is called + # perhaps pylint got confused by Tk/Tix widget hierarchy? ScrolledText.__init__(self, master, cnf=cnf, **kw) _toplevel = self.winfo_toplevel() *************** *** 200,203 **** --- 225,229 ---- def OnKeyPress(self, event): + """Handle window keypress events""" # don't process control and navigation keys if event.char == "": *************** *** 229,236 **** def prompt(self, prompt=sys.ps1): """Write new input prompt""" self.mark_set("insert", "end") if self.compare("insert", "!=", "insert linestart"): self.insert("insert", "\n") ! self.insert("insert", sys.ps1, "prompt") self.see("end") --- 255,264 ---- def prompt(self, prompt=sys.ps1): """Write new input prompt""" + # pylint: disable-msg=E1101 + # E1101: Module 'sys' has no 'ps1' member - assigned at toplevel if so self.mark_set("insert", "end") if self.compare("insert", "!=", "insert linestart"): self.insert("insert", "\n") ! self.insert("insert", prompt, "prompt") self.see("end") *************** *** 246,249 **** --- 274,279 ---- """ + # pylint: disable-msg=E1101 + # E1101: Module 'sys' has no 'ps1' member - assigned at toplevel if so if "input" in self.tag_names(index + " lineend -1c"): # the line contains input area *************** *** 295,299 **** --- 325,333 ---- class CodeSelection(ComboBox): + """Code value selection""" + def __init__(self, master=None, cnf={}, **kw): + # pylint: disable-msg=W0102 + # W0102: Dangerous default value {} as argument - that's Tk self.values = kw.pop("values", ()) ComboBox.__init__(self, master=master, cnf=cnf, **kw) *************** *** 313,317 **** --- 347,354 ---- class ColorSelection(Frame): + """Color value selection""" + def __init__(self, master=None, cnf={}, **kw): + # pylint: disable-msg=W0102 self.var = kw.pop("variable") Frame.__init__(self, master=master, cnf=cnf, **kw) *************** *** 329,335 **** --- 366,374 ---- def updateColor(self, value=NOTHING): """Validate the combo box value; update color indicator""" + _rv = value if value is NOTHING: _color = Color.fromValue(self.var.get()) else: + # got an entered value - must return validated string try: _color = Color.fromValue(value) *************** *** 337,342 **** self.bell() # validation will return current value ! value = self.var.get() ! _color = Color.fromValue(value) else: self.var.set(value) --- 376,381 ---- self.bell() # validation will return current value ! _rv = self.var.get() ! _color = Color.fromValue(_rv) else: self.var.set(value) *************** *** 346,352 **** else: self.indicator.grid_forget() ! return value def OnButton(self): # askcolor returns ((r, g, b), "#rrggbb") or (None, None) _color = askcolor(Color.fromValue(self.var.get()))[1] --- 385,392 ---- else: self.indicator.grid_forget() ! return _rv def OnButton(self): + """Run standard color selection dialog""" # askcolor returns ((r, g, b), "#rrggbb") or (None, None) _color = askcolor(Color.fromValue(self.var.get()))[1] *************** *** 357,360 **** --- 397,402 ---- class PropertyEntry(Frame): + """Generic value entry box""" + # Entry member of the ComboBox is offset to the right. # We need to compensate all other widgets too. *************** *** 372,375 **** --- 414,418 ---- def __init__(self, master=None, cnf={}, **kw): + # pylint: disable-msg=W0102 Frame.__init__(self, master) Frame(self, width=self.LPAD).pack(side=LEFT) *************** *** 381,384 **** --- 424,428 ---- def OnSetFocus(self, event): + """Automatically pass the focus to the inner widget""" self.widget.focus_set() self.widget.select_range(0, "end") *************** *** 386,389 **** --- 430,435 ---- class IntegerSelection(PropertyEntry): + """Spinner box for integer value entry""" + WIDGET = Control DEFAULT_OPTIONS = (("step", 1),) *************** *** 395,398 **** --- 441,445 ---- def OnSetFocus(self, event): + """Pass the focus to the entry widget""" _entry = self.widget.entry _entry.focus_set() *************** *** 401,404 **** --- 448,453 ---- class BooleanSelection(PropertyEntry): + """Checkbox for boolean value entry""" + WIDGET = Checkbutton DEFAULT_OPTIONS = ( *************** *** 413,416 **** --- 462,466 ---- def __init__(self, master=None, cnf={}, **kw): + # pylint: disable-msg=W0102 PropertyEntry.__init__(self, master, cnf, **kw) # XXX on windows, these checkbuttons get white background *************** *** 419,422 **** --- 469,473 ---- # checkbuttons have no .select_range method def OnSetFocus(self, event): + """Pass the focus to the checkbutton""" self.widget.focus_set() *************** *** 424,427 **** --- 475,480 ---- """Widget factory for an attribute data type""" + # pylint: disable-msg=R0903 + # R0903: Too few public methods # instantiated factories *************** *** 482,485 **** --- 535,540 ---- """Data object representing an attribute editable in the properties list""" + # pylint: disable-msg=R0903 + # R0903: Too few public methods class TreeNodeData(list): *************** *** 551,556 **** self.tag = element.tag if nodeid is None: ! nodeid = "%s@%X" % (self.tag, id(self)) ! self.id = nodeid self.parent = parent self.canvas_object = None --- 606,612 ---- self.tag = element.tag if nodeid is None: ! self.id = "%s@%X" % (self.tag, id(self)) ! else: ! self.id = nodeid self.parent = parent self.canvas_object = None *************** *** 708,711 **** --- 764,768 ---- def __init__(self, master=None, cnf={}, **kw): + # pylint: disable-msg=W0102 for (_option, _default) in self.DEFAULTS: kw.setdefault(_option, _default) *************** *** 714,717 **** --- 771,775 ---- def OnClick(self, event): + """Run URL handler program on the URL""" _url = self["text"] if _url: *************** *** 858,862 **** fill=X) # File menu ! _popup = self._build_menu_item(_menu, ''"_File", type="cascade") self._build_menu_item(_popup, ''"_New", command=self.OnMenuFileNew) self._build_menu_item(_popup, ''"_Open", command=self.OnMenuFileOpen) --- 916,920 ---- fill=X) # File menu ! _popup = self._build_menu_item(_menu, ''"_File", item_type="cascade") self._build_menu_item(_popup, ''"_New", command=self.OnMenuFileNew) self._build_menu_item(_popup, ''"_Open", command=self.OnMenuFileOpen) *************** *** 868,879 **** self._build_menu_item(_popup, ''"E_xit", command=self.OnMenuQuit) # Edit menu ! _popup = self._build_menu_item(_menu, ''"_Edit", type="cascade") self._build_menu_item(_popup, ''"Cu_t", event="<<Cut>>") self._build_menu_item(_popup, ''"_Copy", event="<<Copy>>") self._build_menu_item(_popup, ''"_Paste", event="<<Paste>>") # Report menu ! _popup = self._build_menu_item(_menu, ''"_Report", type="cascade") self.report_menu = _popup ! self._build_menu_item(_popup, ''"_Insert...", type="cascade", menu="") self._build_menu_item(_popup, ''"_Delete element", command=lambda: self.deleteNode(self.current_node)) --- 926,938 ---- self._build_menu_item(_popup, ''"E_xit", command=self.OnMenuQuit) # Edit menu ! _popup = self._build_menu_item(_menu, ''"_Edit", item_type="cascade") self._build_menu_item(_popup, ''"Cu_t", event="<<Cut>>") self._build_menu_item(_popup, ''"_Copy", event="<<Copy>>") self._build_menu_item(_popup, ''"_Paste", event="<<Paste>>") # Report menu ! _popup = self._build_menu_item(_menu, ''"_Report", item_type="cascade") self.report_menu = _popup ! self._build_menu_item(_popup, ''"_Insert...", item_type="cascade", ! menu="") self._build_menu_item(_popup, ''"_Delete element", command=lambda: self.deleteNode(self.current_node)) *************** *** 884,888 **** self._build_menu_item(_popup, ''"Print Pre_view", command=self.preview) # Help menu ! _popup = self._build_menu_item(_menu, ''"_Help", type="cascade") self._build_menu_item(_popup, ''"_About...", command=self.OnMenuAbout) # set window menu to created tree --- 943,947 ---- self._build_menu_item(_popup, ''"Print Pre_view", command=self.preview) # Help menu ! _popup = self._build_menu_item(_menu, ''"_Help", item_type="cascade") self._build_menu_item(_popup, ''"_About...", command=self.OnMenuAbout) # set window menu to created tree *************** *** 921,924 **** --- 980,987 ---- else: _underline = -1 + # pylint: disable-msg=W0631 + # W0631: Using possibly undefined loop variable _underline + # if the loop is empty, the variable is initialized + # in the else clause. self._build_menu_item(_menu, _child.tag, underline=_underline, command=lambda tag=_child.tag: self.insertNode(tag)) *************** *** 934,938 **** return (_underline, _text) ! def _build_menu_item(self, parent, label, type="command", event=None, **options ): --- 997,1001 ---- return (_underline, _text) ! def _build_menu_item(self, parent, label, item_type="command", event=None, **options ): *************** *** 946,950 **** one underscore character, second and following underscores are displayed. ! type: item type - "command", "cascade" etc. Default: "command". event: optional name of virtual event to post --- 1009,1013 ---- one underscore character, second and following underscores are displayed. ! item_type: item type - "command", "cascade" etc. Default: "command". event: optional name of virtual event to post *************** *** 953,957 **** additional keyword arguments will be passed right to Tk. ! If type is "cascade", return associated submenu widget. Otherwise return None. --- 1016,1020 ---- additional keyword arguments will be passed right to Tk. ! If item_type is "cascade", return associated submenu widget. Otherwise return None. *************** *** 963,970 **** options["command"] = lambda evt=event: self._post_event(evt) try: ! _make = getattr(parent, "add_" + type) except AttributeError: ! raise ValueError("Unsupported menu object type: %s" % type) ! if type == "cascade": # create submenu unless passed in options if "menu" not in options: --- 1026,1033 ---- options["command"] = lambda evt=event: self._post_event(evt) try: ! _make = getattr(parent, "add_" + item_type) except AttributeError: ! raise ValueError("Unsupported menu object type: %s" % item_type) ! if item_type == "cascade": # create submenu unless passed in options if "menu" not in options: *************** *** 1151,1154 **** --- 1214,1218 ---- @staticmethod def gettext(msg): + """Return msg translated to selected language""" return msg *************** *** 1157,1160 **** --- 1221,1227 ---- @staticmethod def ngettext(singular, plural, n): + """Translate a message with plural forms lookup""" + # pylint: disable-msg=C0103 + # C0103: Invalid name "n" - I quite agree. if n == 1: return singular *************** *** 1245,1249 **** for (_child, _restrict) in validator.children: if _restrict in (validator.ONE, validator.ONE_OR_MORE): ! _create_template_element(_element, _child) return _element --- 1312,1319 ---- for (_child, _restrict) in validator.children: if _restrict in (validator.ONE, validator.ONE_OR_MORE): ! # pylint: disable-msg=W0212 ! # W0212: Access to a protected member _create_template_element ! # of a client class - it's not a client, it's this own class. ! Designer._create_template_element(_element, _child) return _element *************** *** 1269,1272 **** --- 1339,1344 ---- # and "before" position may shift up or down. # force append to the end of list. + # pylint: disable-msg=C0103 + # C0103: Invalid name "before" before = sys.maxint # find contained group or detail element - *************** *** 1303,1307 **** self.tree.open(_node.path) if before < (len(_node) - 1): ! _child.addToTree(self.tree, before=_node[_before + 1].path) else: _child.addToTree(self.tree) --- 1375,1379 ---- self.tree.open(_node.path) if before < (len(_node) - 1): ! _child.addToTree(self.tree, before=_node[before + 1].path) else: _child.addToTree(self.tree) *************** *** 1328,1331 **** --- 1400,1405 ---- def loadFile(self, filename): """Load report file""" + # pylint: disable-msg=W0703 + # W0703: Catch "Exception" - yep, that's what we do here try: self.report = prt.load(filename) *************** *** 1368,1371 **** --- 1442,1447 ---- return False if not filename: + # pylint: disable-msg=C0103 + # C0103: Invalid name "filename" filename = tkFileDialog.asksaveasfilename(**self.fileoptions) if not filename: *************** *** 1393,1397 **** self.data.updateProperties(recursive=True, errors=errors) except AttributeConversionError, _err: ! self.select(_err_path) self.update_idletasks() Message(self, icon="error", type="ok", --- 1469,1473 ---- self.data.updateProperties(recursive=True, errors=errors) except AttributeConversionError, _err: ! self.select(_err.path) self.update_idletasks() Message(self, icon="error", type="ok", *************** *** 1463,1471 **** @staticmethod def _validate(tree, validator): ! # run Template/Printout validator on an ElementTree _root = tree.getroot() validator(tree, _root, "/" + _root.tag) def _run_preview(self): if not self.updateTree(): return --- 1539,1548 ---- @staticmethod def _validate(tree, validator): ! """Run Template/Printout validator on an ElementTree""" _root = tree.getroot() validator(tree, _root, "/" + _root.tag) def _run_preview(self): + """Build and show the report""" if not self.updateTree(): return *************** *** 1525,1528 **** --- 1602,1607 ---- def preview(self): """Show Report Preview for current template""" + # pylint: disable-msg=W0703 + # W0703: Catch "Exception" - yep, that's what we do here _focus = self.focus_get() or self.tree.hlist try: *************** *** 1541,1544 **** --- 1620,1624 ---- def run(argv=sys.argv): + """Command line executable""" if len(argv) > 2: print "Usage: %s [template]" % argv[0] |
From: alexander s. <a1...@us...> - 2006-12-06 16:22:55
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26769 Modified Files: datatypes.py Log Message: sweep pylint warnings Index: datatypes.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/datatypes.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** datatypes.py 3 Nov 2006 11:51:17 -0000 1.2 --- datatypes.py 6 Dec 2006 16:22:48 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- """Data types and element primitives, common for templates and printouts""" """History: + 05-dec-2006 [als] sweep pylint warnings 03-nov-2006 [als] ElementTree: string conversion returns full XML text 20-oct-2006 [als] added Structure *************** *** 27,34 **** 30-jun-2006 [als] created """ import binascii import bz2 - import codecs import cPickle as pickle import sys --- 28,36 ---- 30-jun-2006 [als] created """ + __version__ = "$Revision$"[11:-2] + __date__ = "$Date$"[7:-2] import binascii import bz2 import cPickle as pickle import sys *************** *** 50,60 **** import elementtree.ElementTree as ET except ImportError: # last resort; should always success in python2.5 and newer import xml.etree.ElementTree as ET - - __version__ = "$Revision$"[11:-2] - __date__ = "$Date$"[7:-2] - # export element factories from ElementTree Element = ET.Element --- 52,61 ---- import elementtree.ElementTree as ET except ImportError: + # pylint: disable-msg=E0611 + # E0611: No name 'etree' in module 'xml' - true for python <2.5 + # ... pylint still reports this error # last resort; should always success in python2.5 and newer import xml.etree.ElementTree as ET # export element factories from ElementTree Element = ET.Element *************** *** 221,227 **** element=element, path=path) ! # special value used instead of default in attribute declarations ! # to indicate that the attribute is required. ! class REQUIRED(object): pass # XXX should NOTHING be different from REQUIRED? REQUIRED = NOTHING = REQUIRED() --- 222,237 ---- element=element, path=path) ! class REQUIRED(object): ! ! """"Value is required" value ! ! The singleton instance of this class is a special value ! used instead of default in attribute declarations ! to indicate that the attribute is required. ! ! """ ! # pylint: disable-msg=R0903 ! # R0903: Too few public methods ! # XXX should NOTHING be different from REQUIRED? REQUIRED = NOTHING = REQUIRED() *************** *** 239,242 **** --- 249,254 ---- """ + # pylint: disable-msg=R0903 + # R0903: Too few public methods def __init__(self, **kwargs): *************** *** 335,338 **** --- 347,353 ---- class Number(float, _Value): + """Base class for fixed-point numeric classes, also used as integer number + """ + # number of digits in the fractional part PRECISION = 0 *************** *** 359,367 **** --- 374,390 ---- """ + # pylint: disable-msg=W0602 + # W0602: Using global for '_numeric_classes' but no assigment is done global _numeric_classes try: return _numeric_classes[precision] except KeyError: + # pylint: disable-msg=C0111,W0104 + # W0104: Statement seems to have no effect + # C0111: Missing docstring + # The statement has the effect of setting the docstring. + # and the above pylint hint doesn't help anyway. class _Number(Number): + """Fixed point number with %i decimal digits""" % precision PRECISION = precision _numeric_classes[precision] = _Number *************** *** 419,428 **** class _MetaColor(type): ! def __getitem__(self, name): ! return self.names[name.upper()] ! def __getattr__(self, name): try: ! return self.names[name.upper()] except KeyError: raise AttributeError, name --- 442,453 ---- class _MetaColor(type): ! """Implement access to named colors as class attributes or items""" ! def __getitem__(mcs, name): ! return mcs.names[name.upper()] ! ! def __getattr__(mcs, name): try: ! return mcs.names[name.upper()] except KeyError: raise AttributeError, name *************** *** 430,433 **** --- 455,460 ---- class Color(_Value): + """Color value""" + __metaclass__ = _MetaColor *************** *** 540,543 **** --- 567,571 ---- """ + super(Color, self).__init__() self.value = self.encode(color) *************** *** 570,576 **** """String value used in element attributes""" ! def __new__(cls, value, *args, **kwargs): try: ! return unicode.__new__(cls, value, *args, **kwargs) except (TypeError, ValueError): # note: unicode errors are subclasses of ValueError --- 598,607 ---- """String value used in element attributes""" ! # pylint: disable-msg=R0904 ! # R0904: Too many public methods (39) - most come from unicode. ! ! def __new__(cls, value): try: ! return unicode.__new__(cls, value) except (TypeError, ValueError): # note: unicode errors are subclasses of ValueError *************** *** 583,586 **** --- 614,620 ---- class Expression(String): + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class + """Python expressions used in PRT element attributes""" # This is same as String, put to separate class just to make things clearer *************** *** 592,595 **** --- 626,632 ---- """String value from a domain of allowed values""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class + # list of allowed values for this class # must be overridden in subclasses *************** *** 609,612 **** --- 646,651 ---- """Horizontal alignment type""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("left", "center", "right") *************** *** 615,618 **** --- 654,659 ---- """Vertical alignment type""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("top", "center", "bottom") *************** *** 621,624 **** --- 662,667 ---- """Bar Code type""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("Code128", "Code39", "2of5i") *************** *** 627,630 **** --- 670,675 ---- """Bitmap scale type""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("cut", "fill", "grow") *************** *** 633,636 **** --- 678,683 ---- """Bitmap image format""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class # TODO: list all supported image types *************** *** 640,643 **** --- 687,692 ---- """Calculation type for report variables""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("count", "sum", "avg", "min", "max", "std", "var", "first") *************** *** 646,649 **** --- 695,700 ---- """Compression for 'data' elements""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("zlib", "bz2") *************** *** 652,655 **** --- 703,708 ---- """Type of 'eject' elements""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("page", "column") *************** *** 658,661 **** --- 711,716 ---- """Binary value encoding for 'data' elements""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("base64", "uu", "qp") *************** *** 663,666 **** --- 718,725 ---- class PageSize(_Codes): + """Standard paper size names, evaluating to page dimensions""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class + DIMENSIONS = { # ISO216 paper sizes *************** *** 717,720 **** --- 776,781 ---- """ + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("dot", "dash", "dashdot") *************** *** 722,725 **** --- 783,787 ---- @classmethod def fromValue(cls, value): + """Return Dimension or type code or None""" try: return Dimension.fromValue(value) *************** *** 730,733 **** --- 792,797 ---- """Alignment type for text fields""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("left", "center", "right", "justified") *************** *** 736,739 **** --- 800,805 ---- """Iteration/Reset type for report variables""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class VALUES = ("report", "page", "column", "group", "detail") *************** *** 764,767 **** --- 830,836 ---- """ + # pylint: disable-msg=R0903 + # R0903: Too few public methods + def __init__(self, attrname, collection_name=None): """Initialize uniqueness validator *************** *** 777,782 **** if collection_name is None: # e.g. "report groups" for attrname=="groups" ! collection_name = "report %s" % attrname ! self.collection_name = collection_name def __call__(self, tree, element, path): --- 846,852 ---- if collection_name is None: # e.g. "report groups" for attrname=="groups" ! self.collection_name = "report %s" % attrname ! else: ! self.collection_name = collection_name def __call__(self, tree, element, path): *************** *** 832,835 **** --- 902,906 ---- self.attributes = {} self.children = children + # W0612: Unused variable '_restrict' self.child_validators = dict([(_validator.tag, _validator) for (_validator, _restrict) in children]) *************** *** 870,874 **** _value = _cls.fromValue(_attrib[_name]) except: ! (_exc_type, _err, _tb) = sys.exc_info() raise AttributeConversionError(_name, _value, _err, element, path), None, _tb --- 941,945 ---- _value = _cls.fromValue(_attrib[_name]) except: ! (_err, _tb) = sys.exc_info()[1:] raise AttributeConversionError(_name, _value, _err, element, path), None, _tb *************** *** 912,916 **** for (_name, _val) in sorted(element.items()): try: ! (_cls, _default) = self.attributes[_name] except KeyError: # ignore undeclared attributes --- 983,987 ---- for (_name, _val) in sorted(element.items()): try: ! _default = self.attributes[_name][1] except KeyError: # ignore undeclared attributes *************** *** 1033,1059 **** return _elem if attrib.get("pickle"): ! data = pickle.dumps(data, pickle.HIGHEST_PROTOCOL) elif data is None: # don't encode data return _elem _compress = attrib.get("compress") if _compress == "zlib": ! data = zlib.compress(data) elif _compress == "bz2": ! data = bz2.compress(data) _encoding = attrib.get("encoding") if _encoding == "base64": ! data = binascii.b2a_base64(data) ! data = "\n".join([""] + [data[_ii:_ii+76] ! for _ii in xrange(0, len(data), 76)]) elif _encoding == "uu": ! data = "".join(["\n"] + [binascii.b2a_uu(data[_ii:_ii+45]) ! for _ii in xrange(0, len(data), 45)]) elif _encoding == "qp": ! data = "\n" + binascii.b2a_qp(data, True, False) + "\n" else: # encoded data is ASCII. non-encoded must be unicode. ! data = unicode(data) ! _elem.text = data return _elem --- 1104,1133 ---- return _elem if attrib.get("pickle"): ! _data = pickle.dumps(data, pickle.HIGHEST_PROTOCOL) elif data is None: # don't encode data return _elem + else: + # start with plaintext contents + _data = data _compress = attrib.get("compress") if _compress == "zlib": ! _data = zlib.compress(_data) elif _compress == "bz2": ! _data = bz2.compress(_data) _encoding = attrib.get("encoding") if _encoding == "base64": ! _data = binascii.b2a_base64(_data) ! _data = "\n".join([""] + [_data[_ii:_ii+76] ! for _ii in xrange(0, len(_data), 76)]) elif _encoding == "uu": ! _data = "".join(["\n"] + [binascii.b2a_uu(_data[_ii:_ii+45]) ! for _ii in xrange(0, len(_data), 45)]) elif _encoding == "qp": ! _data = "\n" + binascii.b2a_qp(_data, True, False) + "\n" else: # encoded data is ASCII. non-encoded must be unicode. ! _data = unicode(_data) ! _elem.text = _data return _elem *************** *** 1101,1108 **** """ ! # must not add blank spaces to non-encoded values if element.get("encoding"): _indent2 = indent else: _indent2 = "" # there are no children for this element, just text --- 1175,1185 ---- """ ! # pylint: disable-msg=W0613 ! # W0613: Unused argument 'addindent' - API comes from Validator, ! # but there are no child elements in the data element if element.get("encoding"): _indent2 = indent else: + # must not add blank spaces to non-encoded values _indent2 = "" # there are no children for this element, just text *************** *** 1128,1135 **** """ # FIXME: this instantiation seems to be obsolete if isinstance(validator, type): ! validator = validator() ! self.root_validator = validator ET.ElementTree.__init__(self, element=element, file=file) --- 1205,1218 ---- """ + # pylint: disable-msg=W0231,W0622 + # W0231: __init__ method from base class 'ElementTree' is not called + # - ain't it? + # W0622: Redefining built-in 'file' - the name comes from base class + # FIXME: this instantiation seems to be obsolete if isinstance(validator, type): ! self.root_validator = validator() ! else: ! self.root_validator = validator ET.ElementTree.__init__(self, element=element, file=file) *************** *** 1156,1159 **** --- 1239,1245 ---- """ + # pylint: disable-msg=C0103,W0622 + # C0103: Invalid names "file", "encoding" - fancy defaults + # W0622: Redefining built-in 'file' - the name comes from base class assert self._root is not None if not hasattr(file, "write"): *************** *** 1371,1374 **** --- 1457,1462 ---- """ + # pylint: disable-msg=C0103 + # C0103: Invalid name "scale_y" - fancy default if scale_y == None: scale_y = scale_x *************** *** 1384,1391 **** # export constants and all non-private callables and constants __all__ = ["REQUIRED", "NOTHING", "Data", "Font"] + [ ! _name for (_name, _item) in globals().items() ! if callable(_item) and not _name.startswith("_") ] ! del _name, _item # vim: set et sts=4 sw=4 : --- 1472,1479 ---- # export constants and all non-private callables and constants __all__ = ["REQUIRED", "NOTHING", "Data", "Font"] + [ ! _global_name for (_global_name, _global_item) in globals().items() ! if callable(_global_item) and not _global_name.startswith("_") ] ! del _global_name, _global_item # vim: set et sts=4 sw=4 : |
From: alexander s. <a1...@us...> - 2006-12-06 16:13:39
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23499 Modified Files: builder.py Log Message: fix errors and some warnings reported by pylint Index: builder.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/builder.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** builder.py 4 Nov 2006 14:53:17 -0000 1.3 --- builder.py 6 Dec 2006 16:13:37 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- # FIXME: column-based variables are not intelligible """History (most recent first): + 05-dec-2006 [als] fix errors and some warnings reported by pylint 04-nov-2006 [als] Builder: delay text_drivers initialization until run, added backend selection parameters for __init__ *************** *** 57,60 **** --- 58,65 ---- 11-jul-2006 [als] created """ + __version__ = "$Revision$"[11:-2] + __date__ = "$Date$"[7:-2] + + __all__ = ["Builder"] import math *************** *** 67,75 **** from PythonReports.datatypes import * - __version__ = "$Revision$"[11:-2] - __date__ = "$Date$"[7:-2] - - __all__ = ["Builder"] - class Variable(object): --- 72,75 ---- *************** *** 82,105 **** """ # Most variables use builtin list to accumulate values # these helper classes are used in special cases # for uniform accumulation calls ! class AccumulateDistinct(set): def append(self, value): self.add(value) ! class AccumulateFloat(list): def append(self, value): ! super(AccumulateFloat, self).append(float(value)) ! class KeepFirst(list): value = NOTHING def append(self, value): if self.value is NOTHING: self[:] = [value] ! class UseCurrent(list): def append(self, value): self[:] = [value] --- 82,130 ---- """ + # attributes initialized from template element + name = REQUIRED + expr = REQUIRED + init = None + calc = "first" + iter = "detail" + itergrp = None + reset = "report" + resetgrp = None + # Most variables use builtin list to accumulate values # these helper classes are used in special cases # for uniform accumulation calls ! class _Accumulator(object): ! """Base class for value accumulators""" ! # pylint: disable-msg=R0903 ! # R0903: Too few public methods ! def append(self, value): ! """Add a value to the accumulated sequence""" ! ! class AccumulateDistinct(_Accumulator, set): ! """Distinct values accumulator""" def append(self, value): + """Add a value to the accumulated sequence""" self.add(value) ! class AccumulateFloat(_Accumulator, list): ! """Accumulator forcing all values to be float""" def append(self, value): ! """Add a value to the accumulated sequence""" ! super(Variable.AccumulateFloat, self).append(float(value)) ! class KeepFirst(_Accumulator, list): ! """"Accumulator" always keeping the first value of the sequence""" value = NOTHING def append(self, value): + """Add a value to the accumulated sequence""" if self.value is NOTHING: self[:] = [value] ! class UseCurrent(_Accumulator, list): ! """"Accumulator" always returning current value of the sequence""" def append(self, value): + """Add a value to the accumulated sequence""" self[:] = [value] *************** *** 108,141 **** @staticmethod def first(value): return value[0] @staticmethod def count(value): return len(value) @staticmethod def avg(value): return sum(value) / len(value) @staticmethod def min(value): return min(value) @staticmethod def max(value): return max(value) @staticmethod def var(value): ! _avg = avg(value) ! return sum([(_item - _avg) ** 2 for _item in _value]) / len(value) @staticmethod def std(value): ! return math.sqrt(avg(value)) # sum must be defined last to use builtin sum in other calculations @staticmethod def sum(value): if isinstance(value[0], basestring): return "".join(value) --- 133,178 ---- @staticmethod def first(value): + """Return the first element of the value sequence""" return value[0] @staticmethod def count(value): + """Return number of elements in the value sequence""" return len(value) @staticmethod def avg(value): + """Return an average value of a float sequence""" return sum(value) / len(value) @staticmethod def min(value): + """Return minimal value of the value sequence""" return min(value) @staticmethod def max(value): + """Return maximal value of the value sequence""" return max(value) @staticmethod def var(value): ! """Return variance from the average of a float sequence""" ! _avg = Variable.avg(value) ! return sum([(_item - _avg) ** 2 for _item in value]) / len(value) @staticmethod def std(value): ! """Return standard deviation of a float sequence""" ! return math.sqrt(Variable.var(value)) # sum must be defined last to use builtin sum in other calculations @staticmethod def sum(value): + """Return sum of the sequence values + + If values are strings, return concatenated string. + + """ if isinstance(value[0], basestring): return "".join(value) *************** *** 205,208 **** --- 242,246 ---- @property def value(self): + """Variable evaluation result""" if self.values: return self._compute(self.values) *************** *** 292,296 **** # self.sysvars[_name] = _var.value ! def add_variables(self, *vars): """Add report variable definitions --- 330,334 ---- # self.sysvars[_name] = _var.value ! def add_variables(self, *variables): """Add report variable definitions *************** *** 298,302 **** """ ! for _var in vars: self.variables[_var.name] = _var --- 336,340 ---- """ ! for _var in variables: self.variables[_var.name] = _var *************** *** 326,329 **** --- 364,370 ---- """ + # pylint: disable-msg=R0903 + # R0903: Too few public methods + ### attributes: # *************** *** 341,344 **** --- 382,388 ---- # otext: output text, wrapped to box width + # make pylint happy + section = style = printable = tbox = bbox = obox = text = otext = None + class Section(list): *************** *** 391,395 **** self.builder = builder self.template = template ! self.tbox = Box.from_element(template.find("box")) if context: self.build(context) --- 435,440 ---- self.builder = builder self.template = template ! self.box = self.tbox = Box.from_element(template.find("box")) ! self.resizeable = False if context: self.build(context) *************** *** 430,439 **** _printwhen = _style.get("printwhen") if _printwhen: ! _rv = bool(contex.eval(_printwhen)) break self.printable = _rv return _rv ! def compose_style(self, context, need_attrs, styles): """Return style attributes collected from a style sequence --- 475,485 ---- _printwhen = _style.get("printwhen") if _printwhen: ! _rv = bool(context.eval(_printwhen)) break self.printable = _rv return _rv ! @staticmethod ! def compose_style(context, need_attrs, styles): """Return style attributes collected from a style sequence *************** *** 778,782 **** (_prp_type, _prp_attrs) = self.PRINTOUTS[_template.tag] _prp_tag = _prp_type.tag ! _attrib=dict([(_name, _template.get(_name)) for _name in _prp_attrs]) # add style attributes (must be done before constructor is called) --- 824,828 ---- (_prp_type, _prp_attrs) = self.PRINTOUTS[_template.tag] _prp_tag = _prp_type.tag ! _attrib = dict([(_name, _template.get(_name)) for _name in _prp_attrs]) # add style attributes (must be done before constructor is called) *************** *** 862,865 **** --- 908,914 ---- """ + # pylint: disable-msg=R0903 + # R0903: Too few public methods + colcount = 1 # number of columns colgap = 0 # space between columns *************** *** 960,965 **** super(Builder, self).__init__() if isinstance(template, basestring): ! template = prt.load(template) ! self.template = template self.data = data if parameters: --- 1009,1015 ---- super(Builder, self).__init__() if isinstance(template, basestring): ! self.template = prt.load(template) ! else: ! self.template = template self.data = data if parameters: *************** *** 970,981 **** self.text_driver_factory = drivers.get_driver("Text", text_backend) self.image_driver_factory = drivers.get_driver("Image", image_backend) ! self.basedir = template.getroot().get("basedir", None) if not self.basedir: ! if template.filename: ! self.basedir = os.path.dirname(template.filename) else: self.basedir = os.getcwd() self.variables = [Variable(_item) ! for _item in template.variables.itervalues()] # image collections: # - kept in files --- 1020,1033 ---- self.text_driver_factory = drivers.get_driver("Text", text_backend) self.image_driver_factory = drivers.get_driver("Image", image_backend) ! self.basedir = self.template.getroot().get("basedir", None) if not self.basedir: ! if self.template.filename: ! self.basedir = os.path.dirname(self.template.filename) else: self.basedir = os.getcwd() self.variables = [Variable(_item) ! for _item in self.template.variables.itervalues()] ! # text rendering drivers, will be re-evaluated in .run() ! self.text_drivers = {} # image collections: # - kept in files *************** *** 987,991 **** self.images_loaded = {} # ! _layout = template.find("layout") self.template_pagefooter = _layout.find("footer") # list of group templates --- 1039,1043 ---- self.images_loaded = {} # ! _layout = self.template.find("layout") self.template_pagefooter = _layout.find("footer") # list of group templates *************** *** 1052,1056 **** _imgdata = Data.get_data(_imgdata) _image = self.image_driver_factory.fromdata( ! _imgdata, type=_type, name=_name) self.images_named[_name] = _image self.images_loaded[_imgdata] = _image --- 1104,1108 ---- _imgdata = Data.get_data(_imgdata) _image = self.image_driver_factory.fromdata( ! _imgdata, img_type=_type, name=_name) self.images_named[_name] = _image self.images_loaded[_imgdata] = _image *************** *** 1067,1071 **** if _imgdata not in self.images_loaded: _image = self.image_driver_factory.fromdata(_imgdata, ! type=_type) self.images_loaded[_imgdata] = _image return self.images_loaded[_imgdata] --- 1119,1123 ---- if _imgdata not in self.images_loaded: _image = self.image_driver_factory.fromdata(_imgdata, ! img_type=_type) self.images_loaded[_imgdata] = _image return self.images_loaded[_imgdata] *************** *** 1165,1169 **** _colcount = _columns.get("count") _colgap = _columns.get("gap") ! _width=(parent_frame.width - ((_colcount - 1) * _colgap)) / _colcount _frame = parent_frame.make_child(width=_width, colcount=_colcount, colgap=_colgap) --- 1217,1221 ---- _colcount = _columns.get("count") _colgap = _columns.get("gap") ! _width = (parent_frame.width - ((_colcount - 1) * _colgap)) / _colcount _frame = parent_frame.make_child(width=_width, colcount=_colcount, colgap=_colgap) *************** *** 1201,1205 **** # processing takes about 10s # and output generation takes about .4s ! _start_time = time.time() if item_callback: _callback = item_callback --- 1253,1257 ---- # processing takes about 10s # and output generation takes about .4s ! #_start_time = time.time() if item_callback: _callback = item_callback *************** *** 1277,1281 **** if _name not in _parameters: _value = _context.eval(_parm.get("default")) ! if _item_prompt: # TODO? parameter input with wx or Tkinter GUI _input = raw_input("%s [%s]: " % (_name, _value)) --- 1329,1333 ---- if _name not in _parameters: _value = _context.eval(_parm.get("default")) ! if _parm.prompt: # TODO? parameter input with wx or Tkinter GUI _input = raw_input("%s [%s]: " % (_name, _value)) *************** *** 1522,1529 **** return None if context is None: ! context = self.context _frame = self.section_frames[template] ! context["COLUMN_NUMBER"] = _frame.column + 1 ! _section = Section(self, template, context) if not _section.printable: return None --- 1574,1583 ---- return None if context is None: ! _context = self.context ! else: ! _context = context _frame = self.section_frames[template] ! _context["COLUMN_NUMBER"] = _frame.column + 1 ! _section = Section(self, template, _context) if not _section.printable: return None *************** *** 1535,1540 **** and (_section.template.tag != "footer"): self.eject(_frame) ! context["COLUMN_NUMBER"] = _frame.column + 1 ! _section.build(context) if not _section.printable: return None --- 1589,1594 ---- and (_section.template.tag != "footer"): self.eject(_frame) ! _context["COLUMN_NUMBER"] = _frame.column + 1 ! _section.build(_context) if not _section.printable: return None |
From: alexander s. <a1...@us...> - 2006-12-06 15:59:20
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18013 Modified Files: pylintrc Log Message: lines must never be longer than 79 characters Index: pylintrc =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/pylintrc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pylintrc 6 Dec 2006 15:46:26 -0000 1.1 --- pylintrc 6 Dec 2006 15:59:14 -0000 1.2 *************** *** 306,310 **** # Maximum number of characters on a single line. ! max-line-length=80 # Maximum number of lines in a module --- 306,310 ---- # Maximum number of characters on a single line. ! max-line-length=79 # Maximum number of lines in a module |
From: alexander s. <a1...@us...> - 2006-12-06 15:49:59
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14324 Modified Files: barcode.py Log Message: sweep pylint warnings Index: barcode.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/barcode.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** barcode.py 7 Nov 2006 13:16:42 -0000 1.2 --- barcode.py 6 Dec 2006 15:49:57 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- """BarCode routines""" """History: + 05-dec-2006 [als] sweep pylint warnings 07-nov-2006 [als] fix doctests (no quet zones encoded) 22-sep-2006 [als] encoding calls return sequences w/o quiet zones; *************** *** 6,10 **** 12-sep-2006 [als] created """ - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 7,10 ---- *************** *** 21,24 **** --- 21,26 ---- class InvalidLiteral(ValueError): + """Error raised when a character cannot be encoded""" + def __init__(self, text, barcode): ValueError.__init__(self, text, barcode) *************** *** 200,203 **** --- 202,206 ---- """ + super(Code2of5i, self).__init__() if w2n is None: self.w2n = self.W2N *************** *** 222,232 **** def __call__(self, text, errors="stict"): # ensure that the text contains only digits ! text = self._clean(text, errors) # pad with zero if necessary ! if len(text) & 1: ! text = "0" + text # encode text _seq = [] ! for _pair in zip(text[::2], text[1::2]): _seq.extend(itertools.chain( *zip(*[self.PATTERNS[int(_digit)] for _digit in _pair]))) --- 225,235 ---- def __call__(self, text, errors="stict"): # ensure that the text contains only digits ! _text = self._clean(text, errors) # pad with zero if necessary ! if len(_text) & 1: ! _text = "0" + _text # encode text _seq = [] ! for _pair in zip(_text[::2], _text[1::2]): _seq.extend(itertools.chain( *zip(*[self.PATTERNS[int(_digit)] for _digit in _pair]))) *************** *** 238,245 **** def check_digit(self, text, errors="strict"): ! text = self._clean(text, errors) ! _odd = (len(text) & 1) ! _sum = sum([(int(_digit) * 3) for _digit in text[1-_odd::2]]) \ ! + sum([int(_digit) for _digit in text[_odd::2]]) return str(10 -(_sum %10))[-1] --- 241,249 ---- def check_digit(self, text, errors="strict"): ! """Return the check character for given code text""" ! _text = self._clean(text, errors) ! _odd = (len(_text) & 1) ! _sum = sum([(int(_digit) * 3) for _digit in _text[1-_odd::2]]) \ ! + sum([int(_digit) for _digit in _text[_odd::2]]) return str(10 -(_sum %10))[-1] *************** *** 278,282 **** """ ! CHARS ="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" # default wide-to-narrow multiple --- 282,286 ---- """ ! CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" # default wide-to-narrow multiple *************** *** 353,356 **** --- 357,361 ---- """ + super(Code39, self).__init__() if w2n is None: self.w2n = self.W2N *************** *** 392,395 **** --- 397,401 ---- def check_digit(self, text, errors="strict"): + """Return the check character for given code text""" _sum = sum(self._encode_chars(text, errors)) return self.CHARS[_sum % 43] *************** *** 448,451 **** --- 454,461 ---- # 4. Code C, switch to Code A + # pylint: disable-msg=W0223 + # W0223: Method 'check_digit' is abstract in class 'BarCode' + # but is not overridden - that's intentional (see docstring) + CHARS_A =" !\"#$%&\'()*+,-./0123456789:;<=>?@" \ "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" \ *************** *** 455,459 **** CHARS_B =" !\"#$%&\'()*+,-./0123456789:;<=>?@" \ "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" \ ! "`abcdefghijklmnopqrstuvwxyz{|}~\177"; CHARS_C ="0123456789" # not used --- 465,469 ---- CHARS_B =" !\"#$%&\'()*+,-./0123456789:;<=>?@" \ "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" \ ! "`abcdefghijklmnopqrstuvwxyz{|}~\177" CHARS_C ="0123456789" # not used *************** *** 516,520 **** return text ! def _encode_ab(self, text, chars): """Encode text with character set A or B""" _rv = [] --- 526,531 ---- return text ! @staticmethod ! def _encode_ab(text, chars): """Encode text with character set A or B""" _rv = [] *************** *** 597,600 **** --- 608,612 ---- def _test(): + """Run doctests""" import doctest # textwrap is used in tests to wrap output |
From: alexander s. <a1...@us...> - 2006-12-06 15:48:07
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13758 Modified Files: MANIFEST.in Log Message: source distribution includes pylintrc Index: MANIFEST.in =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/MANIFEST.in,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MANIFEST.in 3 Nov 2006 19:45:57 -0000 1.2 --- MANIFEST.in 6 Dec 2006 15:48:05 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- include README LICENSE CHANGES + include pylintrc include PythonReports/*.py include scripts/prd scripts/*.bat |
From: alexander s. <a1...@us...> - 2006-12-06 15:46:37
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13199 Added Files: pylintrc Log Message: configuration for pylint code checker --- NEW FILE: pylintrc --- # lint Python modules using external checkers. # # $Id: pylintrc,v 1.1 2006/12/06 15:46:26 a1s Exp $ # # History (most recent first): # 05-dec-2006 [als] created # ====================================================================== # # This is the main checker controling the other ones and the reports # generation. It is itself both a raw checker and an astng checker # in order to: # * handle message activation / deactivation at the module level # * handle some basic but necessary stats'data (number of classes, methods...) # [MASTER] # Specify a configuration file. #rcfile= # Profiled execution. profile=no # Add <file or directory> to the black list. It should be a base name, not a # path. You may set this option multiple times. ignore=CVS # Pickle collected data for later comparisons. persistent=yes # Set the cache size for astng objects. cache-size=500 # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. load-plugins= [MESSAGES CONTROL] # Enable only checker(s) with the given id(s). This option conflict with the # disable-checker option #enable-checker= # Enable all checker(s) except those with the given id(s). This option conflict # with the disable-checker option #disable-checker= # Enable all messages in the listed categories. #enable-msg-cat= # Disable all messages in the listed categories. #disable-msg-cat= # Enable the message(s) with the given id(s). #enable-msg= # Disable the message(s) with the given id(s). # PythonReports disable: # - local override info (I0011, I0012) # - string statement has no effect (W0105): revision history strings # are semi-separated from module docstrings and look like string # statements. The separation prevents putting histories into # compiled module docstrings while documentation utilities # join docstrings with histories. # - */** arguments magic (W0142) # - wildcard imports (W0401) - convenient for datatypes and Tk/Tix widgets disable-msg=I0011,I0012,W0105,W0142,W0401 [REPORTS] # set the output format. Available formats are text, parseable, colorized and # html output-format=text # Include message's id in output include-ids=no # Put messages in a separate file for each module / package specified on the # command line instead of printing them on stdout. Reports (if any) will be # written in a file name "pylint_global.[txt|html]". files-output=no # Tells wether to display a full report or only the messages reports=yes # Python expression which should return a note less than 10 (10 is the highest # note).You have access to the variables errors warning, statement which # respectivly contain the number of errors / warnings messages and the total # number of statements analyzed. This is used by the global evaluation report # (R0004). evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) # Add a comment according to your evaluation note. This is used by the global # evaluation report (R0004). comment=no # Enable the report(s) with the given id(s). #enable-report= # Disable the report(s) with the given id(s). #disable-report= # checks for : # * doc strings # * modules / classes / functions / methods / arguments / variables name # * number of arguments, local variables, branchs, returns and statements in # functions, methods # * required module attributes # * dangerous default values as arguments # * redefinition of function / method / class # * uses of the global statement # [BASIC] # Required attributes for module, separated by a comma required-attributes= # Regular expression which should only match functions or classes name which do # not require a docstring no-docstring-rgx=__.*__ # Regular expression which should only match correct module names module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ # Regular expression which should only match correct module level names # Default: const-rgx=(([A-Z_][A-Z1-9_]*)|(__.*__))$ # PythonReports: there happen to be module-private singletons, # using variable-like (rather than constant-like) names. const-rgx=(([A-Z_][A-Z1-9_]*)|(__.*__)|(_[a-z0-9_]{2,30}))$ # Regular expression which should only match correct class names class-rgx=[A-Z_][a-zA-Z0-9]+$ # Regular expression which should only match correct function names function-rgx=[a-z_][a-z0-9_]{2,30}$ # Regular expression which should only match correct method names # Default: method-rgx=[a-z_][a-z0-9_]{2,30}$ # PythonReports: many GUI event handlers have names like OnWhatever, # the rest of the classes tend to use method names in mixedCase. # I leave default lower_case regexp for a while; see if it can be # brought to common style. method-rgx=([a-z_][a-z0-9_]{2,30}|[a-z_]+[A-Z][a-zA-Z0-9]+|On[A-Z][a-zA-Z0-9]+)$ # Regular expression which should only match correct instance attribute names # Default: attr-rgx=[a-z_][a-z0-9_]{2,30}$ # PythonReports: "id" is perfectly valid attribute name (but not a variable # or argument name - otherwise it would be added to the good-names list). attr-rgx=([a-z_][a-z0-9_]{2,30}|id)$ # Regular expression which should only match correct argument names # PythonReports: x and y are often used to pass position. # kw is common name for generic keyword arguments dictionary. argument-rgx=([a-z_][a-z0-9_]{2,30}|x|y|kw)$ # Regular expression which should only match correct variable names # Default: variable-rgx=[a-z_][a-z0-9_]{2,30}$ # PythonReports: all local variable names start with underscore variable-rgx=_[a-z0-9_]{2,30}$ # Regular expression which should only match correct list comprehension / # generator expression variable names # Default: inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ # PythonReports: same as local variables inlinevar-rgx=_[a-z0-9_]{2,30}$ # Good variable names which should always be accepted, separated by a comma # Default: good-names=i,j,k,ex,Run,_ # PythonReports: x and y are the only allowed single-letter names. good-names=x,y,ex,Run,_ # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata # List of builtins function names that should not be used, separated by a comma # Default: bad-functions=map,filter,apply,input # PythonReports: map is ok. # In rare cases, filter is ok too (never with lambda as the first argument). bad-functions=filter,apply,input # try to find bugs in the code using type inference # [TYPECHECK] # Tells wether missing members accessed in mixin class should be ignored. A # mixin class is detected if its name ends with "mixin" (case insensitive). ignore-mixin-members=yes # When zope mode is activated, consider the acquired-members option to ignore # access to some undefined attributes. zope=no # List of members which are usually get through zope's acquisition mecanism and # so shouldn't trigger E0201 when accessed (need zope=yes to be considered). acquired-members=REQUEST,acl_users,aq_parent # checks for # * unused variables / imports # * undefined variables # * redefinition of variable from builtins or from an outer scope # * use of variable before assigment # [VARIABLES] # Tells wether we should check for unused import in __init__ files. init-import=no # A regular expression matching names used for dummy variables (i.e. not used). # Default: dummy-variables-rgx=_|dummy # PythonReports: args and kwargs are often used for interface compatibility, # event passed to GUI (wx/Tk) event handlers dummy-variables-rgx=args|kwargs|event # List of additional names supposed to be defined in builtins. Remember that # you should avoid to define new builtins when possible. additional-builtins= # checks for : # * methods without self as first argument # * overridden methods signature # * access only to existant members via self # * attributes not defined in the __init__ method # * supported interfaces implementation # * unreachable code # [CLASSES] # List of interface methods to ignore, separated by a comma. This is used for # instance to not check methods defines in Zope's Interface base class. ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__,__new__,setUp # checks for sign of poor/misdesign: # * number of methods, attributes, local variables... # * size, complexity of functions, methods # [DESIGN] # Maximum number of arguments for function / method max-args=5 # Maximum number of locals for function / method body max-locals=15 # Maximum number of return / yield for function / method body max-returns=6 # Maximum number of branch for function / method body max-branchs=12 # Maximum number of statements in function / method body max-statements=50 # Maximum number of parents for a class (see R0901). max-parents=7 # Maximum number of attributes for a class (see R0902). max-attributes=7 # Minimum number of public methods for a class (see R0903). min-public-methods=2 # Maximum number of public methods for a class (see R0904). max-public-methods=20 # checks for # * external modules dependencies # * relative / wildcard imports # * cyclic imports # * uses of deprecated modules # [IMPORTS] # Deprecated modules which should not be used, separated by a comma deprecated-modules=regsub,string,TERMIOS,Bastion,rexec # Create a graph of every (i.e. internal and external) dependencies in the # given file (report R0402 must not be disabled) import-graph= # Create a graph of external dependencies in the given file (report R0402 must # not be disabled) ext-import-graph= # Create a graph of internal dependencies in the given file (report R0402 must # not be disabled) int-import-graph= # checks for : # * unauthorized constructions # * strict indentation # * line length # * use of <> instead of != # [FORMAT] # Maximum number of characters on a single line. max-line-length=80 # Maximum number of lines in a module # Default: max-module-lines=1000 # PythonReports: modules builder, datatypes and design have 1500-2000. # i don't think they should be changed to packages. max-module-lines=2000 # String used as indentation unit. This is usually " " (4 spaces) # or "\t" (1 tab). indent-string=' ' # checks for: # * warning notes in the code like FIXME, XXX # * PEP 263: source code with non ascii character but no encoding declaration # [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. notes=FIXME,XXX,TODO # checks for similarities and duplicated code. This computation may be # memory / CPU intensive, so you should disable it if you experiments some # problems. # [SIMILARITIES] # Minimum lines number of a similarity. min-similarity-lines=4 # Ignore comments when computing similarities. ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes |
From: alexander s. <a1...@us...> - 2006-11-09 08:47:11
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4504 Modified Files: version.py Log Message: version 0.2.1 Index: version.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/version.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** version.py 7 Nov 2006 05:23:15 -0000 1.2 --- version.py 9 Nov 2006 08:47:10 -0000 1.3 *************** *** 8,13 **** # wouldn't datetime.date object be better? ! __version__ = "0.2.0" ! __date__ = "2006-11-07" __all__ = ["__version__", "__date__"] --- 8,13 ---- # wouldn't datetime.date object be better? ! __version__ = "0.2.1" ! __date__ = "2006-11-09" __all__ = ["__version__", "__date__"] |
From: alexander s. <a1...@us...> - 2006-11-09 08:44:26
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3442 Modified Files: CHANGES Log Message: version 0.2.1 Index: CHANGES =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/CHANGES,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CHANGES 7 Nov 2006 06:06:13 -0000 1.3 --- CHANGES 9 Nov 2006 08:44:19 -0000 1.4 *************** *** 2,5 **** --- 2,13 ---- ============================= + version 0.2.1 (09-nov-2006) + --------------------------- + + Fixes: + + - shebangs added to all modules implementing command line interface + - fixed barcode doctests + version 0.2.0 (07-nov-2006) --------------------------- |
From: Oleg B. <ph...@us...> - 2006-11-07 13:32:14
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3979 Modified Files: Tk.py design.py pdf.py wxPrint.py Log Message: Added shebang for the executable scripts. Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** design.py 5 Nov 2006 11:09:45 -0000 1.10 --- design.py 7 Nov 2006 13:32:02 -0000 1.11 *************** *** 1,5 **** --- 1,7 ---- + #! /usr/bin/env python """PythonReports Template Designer""" """History (most recent first): + 07-Nov-2006 [phd] Added shebang. 04-nov-2006 [als] added About dialog 04-nov-2006 [als] capture report preview errors; Index: Tk.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/Tk.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Tk.py 1 Nov 2006 11:44:04 -0000 1.1 --- Tk.py 7 Nov 2006 13:32:02 -0000 1.2 *************** *** 1,5 **** --- 1,7 ---- + #! /usr/bin/env python """Tk output for PythonReports""" """History (most recent first): + 07-Nov-2006 [phd] Added shebang. 20-oct-2006 [als] Barcode X dimension attr renamed to "module" 12-oct-2006 [als] added zoom Index: wxPrint.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/wxPrint.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxPrint.py 1 Nov 2006 11:06:14 -0000 1.1 --- wxPrint.py 7 Nov 2006 13:32:02 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + #! /usr/bin/env python """wxPython print classes *************** *** 6,9 **** --- 7,11 ---- """ """History (most recent first): + 07-Nov-2006 [phd] Added shebang. 20-oct-2006 [als] Barcode X dimension attr renamed to "module" 20-oct-2006 [als] added command-line application Index: pdf.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/pdf.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pdf.py 1 Nov 2006 11:06:39 -0000 1.1 --- pdf.py 7 Nov 2006 13:32:02 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- + #! /usr/bin/env python """PDF output for PythonReports""" """History (most recent first): + 07-Nov-2006 [phd] Added shebang. 20-oct-2006 [als] Barcode X dimension attr renamed to "module" 03-oct-2006 [als] support images |
From: alexander s. <a1...@us...> - 2006-11-07 13:16:49
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30887 Modified Files: barcode.py Log Message: fix doctests (no quet zones encoded) Index: barcode.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/barcode.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** barcode.py 1 Nov 2006 11:01:02 -0000 1.1 --- barcode.py 7 Nov 2006 13:16:42 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- """BarCode routines""" """History: + 07-nov-2006 [als] fix doctests (no quet zones encoded) 22-sep-2006 [als] encoding calls return sequences w/o quiet zones; added .add_qz(), .min_height() *************** *** 152,162 **** >>> code2of5i("25") ! (10, 1, 1, 1, 1, 1, 3, 3, 1, 1, 3, 1, 1, 3, 1, 3, 1, 1, 10) >>> code2of5i("5") ! (10, 1, 1, 1, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 1, 3, 1, 1, 10) >>> print textwrap.fill(repr(code2of5i("19980726")), 64) ! (10, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 1, ! 3, 3, 1, 1, 1, 1, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 3, 1, ! 1, 3, 1, 3, 1, 1, 10) Check digit examples: --- 153,163 ---- >>> code2of5i("25") ! (1, 1, 1, 1, 1, 3, 3, 1, 1, 3, 1, 1, 3, 1, 3, 1, 1) >>> code2of5i("5") ! (1, 1, 1, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 1, 3, 1, 1) >>> print textwrap.fill(repr(code2of5i("19980726")), 64) ! (1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 1, 3, ! 3, 1, 1, 1, 1, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 3, 1, 1, ! 3, 1, 3, 1, 1) Check digit examples: *************** *** 264,272 **** >>> print textwrap.fill(repr(Code39(gap=2)("BARCODE1")), 64) ! (10, 1, 3, 1, 1, 3, 1, 3, 1, 1, 2, 1, 1, 3, 1, 1, 3, 1, 1, 3, 2, ! 3, 1, 1, 1, 1, 3, 1, 1, 3, 2, 3, 1, 1, 1, 1, 1, 3, 3, 1, 2, 3, ! 1, 3, 1, 1, 3, 1, 1, 1, 2, 3, 1, 1, 1, 3, 1, 1, 3, 1, 2, 1, 1, ! 1, 1, 3, 3, 1, 1, 3, 2, 3, 1, 1, 1, 3, 3, 1, 1, 1, 2, 3, 1, 1, ! 3, 1, 1, 1, 1, 3, 2, 1, 3, 1, 1, 3, 1, 3, 1, 1, 10) >>> code39.check_digit("BARCODE1") --- 265,273 ---- >>> print textwrap.fill(repr(Code39(gap=2)("BARCODE1")), 64) ! (1, 3, 1, 1, 3, 1, 3, 1, 1, 2, 1, 1, 3, 1, 1, 3, 1, 1, 3, 2, 3, ! 1, 1, 1, 1, 3, 1, 1, 3, 2, 3, 1, 1, 1, 1, 1, 3, 3, 1, 2, 3, 1, ! 3, 1, 1, 3, 1, 1, 1, 2, 3, 1, 1, 1, 3, 1, 1, 3, 1, 2, 1, 1, 1, ! 1, 3, 3, 1, 1, 3, 2, 3, 1, 1, 1, 3, 3, 1, 1, 1, 2, 3, 1, 1, 3, ! 1, 1, 1, 1, 3, 2, 1, 3, 1, 1, 3, 1, 3, 1, 1) >>> code39.check_digit("BARCODE1") *************** *** 424,442 **** >>> print textwrap.fill(repr(code128("Code 128")), 64) ! (10, 2, 1, 1, 2, 1, 4, 1, 3, 1, 3, 2, 1, 1, 3, 4, 1, 1, 1, 1, 4, ! 1, 2, 2, 1, 1, 1, 2, 2, 1, 4, 2, 1, 2, 2, 2, 2, 1, 2, 3, 2, 2, ! 1, 2, 2, 3, 2, 1, 1, 3, 1, 1, 2, 2, 2, 1, 1, 1, 4, 2, 2, 2, 3, ! 3, 1, 1, 1, 2, 10) >>> print textwrap.fill(repr(code128("\rx")), 64) ! (10, 2, 1, 1, 4, 1, 2, 4, 1, 3, 1, 1, 1, 1, 1, 4, 1, 3, 1, 4, 2, ! 1, 2, 1, 1, 3, 2, 1, 2, 2, 1, 2, 3, 3, 1, 1, 1, 2, 10) >>> print textwrap.fill(repr(code128("0123456789")), 64) ! (10, 2, 1, 1, 2, 3, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, 1, 3, 1, 1, 1, ! 3, 1, 2, 3, 1, 4, 1, 1, 2, 2, 2, 1, 2, 1, 4, 1, 1, 4, 2, 1, 1, ! 2, 2, 3, 3, 1, 1, 1, 2, 10) >>> print textwrap.fill(repr(code128("01234\\n")), 64) ! (10, 2, 1, 1, 2, 3, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, 1, 3, 1, 3, 1, ! 1, 1, 4, 1, 2, 2, 1, 2, 3, 1, 1, 4, 2, 2, 1, 1, 1, 2, 1, 1, 4, ! 2, 2, 3, 3, 1, 1, 1, 2, 10) """ --- 425,443 ---- >>> print textwrap.fill(repr(code128("Code 128")), 64) ! (2, 1, 1, 2, 1, 4, 1, 3, 1, 3, 2, 1, 1, 3, 4, 1, 1, 1, 1, 4, 1, ! 2, 2, 1, 1, 1, 2, 2, 1, 4, 2, 1, 2, 2, 2, 2, 1, 2, 3, 2, 2, 1, ! 2, 2, 3, 2, 1, 1, 3, 1, 1, 2, 2, 2, 1, 1, 1, 4, 2, 2, 2, 3, 3, ! 1, 1, 1, 2) >>> print textwrap.fill(repr(code128("\rx")), 64) ! (2, 1, 1, 4, 1, 2, 4, 1, 3, 1, 1, 1, 1, 1, 4, 1, 3, 1, 4, 2, 1, ! 2, 1, 1, 3, 2, 1, 2, 2, 1, 2, 3, 3, 1, 1, 1, 2) >>> print textwrap.fill(repr(code128("0123456789")), 64) ! (2, 1, 1, 2, 3, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, 1, 3, 1, 1, 1, 3, ! 1, 2, 3, 1, 4, 1, 1, 2, 2, 2, 1, 2, 1, 4, 1, 1, 4, 2, 1, 1, 2, ! 2, 3, 3, 1, 1, 1, 2) >>> print textwrap.fill(repr(code128("01234\\n")), 64) ! (2, 1, 1, 2, 3, 2, 2, 2, 2, 1, 2, 2, 3, 1, 2, 1, 3, 1, 3, 1, 1, ! 1, 4, 1, 2, 2, 1, 2, 3, 1, 1, 4, 2, 2, 1, 1, 1, 2, 1, 1, 4, 2, ! 2, 3, 3, 1, 1, 1, 2) """ |
From: alexander s. <a1...@us...> - 2006-11-07 06:06:15
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3638 Modified Files: CHANGES Log Message: version 0.2.0, continued Index: CHANGES =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/CHANGES,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CHANGES 7 Nov 2006 05:37:58 -0000 1.2 --- CHANGES 7 Nov 2006 06:06:13 -0000 1.3 *************** *** 11,15 **** - when template designer gets file loading or report preview error, full traceback is printed to console along with concise error message ! dialog. Fixes: --- 11,16 ---- - when template designer gets file loading or report preview error, full traceback is printed to console along with concise error message ! dialog ! - distribution packages include documentation in HTML and reST formats Fixes: |
From: alexander s. <a1...@us...> - 2006-11-07 06:02:28
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2231 Modified Files: setup.py Log Message: data_files include source (*.txt) documents Index: setup.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/setup.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** setup.py 7 Nov 2006 05:36:49 -0000 1.4 --- setup.py 7 Nov 2006 06:02:24 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- # FIXME! generate_docs() must be reimplemented as a distutils command """History: + 07-nov-2006 [als] data_files include source (*.txt) documents 07-nov-2006 [als] fix: rst2html failed when there is no target file 04-nov-2006 [als] added maintainer_email and download_url; *************** *** 123,128 **** packages=["PythonReports"], scripts=SCRIPTS, ! data_files=[(DOC_DIR, ! ["README", "LICENSE", "CHANGES"] + glob.glob("doc/*.html"))], ) --- 124,129 ---- packages=["PythonReports"], scripts=SCRIPTS, ! data_files=[(DOC_DIR, ["README", "LICENSE", "CHANGES"] ! + glob.glob("doc/*.txt") + glob.glob("doc/*.html"))], ) |
From: alexander s. <a1...@us...> - 2006-11-07 05:38:00
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25715 Modified Files: CHANGES Log Message: version 0.2.0 Index: CHANGES =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/CHANGES,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CHANGES 3 Nov 2006 19:42:24 -0000 1.1 --- CHANGES 7 Nov 2006 05:37:58 -0000 1.2 *************** *** 2,7 **** --- 2,24 ---- ============================= + version 0.2.0 (07-nov-2006) + --------------------------- + + Features: + + - added Tkinter-based text backend driver + - report builder allows explicit selection of text and image backends + - when template designer gets file loading or report preview error, + full traceback is printed to console along with concise error message + dialog. + + Fixes: + + - capture report preview errors in template designer + version 0.1.0 (03-nov-2006) --------------------------- first public release + + .. vim: set et ft=rst sts=2 sw=2 : |
From: alexander s. <a1...@us...> - 2006-11-07 05:36:51
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25347 Modified Files: setup.py Log Message: fix: rst2html failed when there is no target file Index: setup.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/setup.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setup.py 4 Nov 2006 07:20:18 -0000 1.3 --- setup.py 7 Nov 2006 05:36:49 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- # FIXME! generate_docs() must be reimplemented as a distutils command """History: + 07-nov-2006 [als] fix: rst2html failed when there is no target file 04-nov-2006 [als] added maintainer_email and download_url; name the license and platform in addition to classifiers *************** *** 62,66 **** """ if not force: ! force = os.stat(source).st_mtime > os.stat(target).st_mtime if force: print "Generating %s => %s" % (source, target) --- 63,68 ---- """ if not force: ! force = (not os.path.isfile(target)) \ ! or (os.stat(source).st_mtime > os.stat(target).st_mtime) if force: print "Generating %s => %s" % (source, target) |
From: alexander s. <a1...@us...> - 2006-11-07 05:23:17
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20716 Modified Files: version.py Log Message: version 0.2.0 Index: version.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/version.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** version.py 3 Nov 2006 10:28:19 -0000 1.1 --- version.py 7 Nov 2006 05:23:15 -0000 1.2 *************** *** 8,13 **** # wouldn't datetime.date object be better? ! __version__ = "0.1.0" ! __date__ = "2006-11-03" __all__ = ["__version__", "__date__"] --- 8,13 ---- # wouldn't datetime.date object be better? ! __version__ = "0.2.0" ! __date__ = "2006-11-07" __all__ = ["__version__", "__date__"] |
From: alexander s. <a1...@us...> - 2006-11-07 05:22:39
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20349 Modified Files: README Log Message: report building can use anything used for printouts Index: README =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 2 Nov 2006 15:35:31 -0000 1.2 --- README 7 Nov 2006 05:22:26 -0000 1.3 *************** *** 28,45 **** (cElementTree_ add-on is highly recommended too). - Report building requires either ReportLab_ or PIL_ or wxPython_ - (in that order of preference). If report template contains - images then either `Python Imaging Library`_ (PIL_) or wxPython_ - must be installed. - Requirements for printout_ rendering depend on selected frontend: ! * PDF output requires the ReportLab_ Toolkit; ! * wx-based preview and printing require wxPython_; * Tk-based report preview requires Tkinter (part of the Python Standard Library). Report template designer requires Tkinter with Tix_ support ! (standard Python installer for Windows includes Tix_; on some ! platforms Tix_ must be installed separately). =========== --- 28,48 ---- (cElementTree_ add-on is highly recommended too). Requirements for printout_ rendering depend on selected frontend: ! * PDF output requires the ReportLab_ Toolkit. ! Reports containing images additionally require ! `Python Imaging Library`_ (PIL_). ! * wx-based preview and printing require wxPython_. * Tk-based report preview requires Tkinter (part of the Python Standard Library). + Reports containing images additionally require + PIL_ or wxPython_. + + Report building can utilize any of the above options. + In other words, if your system is able to display or print + a report then it should be able to build a report too. Report template designer requires Tkinter with Tix_ support ! (standard Python installer for Windows includes Tix; on some ! platforms Tix must be installed separately). =========== |
From: alexander s. <a1...@us...> - 2006-11-05 11:09:53
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20073 Modified Files: design.py Log Message: added About dialog Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** design.py 4 Nov 2006 14:56:15 -0000 1.9 --- design.py 5 Nov 2006 11:09:45 -0000 1.10 *************** *** 2,5 **** --- 2,6 ---- """History (most recent first): + 04-nov-2006 [als] added About dialog 04-nov-2006 [als] capture report preview errors; print traceback on the console when showing error message; *************** *** 39,43 **** --- 40,46 ---- from code import InteractiveInterpreter from cStringIO import StringIO + import datetime import os + from subprocess import Popen import sys import traceback *************** *** 51,55 **** import tkFileDialog ! from PythonReports import datatypes, drivers, template as prt, printout as prp from PythonReports.builder import Builder from PythonReports.datatypes import * --- 54,59 ---- import tkFileDialog ! from PythonReports import datatypes, drivers, version ! from PythonReports import template as prt, printout as prp from PythonReports.builder import Builder from PythonReports.datatypes import * *************** *** 68,71 **** --- 72,87 ---- """ + PYTHONREPORTS_URL = "http://pythonreports.sourceforge.net/" + if os.name == "nt": + URL_HANDLER_COMMAND = "start %s" + else: + # url_handler.sh is part of urlview package. + # it's the best way i can think of... + # perhaps could try /usr/local/bin/netscape, /usr/local/bin/lynx, + # /usr/local/bin/w3m etc and see which one is executable. + URL_HANDLER_COMMAND = "/usr/local/bin/url_handler.sh %s" + + COPYRIGHT_YEAR = 2006 + ### shell *************** *** 679,682 **** --- 695,720 ---- # the application + class Url(Label): + + """Clickable URL widget""" + + DEFAULTS = ( + ("foreground", "blue"), + ("cursor", "hand2"), + ("underline", True), + ) + + def __init__(self, master=None, cnf={}, **kw): + for (_option, _default) in self.DEFAULTS: + kw.setdefault(_option, _default) + Label.__init__(self, master, cnf, **kw) + self.bind("<Button-1>", self.OnClick) + + def OnClick(self, event): + _url = self["text"] + if _url: + Popen(URL_HANDLER_COMMAND % _url, shell=True) + + class Designer(Toplevel): *************** *** 778,781 **** --- 816,852 ---- self.bind("<Destroy>", self.OnWindowClose) + def buildAboutDialog(self): + """Create dialog window for menu command "About..." + + Return value: toplevel widget + + """ + _release_date = datetime.date(*map(int, version.__date__.split("-"))) + _dlg = Toplevel(self) + _dlg.title(self._("About PythonReports Designer")) + _body = Frame(_dlg) + Label(_body, justify=CENTER, text = self._( + "PythonReports Designer\n" + "Version %(version)s %(date)s\n" + "Copyright %(year)s alexander smishlajev" + ) % { + "version": version.__version__, + "date": _release_date.strftime(self._("%d-%b-%Y")), + "year": COPYRIGHT_YEAR, + }).pack(side=TOP, padx=10) + Url(_body, text=PYTHONREPORTS_URL).pack(side=TOP, padx=10) + _body.pack(side=TOP, padx=10, pady=10) + (_ul, _text) = self.find_underline(self._("_Ok")) + _dlg.btn = Button(_dlg, text=_text, underline=_ul, + command=lambda: _dlg.destroy()) + _dlg.btn.pack(side=BOTTOM, ipadx=10, padx=10, pady=10) + _dlg.update_idletasks() + _dlg_x = self.winfo_rootx() \ + + (self.winfo_width() - _dlg.winfo_width()) / 2 + _dlg_y = self.winfo_rooty() \ + + (self.winfo_height() - _dlg.winfo_height()) / 2 + _dlg.geometry("+%i+%i" % (_dlg_x, _dlg_y)) + return _dlg + def buildMenu(self): """Create system menu""" *************** *** 946,949 **** --- 1017,1026 ---- def OnMenuAbout(self): """Display "About..." dialog""" + _focus = self.focus_get() or self.tree.hlist + _dlg = self.buildAboutDialog() + _dlg.btn.focus_set() + _dlg.grab_set() + self.wait_window(_dlg) + _focus.focus_set() def OnMenuMoveUp(self): |
From: alexander s. <a1...@us...> - 2006-11-04 14:56:17
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5704 Modified Files: design.py Log Message: capture report preview errors; print traceback on the console when showing error message; use Tk backend for report building Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** design.py 3 Nov 2006 17:32:21 -0000 1.8 --- design.py 4 Nov 2006 14:56:15 -0000 1.9 *************** *** 2,5 **** --- 2,8 ---- """History (most recent first): + 04-nov-2006 [als] capture report preview errors; + print traceback on the console when showing error message; + use Tk backend for report building 03-nov-2006 [als] fix IntegerSelection: mega widget has no .select_range() 03-nov-2006 [als] disable drawing canvas; *************** *** 38,41 **** --- 41,45 ---- import os import sys + import traceback from Tix import * *************** *** 762,765 **** --- 766,771 ---- # not sure what it will be on other platforms # (Gentoo Linux makes it Courier); try Courer + # FIXME: it is possible to look for monospaced + # font family names in tkFont.families(). self.shell = Shell(self.vp, borderwidth=2, relief=SUNKEN, width=80, height=20, font=("Courier", self.base_font[1])) *************** *** 1246,1254 **** self.report = prt.load(filename) except Exception, _err: _focus = self.focus_get() or self.tree.hlist Message(self, icon="error", type="ok", title=self._("File load error"), ! message=self._("Error loading file %(file)s:\n%(error)s") ! % {"file": os.path.abspath(filename), "error": _err}).show() # FIXME: still unfocused... _focus.focus_set() --- 1252,1263 ---- self.report = prt.load(filename) except Exception, _err: + traceback.print_exc() _focus = self.focus_get() or self.tree.hlist Message(self, icon="error", type="ok", title=self._("File load error"), ! message=self._("Error loading file %(file)s:\n%(error)s") % { ! "file": os.path.abspath(filename), ! "error": str(_err) or _err.__class__.__name__, ! }).show() # FIXME: still unfocused... _focus.focus_set() *************** *** 1420,1424 **** _focus.focus_set() # build printout tree ! _printout = Builder(self.report).run(_data) # printout must be validated before it can be displayed self._validate(_printout, prp.Printout) --- 1429,1435 ---- _focus.focus_set() # build printout tree ! # Note: it is best to use same backend for both building and rendering. ! # since we'll surely use Tk renderer, use Tk backend for builder too. ! _printout = Builder(self.report, text_backend="Tk").run(_data) # printout must be validated before it can be displayed self._validate(_printout, prp.Printout) *************** *** 1435,1443 **** def preview(self): """Show Report Preview for current template""" try: ! self["cursor"] = "watch" ! self._run_preview() ! finally: ! self["cursor"] = "" def run(argv=sys.argv): --- 1446,1463 ---- def preview(self): """Show Report Preview for current template""" + _focus = self.focus_get() or self.tree.hlist try: ! try: ! self["cursor"] = "watch" ! self._run_preview() ! finally: ! self["cursor"] = "" ! except Exception, _err: ! traceback.print_exc() ! Message(self, icon="error", type="ok", ! title=self._("Report preview error"), ! message=self._("Error running report preview:\n%s") ! % (str(_err) or _err.__class__.__name__)).show() ! _focus.focus_set() def run(argv=sys.argv): |
From: alexander s. <a1...@us...> - 2006-11-04 14:53:19
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4953 Modified Files: builder.py Log Message: fix errors in previous revision Index: builder.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/builder.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** builder.py 4 Nov 2006 14:38:24 -0000 1.2 --- builder.py 4 Nov 2006 14:53:17 -0000 1.3 *************** *** 939,943 **** def __init__(self, template, data=(), parameters=None, ! item_callback=None, text_driver=None, image_driver=None, ): """Initialize builder --- 939,943 ---- def __init__(self, template, data=(), parameters=None, ! item_callback=None, text_backend=None, image_backend=None, ): """Initialize builder *************** *** 1208,1212 **** # initialize fonts - moved from __init__() to allow backend switching self.text_drivers = dict([(_name, self.text_driver_factory(_font)) ! for (_name, _font) in template.fonts.iteritems()]) _data_iter = self.start(data, parameters) if _callback: --- 1208,1212 ---- # initialize fonts - moved from __init__() to allow backend switching self.text_drivers = dict([(_name, self.text_driver_factory(_font)) ! for (_name, _font) in self.template.fonts.iteritems()]) _data_iter = self.start(data, parameters) if _callback: |
From: alexander s. <a1...@us...> - 2006-11-04 14:38:27
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32275 Modified Files: builder.py Log Message: Builder: delay text_drivers initialization until run, added backend selection parameters for __init__ Index: builder.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/builder.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** builder.py 1 Nov 2006 11:05:19 -0000 1.1 --- builder.py 4 Nov 2006 14:38:24 -0000 1.2 *************** *** 2,5 **** --- 2,7 ---- # FIXME: column-based variables are not intelligible """History (most recent first): + 04-nov-2006 [als] Builder: delay text_drivers initialization until run, + added backend selection parameters for __init__ 20-oct-2006 [als] Barcode X dimension attr renamed to "module" 20-oct-2006 [als] Structure moved to datatypes *************** *** 936,944 **** layout_parents = {} ! def __init__(self, template, data=(), parameters=None, item_callback=None): """Initialize builder Parameters: ! template: PRT file name or ElementTree With loaded report template data: report data sequence parameters: values for report parameters --- 938,949 ---- layout_parents = {} ! def __init__(self, template, data=(), parameters=None, ! item_callback=None, text_driver=None, image_driver=None, ! ): """Initialize builder Parameters: ! template: PRT file name or ElementTree ! with loaded report template data: report data sequence parameters: values for report parameters *************** *** 947,950 **** --- 952,959 ---- that will be called without arguments for each item of the data sequence. + text_backend: optional name of preferred text + driver backend, e.g. "wx" or "Tk". + image_backend: optional name of preferred image + driver backend, e.g. "wx". """ *************** *** 959,964 **** self.parameters = {} self.callback = item_callback ! self.text_driver_factory = drivers.get_driver("Text") ! self.image_driver_factory = drivers.get_driver("Image") self.basedir = template.getroot().get("basedir", None) if not self.basedir: --- 968,973 ---- self.parameters = {} self.callback = item_callback ! self.text_driver_factory = drivers.get_driver("Text", text_backend) ! self.image_driver_factory = drivers.get_driver("Image", image_backend) self.basedir = template.getroot().get("basedir", None) if not self.basedir: *************** *** 969,974 **** self.variables = [Variable(_item) for _item in template.variables.itervalues()] - self.text_drivers = dict([(_name, self.text_driver_factory(_font)) - for (_name, _font) in template.fonts.iteritems()]) # image collections: # - kept in files --- 978,981 ---- *************** *** 1199,1202 **** --- 1206,1212 ---- else: _callback = self.callback + # initialize fonts - moved from __init__() to allow backend switching + self.text_drivers = dict([(_name, self.text_driver_factory(_font)) + for (_name, _font) in template.fonts.iteritems()]) _data_iter = self.start(data, parameters) if _callback: |