Skip to content

Commit

Permalink
Whitespace normalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-one committed Jan 14, 2001
1 parent f6922aa commit 11cf605
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 98 deletions.
48 changes: 24 additions & 24 deletions Lib/BaseHTTPServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@

# Log files
# ---------
#
#
# Here's a quote from the NCSA httpd docs about log file format.
#
# | The logfile format is as follows. Each line consists of:
# |
# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb
# |
# | host: Either the DNS name or the IP number of the remote client
#
# | The logfile format is as follows. Each line consists of:
# |
# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb
# |
# | host: Either the DNS name or the IP number of the remote client
# | rfc931: Any information returned by identd for this person,
# | - otherwise.
# | - otherwise.
# | authuser: If user sent a userid for authentication, the user name,
# | - otherwise.
# | DD: Day
# | Mon: Month (calendar name)
# | YYYY: Year
# | hh: hour (24-hour format, the machine's timezone)
# | mm: minutes
# | ss: seconds
# | request: The first line of the HTTP request as sent by the client.
# | ddd: the status code returned by the server, - if not available.
# | - otherwise.
# | DD: Day
# | Mon: Month (calendar name)
# | YYYY: Year
# | hh: hour (24-hour format, the machine's timezone)
# | mm: minutes
# | ss: seconds
# | request: The first line of the HTTP request as sent by the client.
# | ddd: the status code returned by the server, - if not available.
# | bbbb: the total number of bytes sent,
# | *not including the HTTP/1.0 header*, - if not available
# |
# | *not including the HTTP/1.0 header*, - if not available
# |
# | You can determine the name of the file accessed through request.
#
#
# (Actually, the latter is only true if you know the server configuration
# at the time the request was made!)

Expand Down Expand Up @@ -429,13 +429,13 @@ def address_string(self):
'Request accepted, processing continues off-line'),
203: ('Partial information', 'Request fulfilled from cache'),
204: ('No response', 'Request fulfilled, nothing follows'),

301: ('Moved', 'Object moved permanently -- see URI list'),
302: ('Found', 'Object moved temporarily -- see URI list'),
303: ('Method', 'Object moved -- see Method and URL list'),
304: ('Not modified',
'Document has not changed singe given time'),

400: ('Bad request',
'Bad request syntax or unsupported method'),
401: ('Unauthorized',
Expand All @@ -445,15 +445,15 @@ def address_string(self):
403: ('Forbidden',
'Request forbidden -- authorization will not help'),
404: ('Not found', 'Nothing matches the given URI'),

500: ('Internal error', 'Server got itself in trouble'),
501: ('Not implemented',
'Server does not support this operation'),
502: ('Service temporarily overloaded',
'The server cannot process the request due to a high load'),
503: ('Gateway timeout',
'The gateway server did not receive a timely response'),

}


Expand Down
88 changes: 44 additions & 44 deletions Lib/bdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class Bdb:

