summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-04-17 08:48:32 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-04-17 08:48:32 (GMT)
commit9d72bb452bced3a100f07f8a9e30c4495a9ec41a (patch)
treec39762a764fcc16f2cfc42e2504e58ff31e159e6 /Lib/logging
parentff11334927ee616d765b54a3851016b76a20bcec (diff)
downloadcpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.zip
cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.gz
cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.bz2
Remove functions in string module that are also string methods. Also remove:
* all calls to functions in the string module (except maketrans) * everything from stropmodule except for maketrans() which is still used
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py12
-rw-r--r--Lib/logging/config.py24
-rw-r--r--Lib/logging/handlers.py12
3 files changed, 24 insertions, 24 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 7ff9f25..4eb0392 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -26,7 +26,7 @@ Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
-import sys, os, types, time, string, cStringIO, traceback
+import sys, os, types, time, cStringIO, traceback
try:
import codecs
@@ -54,7 +54,7 @@ __date__ = "16 February 2007"
#
if hasattr(sys, 'frozen'): #support for py2exe
_srcfile = "logging%s__init__%s" % (os.sep, __file__[-4:])
-elif string.lower(__file__[-4:]) in ['.pyc', '.pyo']:
+elif __file__[-4:].lower() in ['.pyc', '.pyo']:
_srcfile = __file__[:-4] + '.py'
else:
_srcfile = __file__
@@ -416,7 +416,7 @@ class Formatter:
formatException() and appended to the message.
"""
record.message = record.getMessage()
- if string.find(self._fmt,"%(asctime)") >= 0:
+ if self._fmt.find("%(asctime)") >= 0:
record.asctime = self.formatTime(record, self.datefmt)
s = self._fmt % record.__dict__
if record.exc_info:
@@ -510,7 +510,7 @@ class Filter:
return 1
elif self.name == record.name:
return 1
- elif string.find(record.name, self.name, 0, self.nlen) != 0:
+ elif record.name.find(self.name, 0, self.nlen) != 0:
return 0
return (record.name[self.nlen] == ".")
@@ -896,7 +896,7 @@ class Manager:
from the specified logger to the root of the logger hierarchy.
"""
name = alogger.name
- i = string.rfind(name, ".")
+ i = name.rfind(".")
rv = None
while (i > 0) and not rv:
substr = name[:i]
@@ -909,7 +909,7 @@ class Manager:
else:
assert isinstance(obj, PlaceHolder)
obj.append(alogger)
- i = string.rfind(name, ".", 0, i - 1)
+ i = name.rfind(".", 0, i - 1)
if not rv:
rv = self.root
alogger.parent = rv
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 2888e5e..8b28153 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -27,7 +27,7 @@ Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
-import sys, logging, logging.handlers, string, socket, struct, os, traceback, types
+import sys, logging, logging.handlers, socket, struct, os, traceback, types
try:
import thread
@@ -89,7 +89,7 @@ def fileConfig(fname, defaults=None):
def _resolve(name):
"""Resolve a dotted name to a global object."""
- name = string.split(name, '.')
+ name = name.split('.')
used = name.pop(0)
found = __import__(used)
for n in name:
@@ -107,10 +107,10 @@ def _create_formatters(cp):
flist = cp.get("formatters", "keys")
if not len(flist):
return {}
- flist = string.split(flist, ",")
+ flist = flist.split(",")
formatters = {}
for form in flist:
- sectname = "formatter_%s" % string.strip(form)
+ sectname = "formatter_%s" % form.strip()
opts = cp.options(sectname)
if "format" in opts:
fs = cp.get(sectname, "format", 1)
@@ -135,11 +135,11 @@ def _install_handlers(cp, formatters):
hlist = cp.get("handlers", "keys")
if not len(hlist):
return {}
- hlist = string.split(hlist, ",")
+ hlist = hlist.split(",")
handlers = {}
fixups = [] #for inter-handler references
for hand in hlist:
- sectname = "handler_%s" % string.strip(hand)
+ sectname = "handler_%s" % hand.strip()
klass = cp.get(sectname, "class")
opts = cp.options(sectname)
if "formatter" in opts:
@@ -175,8 +175,8 @@ def _install_loggers(cp, handlers):
# configure the root first
llist = cp.get("loggers", "keys")
- llist = string.split(llist, ",")
- llist = map(lambda x: string.strip(x), llist)
+ llist = llist.split(",")
+ llist = map(lambda x: x.strip(), llist)
llist.remove("root")
sectname = "logger_root"
root = logging.root
@@ -189,9 +189,9 @@ def _install_loggers(cp, handlers):
root.removeHandler(h)
hlist = cp.get(sectname, "handlers")
if len(hlist):
- hlist = string.split(hlist, ",")
+ hlist = hlist.split(",")
for hand in hlist:
- log.addHandler(handlers[string.strip(hand)])
+ log.addHandler(handlers[hand.strip()])
#and now the others...
#we don't want to lose the existing loggers,
@@ -224,9 +224,9 @@ def _install_loggers(cp, handlers):
logger.disabled = 0
hlist = cp.get(sectname, "handlers")
if len(hlist):
- hlist = string.split(hlist, ",")
+ hlist = hlist.split(",")
for hand in hlist:
- logger.addHandler(handlers[string.strip(hand)])
+ logger.addHandler(handlers[hand.strip()])
#Disable any old loggers. There's no point deleting
#them as other threads may continue to hold references
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 687ecfe..83bf3e3 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -27,7 +27,7 @@ Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
-import sys, logging, socket, types, os, string, struct, time, glob
+import sys, logging, socket, types, os, struct, time, glob
try:
import cPickle as pickle
except ImportError:
@@ -162,7 +162,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
"""
def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None):
BaseRotatingHandler.__init__(self, filename, 'a', encoding)
- self.when = string.upper(when)
+ self.when = when.upper()
self.backupCount = backupCount
# Calculate the real rollover interval, which is just the number of
# seconds between rollovers. Also set the filename suffix used when
@@ -792,7 +792,7 @@ class SMTPHandler(logging.Handler):
msg = self.format(record)
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % (
self.fromaddr,
- string.join(self.toaddrs, ","),
+ ",".join(self.toaddrs),
self.getSubject(record),
formatdate(), msg)
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
@@ -913,7 +913,7 @@ class HTTPHandler(logging.Handler):
("GET" or "POST")
"""
logging.Handler.__init__(self)
- method = string.upper(method)
+ method = method.upper()
if method not in ["GET", "POST"]:
raise ValueError, "method must be GET or POST"
self.host = host
@@ -941,7 +941,7 @@ class HTTPHandler(logging.Handler):
url = self.url
data = urllib.urlencode(self.mapLogRecord(record))
if self.method == "GET":
- if (string.find(url, '?') >= 0):
+ if (url.find('?') >= 0):
sep = '&'
else:
sep = '?'
@@ -949,7 +949,7 @@ class HTTPHandler(logging.Handler):
h.putrequest(self.method, url)
# support multiple hosts on one IP address...
# need to strip optional :port from host, if present
- i = string.find(host, ":")
+ i = host.find(":")
if i >= 0:
host = host[:i]
h.putheader("Host", host)