PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/stubs/__pyjamas__.py

http://pyjamas.googlecode.com/
Python | 70 lines | 26 code | 10 blank | 34 comment | 0 complexity | 118f0f585f393b44d41a56047dee7b32 MD5 | raw file
 1
 2def decodeURI(s):    
 3    """
 4    Built-in javascript function to decode a URI
 5    """
 6    
 7def decodeURIComponent(s):
 8    """
 9    Built-in javascript function to decode a URI component
10    """
11
12def encodeURI(s):
13    """
14    Built-in javascript function to encode a URI
15    
16    >> encodeURI(",/?:@&=+$# ")
17    ",/?:@&=+$#%20"
18    """
19
20def encodeURIComponent(s):
21    """
22    Built-in javascript function to encode a URI component
23    
24    >>> encodeURIComponent(",/?:@&=+$# ")
25    "%2C%2F%3F%3A%40%26%3D%2B%24%23%20"
26    """
27
28def escape(s):
29    """
30    Built-in javascript function to HTML escape a string.
31    
32    The escape() function encodes special characters, with the exception of:
33        * @ - _ + . /
34    
35    Use the unescape() function to decode strings encoded with escape().
36    
37    For example:
38    
39    >>> escape("?!=()#%&")
40    %3F%21%3D%28%29%23%25%26
41    
42    """
43
44def unescape(s):
45    """
46    Use the unescape() function to decode strings encoded with escape().
47
48    """
49    
50def JS(code):
51    """
52        Outputs the given javascript code as-is into the generated
53        javascript code.
54    """
55
56
57class console:
58    """
59        Firebug console object stub.
60    """
61    
62    @staticmethod
63    def log(x, *args):
64        """Print to the console"""
65
66    @staticmethod
67    def error(x, *args):
68        """Print to the console"""
69
70