"""Generic Python debugger base class.
This class takes care of details of the trace facility;
Expand All @@ -26,15 +26,15 @@ def canonic(self, filename):
canonic = os.path.abspath(filename)
self.fncache[filename] = canonic
return canonic

def reset(self):
import linecache
linecache.checkcache()
self.botframe = None
self.stopframe = None
self.returnframe = None
self.quitting = 0

def trace_dispatch(self, frame, event, arg):
if self.quitting:
return # None
Expand All @@ -48,13 +48,13 @@ def trace_dispatch(self, frame, event, arg):
return self.dispatch_exception(frame, arg)
print 'bdb.Bdb.dispatch: unknown debugging event:', `event`
return self.trace_dispatch

def dispatch_line(self, frame):
if self.stop_here(frame) or self.break_here(frame):
self.user_line(frame)
if self.quitting: raise BdbQuit
return self.trace_dispatch

def dispatch_call(self, frame, arg):
# XXX 'arg' is no longer used
if self.botframe is None:
Expand All @@ -67,22 +67,22 @@ def dispatch_call(self, frame, arg):
self.user_call(frame, arg)
if self.quitting: raise BdbQuit
return self.trace_dispatch

def dispatch_return(self, frame, arg):
if self.stop_here(frame) or frame == self.returnframe:
self.user_return(frame, arg)
if self.quitting: raise BdbQuit

def dispatch_exception(self, frame, arg):
if self.stop_here(frame):
self.user_exception(frame, arg)
if self.quitting: raise BdbQuit
return self.trace_dispatch

# Normally derived classes don't override the following
# methods, but they may if they want to redefine the
# definition of stopping and breakpoints.

def stop_here(self, frame):
if self.stopframe is None:
return 1
Expand Down Expand Up @@ -110,53 +110,53 @@ def break_here(self, frame):
return 1
else:
return 0

def break_anywhere(self, frame):
return self.breaks.has_key(
self.canonic(frame.f_code.co_filename))

# Derived classes should override the user_* methods
# to gain control.

def user_call(self, frame, argument_list):
"""This method is called when there is the remote possibility
that we ever need to stop in this function."""
pass

def user_line(self, frame):
"""This method is called when we stop or break at this line."""
pass

def user_return(self, frame, return_value):
"""This method is called when a return trap is set here."""
pass

def user_exception(self, frame, (exc_type, exc_value, exc_traceback)):
"""This method is called if an exception occurs,
but only if we are to stop at or just below this level."""
pass

# Derived classes and clients can call the following methods
# to affect the stepping state.

def set_step(self):
"""Stop after one line of code."""
self.stopframe = None
self.returnframe = None
self.quitting = 0

def set_next(self, frame):
"""Stop on the next line in or below the given frame."""
self.stopframe = frame
self.returnframe = None
self.quitting = 0

def set_return(self, frame):
"""Stop when returning from the given frame."""
self.stopframe = frame.f_back
self.returnframe = frame
self.quitting = 0

def set_trace(self):
"""Start debugging from here."""
try:
Expand Down Expand Up @@ -186,20 +186,20 @@ def set_continue(self):
while frame and frame is not self.botframe:
del frame.f_trace
frame = frame.f_back

def set_quit(self):
self.stopframe = self.botframe
self.returnframe = None
self.quitting = 1
sys.settrace(None)

# Derived classes and clients can call the following methods
# to manipulate breakpoints. These methods return an
# error message is something went wrong, None if all is well.
# Set_break prints out the breakpoint line and file:lineno.
# Call self.get_*break*() to see the breakpoints or better
# for bp in Breakpoint.bpbynumber: if bp: bp.bpprint().

def set_break(self, filename, lineno, temporary=0, cond = None):
filename = self.canonic(filename)
import linecache # Import as late as possible
Expand Down Expand Up @@ -229,7 +229,7 @@ def clear_break(self, filename, lineno):
self.breaks[filename].remove(lineno)
if not self.breaks[filename]:
del self.breaks[filename]

def clear_bpbynumber(self, arg):
try:
number = int(arg)
Expand All @@ -252,39 +252,39 @@ def clear_all_file_breaks(self, filename):
for bp in blist:
bp.deleteMe()
del self.breaks[filename]

def clear_all_breaks(self):
if not self.breaks:
return 'There are no breakpoints'
for bp in Breakpoint.bpbynumber:
if bp:
bp.deleteMe()
self.breaks = {}

def get_break(self, filename, lineno):
filename = self.canonic(filename)
return self.breaks.has_key(filename) and \
lineno in self.breaks[filename]

def get_breaks(self, filename, lineno):
filename = self.canonic(filename)
return self.breaks.has_key(filename) and \
lineno in self.breaks[filename] and \
Breakpoint.bplist[filename, lineno] or []

def get_file_breaks(self, filename):
filename = self.canonic(filename)
if self.breaks.has_key(filename):
return self.breaks[filename]
else:
return []

def get_all_breaks(self):
return self.breaks

# Derived classes and clients can call the following method
# to get a data structure representing a stack trace.

def get_stack(self, f, t):
stack = []
if t and t.tb_frame is f:
Expand All @@ -300,9 +300,9 @@ def get_stack(self, f, t):
stack.append((t.tb_frame, t.tb_lineno))
t = t.tb_next
return stack, i
#

#

def format_stack_entry(self, frame_lineno, lprefix=': '):
import linecache, repr, string
frame, lineno = frame_lineno
Expand All @@ -327,10 +327,10 @@ def format_stack_entry(self, frame_lineno, lprefix=': '):
line = linecache.getline(filename, lineno)
if line: s = s + lprefix + string.strip(line)
return s

# The following two methods can be called by clients to use
# a debugger to debug a statement, given as a string.

def run(self, cmd, globals=None, locals=None):
if globals is None:
import __main__
Expand All @@ -349,7 +349,7 @@ def run(self, cmd, globals=None, locals=None):
finally:
self.quitting = 1
sys.settrace(None)

def runeval(self, expr, globals=None, locals=None):
if globals is None:
import __main__
Expand Down Expand Up @@ -435,7 +435,7 @@ def __init__(self, file, line, temporary=0, cond = None):
else:
self.bplist[file, line] = [self]


def deleteMe(self):
index = (self.file, self.line)
self.bpbynumber[self.number] = None # No longer in list
Expand All @@ -452,13 +452,13 @@ def disable(self):

def bpprint(self):
if self.temporary:
disp = 'del '
disp = 'del '
else:
disp = 'keep '
disp = 'keep '
if self.enabled:
disp = disp + 'yes'
disp = disp + 'yes'
else:
disp = disp + 'no '
disp = disp + 'no '
print '%-4dbreakpoint %s at %s:%d' % (self.number, disp,
self.file, self.line)
if self.cond:
Expand Down Expand Up @@ -506,7 +506,7 @@ def effective(file, line, frame):
# condition evaluates to true.
try:
val = eval(b.cond, frame.f_globals,
frame.f_locals)
frame.f_locals)
if val:
if b.ignore > 0:
b.ignore = b.ignore -1
Expand All @@ -518,7 +518,7 @@ def effective(file, line, frame):
except:
# if eval fails, most conservative
# thing is to stop on breakpoint
# regardless of ignore count.
# regardless of ignore count.
# Don't delete temporary,
# as another hint to user.
return (b,0)
Expand Down
Loading

0 comments on commit 11cf605

Please sign in to comment.