Added docstrings.

This commit is contained in:
Jeremy Fincher 2003-10-04 12:53:09 +00:00
parent 6bd138c4eb
commit 6ad95c52a2

View File

@ -29,16 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
"""
Module for general worldly stuff, like global variables and whatnot.
"""
from fix import * from fix import *
import os import os
import gc import gc
import time import time
import copy
import types import types
import string
import atexit import atexit
import linecache
try: try:
import msvcrt import msvcrt
except ImportError: except ImportError:
@ -66,6 +67,7 @@ except NameError:
flushers = [] # A periodic function will flush all these. flushers = [] # A periodic function will flush all these.
def flush(): def flush():
"""Flushes all the registered flushers."""
for f in flushers: for f in flushers:
f() f()
@ -77,6 +79,7 @@ except NameError:
def upkeep(): # Function to be run on occasion to do upkeep stuff. def upkeep(): # Function to be run on occasion to do upkeep stuff.
"""Does upkeep (like flushing, garbage collection, etc.)"""
collected = gc.collect() collected = gc.collect()
if os.name == 'nt': if os.name == 'nt':
msvcrt.heapmin() msvcrt.heapmin()
@ -165,11 +168,11 @@ try:
except NameError: except NameError:
oldobjects = {} oldobjects = {}
def superReload(module): def superReload(module):
"""Reloads a module hardcore. But kinda broken -- don't use it."""
def updateFunction(old, new, attrs): def updateFunction(old, new, attrs):
"""Update all attrs in old to the same attrs in new.""" """Update all attrs in old to the same attrs in new."""
for name in attrs: for name in attrs:
setattr(old, name, getattr(new, name)) setattr(old, name, getattr(new, name))
for (name, object) in module.__dict__.iteritems(): for (name, object) in module.__dict__.iteritems():
# For every attribute of the old module, keep the object. # For every attribute of the old module, keep the object.
key = (module.__name__, name) key = (module.__name__, name)