| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 141971f commit 6b71e74
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,12 +103,12 @@ def is_python(self, path): | |||
| 103 | 103 | def run_cgi(self): | |
| 104 | 104 | """Execute a CGI script.""" | |
| 105 | 105 | dir, rest = self.cgi_info | |
| 106 | - i = string.rfind(rest, '?') | ||
| 106 | + i = rest.rfind('?') | ||
| 107 | 107 | if i >= 0: | |
| 108 | 108 | rest, query = rest[:i], rest[i+1:] | |
| 109 | 109 | else: | |
| 110 | 110 | query = '' | |
| 111 | - i = string.find(rest, '/') | ||
| 111 | + i = rest.find('/') | ||
| 112 | 112 | if i >= 0: | |
| 113 | 113 | script, rest = rest[:i], rest[i:] | |
| 114 | 114 | else: | |
@@ -165,16 +165,16 @@ def run_cgi(self): | |||
| 165 | 165 | accept = [] | |
| 166 | 166 | for line in self.headers.getallmatchingheaders('accept'): | |
| 167 | 167 | if line[:1] in string.whitespace: | |
| 168 | - accept.append(string.strip(line)) | ||
| 168 | + accept.append(line.strip()) | ||
| 169 | 169 | else: | |
| 170 | - accept = accept + string.split(line[7:], ',') | ||
| 171 | - env['HTTP_ACCEPT'] = string.joinfields(accept, ',') | ||
| 170 | + accept = accept + line[7:].split(',') | ||
| 171 | + env['HTTP_ACCEPT'] = ','.join(accept) | ||
| 172 | 172 | ua = self.headers.getheader('user-agent') | |
| 173 | 173 | if ua: | |
| 174 | 174 | env['HTTP_USER_AGENT'] = ua | |
| 175 | 175 | co = filter(None, self.headers.getheaders('cookie')) | |
| 176 | 176 | if co: | |
| 177 | - env['HTTP_COOKIE'] = string.join(co, ', ') | ||
| 177 | + env['HTTP_COOKIE'] = ', '.join(co) | ||
| 178 | 178 | # XXX Other HTTP_* headers | |
| 179 | 179 | if not self.have_fork: | |
| 180 | 180 | # Since we're setting the env in the parent, provide empty | |
@@ -185,7 +185,7 @@ def run_cgi(self): | |||
| 185 | 185 | ||
| 186 | 186 | self.send_response(200, "Script output follows") | |
| 187 | 187 | ||
| 188 | - decoded_query = string.replace(query, '+', ' ') | ||
| 188 | + decoded_query = query.replace('+', ' ') | ||
| 189 | 189 | ||
| 190 | 190 | if self.have_fork: | |
| 191 | 191 | # Unix -- fork as we should | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | import sys | |
| 9 | - import string | ||
| 10 | 9 | import traceback | |
| 11 | 10 | from codeop import compile_command | |
| 12 | 11 | ||
@@ -260,7 +259,7 @@ def push(self, line): | |||
| 260 | 259 | ||
| 261 | 260 | """ | |
| 262 | 261 | self.buffer.append(line) | |
| 263 | - source = string.join(self.buffer, "\n") | ||
| 262 | + source = "\n".join(self.buffer) | ||
| 264 | 263 | more = self.runsource(source, self.filename) | |
| 265 | 264 | if not more: | |
| 266 | 265 | self.resetbuffer() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,6 @@ | |||
| 1 | 1 | """Utility to compile possibly incomplete Python source code.""" | |
| 2 | 2 | ||
| 3 | 3 | import sys | |
| 4 | - import string | ||
| 5 | 4 | import traceback | |
| 6 | 5 | ||
| 7 | 6 | __all__ = ["compile_command"] | |
@@ -49,8 +48,8 @@ def compile_command(source, filename="<input>", symbol="single"): | |||
| 49 | 48 | """ | |
| 50 | 49 | ||
| 51 | 50 | # Check for source consisting of only blank lines and comments | |
| 52 | - for line in string.split(source, "\n"): | ||
| 53 | - line = string.strip(line) | ||
| 51 | + for line in source.split("\n"): | ||
| 52 | + line = line.strip() | ||
| 54 | 53 | if line and line[0] != '#': | |
| 55 | 54 | break # Leave it alone | |
| 56 | 55 | else: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,10 +59,10 @@ def compile(file, cfile=None, dfile=None): | |||
| 59 | 59 | try: | |
| 60 | 60 | codeobject = __builtin__.compile(codestring, dfile or file, 'exec') | |
| 61 | 61 | except SyntaxError, detail: | |
| 62 | - import traceback, sys, string | ||
| 62 | + import traceback, sys | ||
| 63 | 63 | lines = traceback.format_exception_only(SyntaxError, detail) | |
| 64 | 64 | for line in lines: | |
| 65 | - sys.stderr.write(string.replace(line, 'File "<string>"', | ||
| 65 | + sys.stderr.write(line.replace('File "<string>"', | ||
| 66 | 66 | 'File "%s"' % (dfile or file))) | |
| 67 | 67 | return | |
| 68 | 68 | if not cfile: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,5 @@ | |||
| 1 | 1 | """Redo the `...` (representation) but with limits on most sizes.""" | |
| 2 | 2 | ||
| 3 | - import string | ||
| 4 | - | ||
| 5 | 3 | class Repr: | |
| 6 | 4 | def __init__(self): | |
| 7 | 5 | self.maxlevel = 6 | |
@@ -16,8 +14,8 @@ def repr(self, x): | |||
| 16 | 14 | def repr1(self, x, level): | |
| 17 | 15 | typename = `type(x)`[7:-2] # "<type '......'>" | |
| 18 | 16 | if ' ' in typename: | |
| 19 | - parts = string.split(typename) | ||
| 20 | - typename = string.joinfields(parts, '_') | ||
| 17 | + parts = typename.split() | ||
| 18 | + typename = '_'.join(parts) | ||
| 21 | 19 | if hasattr(self, 'repr_' + typename): | |
| 22 | 20 | return getattr(self, 'repr_' + typename)(x, level) | |
| 23 | 21 | else: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments