summaryrefslogtreecommitdiffstats
path: root/Lib/macpath.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-09-28 16:25:20 (GMT)
committerFred Drake <fdrake@acm.org>2000-09-28 16:25:20 (GMT)
commitb4e460ac4b5a5b7e72b0eb6e8d21af179464c3d7 (patch)
treec582fec9b733998162730cf8a9ad21e9703359e3 /Lib/macpath.py
parentc0ab93ef6fc686829b9c123ceb353f78ee5016bb (diff)
downloadcpython-b4e460ac4b5a5b7e72b0eb6e8d21af179464c3d7.zip
cpython-b4e460ac4b5a5b7e72b0eb6e8d21af179464c3d7.tar.gz
cpython-b4e460ac4b5a5b7e72b0eb6e8d21af179464c3d7.tar.bz2
Avoid import of string module; it is only needed for expandvars().
Never assume that os.sep is for the module-specific platform; use the right separator character directly. Fix some minor style consistency nits.
Diffstat (limited to 'Lib/macpath.py')
-rw-r--r--Lib/macpath.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/macpath.py b/Lib/macpath.py
index 15f42f2..12eec0c 100644
--- a/Lib/macpath.py
+++ b/Lib/macpath.py
@@ -1,13 +1,13 @@
"""Pathname and path-related operations for the Macintosh."""
-import string
import os
from stat import *
-# Normalize the case of a pathname. Dummy in Posix, but string.lower here.
+# Normalize the case of a pathname. Dummy in Posix, but <s>.lower() here.
-normcase = string.lower
+def normcase(path):
+ return path.lower()
def isabs(s):
@@ -44,7 +44,7 @@ def split(s):
if ':' not in s: return '', s
colon = 0
for i in range(len(s)):
- if s[i] == ':': colon = i+1
+ if s[i] == ':': colon = i + 1
path, file = s[:colon-1], s[colon:]
if path and not ':' in path:
path = path + ':'
@@ -175,20 +175,20 @@ def normpath(s):
if ":" not in s:
return ":"+s
- comps = string.splitfields(s, ":")
+ comps = s.split(":")
i = 1
while i < len(comps)-1:
if comps[i] == "" and comps[i-1] != "":
if i > 1:
del comps[i-1:i+1]
- i = i-1
+ i = i - 1
else:
# best way to handle this is to raise an exception
raise norm_error, 'Cannot use :: immedeately after volume name'
else:
i = i + 1
- s = string.join(comps, ":")
+ s = ":".join(comps)
# remove trailing ":" except for ":" and "Volume:"
if s[-1] == ":" and len(comps) > 2 and s != ":"*len(s):