Code Duplication    Length = 8-8 lines in 2 locations

tcod/tcod.py 2 locations

@@ 782-789 (lines=8) @@
779
            cg = ffi.cast('int *', g.ctypes.data)
780
            cb = ffi.cast('int *', b.ctypes.data)
781
            lib.TCOD_console_fill_foreground(self.cdata, cr, cg, cb)
782
        if bg:
783
            r = numpy.ascontiguousarray(bg[:,:,0], dtype=numpy.intc)
784
            g = numpy.ascontiguousarray(bg[:,:,1], dtype=numpy.intc)
785
            b = numpy.ascontiguousarray(bg[:,:,2], dtype=numpy.intc)
786
            cr = ffi.cast('int *', r.ctypes.data)
787
            cg = ffi.cast('int *', g.ctypes.data)
788
            cb = ffi.cast('int *', b.ctypes.data)
789
            lib.TCOD_console_fill_background(self.cdata, cr, cg, cb)
790
791
792
class Image(_CDataWrapper):
@@ 774-781 (lines=8) @@
771
            ch = numpy.ascontiguousarray(ch, dtype=numpy.intc)
772
            ch_array = ffi.cast('int *', ch.ctypes.data)
773
            lib.TCOD_console_fill_char(self.cdata, ch_array)
774
        if fg:
775
            r = numpy.ascontiguousarray(fg[:,:,0], dtype=numpy.intc)
776
            g = numpy.ascontiguousarray(fg[:,:,1], dtype=numpy.intc)
777
            b = numpy.ascontiguousarray(fg[:,:,2], dtype=numpy.intc)
778
            cr = ffi.cast('int *', r.ctypes.data)
779
            cg = ffi.cast('int *', g.ctypes.data)
780
            cb = ffi.cast('int *', b.ctypes.data)
781
            lib.TCOD_console_fill_foreground(self.cdata, cr, cg, cb)
782
        if bg:
783
            r = numpy.ascontiguousarray(bg[:,:,0], dtype=numpy.intc)
784
            g = numpy.ascontiguousarray(bg[:,:,1], dtype=numpy.intc)