##// END OF EJS Templates
CLN: core/display: pep8 specifies double newlines between module-level callables
Wes Turner -
Show More
@@ -794,6 +794,7 class Javascript(TextDisplayObject):
794 794 r += _lib_t2*len(self.lib)
795 795 return r
796 796
797
797 798 # constants for identifying png/jpeg/gif/webp data
798 799 _PNG = b'\x89PNG\r\n\x1a\n'
799 800 _JPEG = b'\xff\xd8'
@@ -801,12 +802,14 _GIF1 = b"GIF87a"
801 802 _GIF2 = b"GIF89a"
802 803 _WEBP = b'WEBP'
803 804
805
804 806 def _pngxy(data):
805 807 """read the (width, height) from a PNG header"""
806 808 ihdr = data.index(b'IHDR')
807 809 # next 8 bytes are width/height
808 810 return struct.unpack('>ii', data[ihdr+4:ihdr+12])
809 811
812
810 813 def _jpegxy(data):
811 814 """read the (width, height) from a JPEG header"""
812 815 # adapted from http://www.64lines.com/jpeg-width-height
@@ -826,10 +829,12 def _jpegxy(data):
826 829 h, w = struct.unpack('>HH', data[iSOF+5:iSOF+9])
827 830 return w, h
828 831
832
829 833 def _gifxy(data):
830 834 """read the (width, height) from a GIF header"""
831 835 return struct.unpack('<HH', data[6:10])
832 836
837
833 838 def _webpxy(data):
834 839 """read the (width, height) from a WEBP header"""
835 840 if data[12:16] == b"VP8 ":
General Comments 0
You need to be logged in to leave comments. Login now