Coding style overhaul for Python files (PEP8 conformant). Removed buggy csstidy pytho...
[redakcja.git] / apps / compress / filters / jsmin / jsmin.py
index 4f9d384..60202e1 100644 (file)
@@ -32,6 +32,7 @@
 
 from StringIO import StringIO
 
+
 def jsmin(js):
     ins = StringIO(js)
     outs = StringIO()
@@ -41,26 +42,33 @@ def jsmin(js):
         str = str[1:]
     return str
 
+
 def isAlphanum(c):
     """return true if the character is a letter, digit, underscore,
            dollar sign, or non-ASCII character.
     """
-    return ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or
-            (c >= 'A' and c <= 'Z') or c == '_' or c == '$' or c == '\\' or (c is not None and ord(c) > 126));
+    return (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') \
+        or (c >= '0' and c <= '9') or c == '_' or c == '$' or c == '\\' \
+        or (c is not None and ord(c) > 126)
+
 
 class UnterminatedComment(Exception):
     pass
 
+
 class UnterminatedStringLiteral(Exception):
     pass
 
+
 class UnterminatedRegularExpression(Exception):
     pass
 
+
 class JavascriptMinify(object):
 
     def _outA(self):
         self.outstream.write(self.theA)
+
     def _outB(self):
         self.outstream.write(self.theB)
 
@@ -75,7 +83,7 @@ class JavascriptMinify(object):
             c = self.instream.read(1)
         if c >= ' ' or c == '\n':
             return c
-        if c == '': # EOF
+        if c == '':  # EOF
             return '\000'
         if c == '\r':
             return '\n'
@@ -135,7 +143,6 @@ class JavascriptMinify(object):
                         self._outA()
                         self.theA = self._get()
 
-
         if action <= 3:
             self.theB = self._next()
             if self.theB == '/' and (self.theA == '(' or self.theA == ',' or
@@ -159,7 +166,6 @@ class JavascriptMinify(object):
                     self._outA()
                 self.theB = self._next()
 
-
     def _jsmin(self):
         """Copy the input to the output, deleting the characters which are
            insignificant to JavaScript. Comments will be removed. Tabs will be
@@ -215,4 +221,4 @@ class JavascriptMinify(object):
 if __name__ == '__main__':
     import sys
     jsm = JavascriptMinify()
-    jsm.minify(sys.stdin, sys.stdout)
\ No newline at end of file
+    jsm.minify(sys.stdin, sys.stdout)