Skip to content

Commit 25d7caf

Browse files
committed
posix -> os
1 parent 3bc034b commit 25d7caf

10 files changed

Lines changed: 35 additions & 35 deletions

File tree

Lib/cmp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
# - We keep a cache of outcomes of earlier comparisons
99
# - We don't fork a process to run 'cmp' but read the files ourselves
1010

11-
import posix
11+
import os
1212

1313
cache = {}
1414

1515
def cmp(f1, f2): # Compare two files, use the cache if possible.
1616
# Return 1 for identical files, 0 for different.
1717
# Raise exceptions if either file could not be statted, read, etc.
18-
s1, s2 = sig(posix.stat(f1)), sig(posix.stat(f2))
18+
s1, s2 = sig(os.stat(f1)), sig(os.stat(f2))
1919
if s1[0] <> 8 or s2[0] <> 8:
2020
# Either is a not a plain file -- always report as different
2121
return 0

Lib/cmpcache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# - We keep a cache of outcomes of earlier comparisons
1010
# - We don't fork a process to run 'cmp' but read the files ourselves
1111

12-
import posix
12+
import os
1313
from stat import *
1414
import statcache
1515

@@ -20,7 +20,7 @@
2020

2121

2222
# Compare two files, use the cache if possible.
23-
# May raise posix.error if a stat or open of either fails.
23+
# May raise os.error if a stat or open of either fails.
2424
#
2525
def cmp(f1, f2):
2626
# Return 1 for identical files, 0 for different.

Lib/irix5/flp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Jack Jansen, December 1991
55
#
66
import string
7-
import path
7+
import os
88
import sys
99
import FL
1010

@@ -106,11 +106,11 @@ def wrlong(fp, x):
106106
fp.write(chr(a) + chr(b) + chr(c) + chr(d))
107107

108108
def getmtime(filename):
109-
import posix
109+
import os
110110
from stat import ST_MTIME
111111
try:
112-
return posix.stat(filename)[ST_MTIME]
113-
except posix.error:
112+
return os.stat(filename)[ST_MTIME]
113+
except os.error:
114114
return None
115115

116116
#
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
157157
fp = None
158158
else:
159159
for pc in sys.path:
160-
pn = path.join(pc, filename)
160+
pn = os.path.join(pc, filename)
161161
try:
162162
fp = open(pn, 'r')
163163
filename = pn

Lib/lib-stdwin/anywin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
import dirwin
55
import filewin
6-
import path
6+
import os
77

88
def open(name):
99
print 'opening', name, '...'
10-
if path.isdir(name):
10+
if os.path.isdir(name):
1111
w = dirwin.open(name)
1212
else:
1313
w = filewin.open(name)

Lib/lib-stdwin/dirwin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22

33
# Directory windows, a subclass of listwin
44

5+
import os
56
import gwin
67
import listwin
78
import anywin
8-
import path
99
import dircache
1010

1111
def action(w, string, i, detail):
1212
(h, v), clicks, button, mask = detail
1313
if clicks == 2:
14-
name = path.join(w.name, string)
14+
name = os.path.join(w.name, string)
1515
try:
1616
w2 = anywin.open(name)
1717
w2.parent = w
18-
except posix.error, why:
18+
except os.error, why:
1919
stdwin.message('Can\'t open ' + name + ': ' + why[1])
2020

2121
def open(name):
22-
name = path.join(name, '')
22+
name = os.path.join(name, '')
2323
list = dircache.opendir(name)[:]
2424
list.sort()
2525
dircache.annotate(name, list)

Lib/persist.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232

3333
def save():
3434
import __main__
35-
import posix
35+
import os
3636
# XXX On SYSV, if len(defaultfile) >= 14, this is wrong!
3737
backup = defaultfile + '~'
3838
try:
39-
posix.unlink(backup)
40-
except posix.error:
39+
os.unlink(backup)
40+
except os.error:
4141
pass
4242
try:
43-
posix.rename(defaultfile, backup)
44-
except posix.error:
43+
os.rename(defaultfile, backup)
44+
except os.error:
4545
pass
4646
fp = open(defaultfile, 'w')
4747
writedict(__main__.__dict__, fp)

Lib/plat-irix5/flp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Jack Jansen, December 1991
55
#
66
import string
7-
import path
7+
import os
88
import sys
99
import FL
1010

@@ -106,11 +106,11 @@ def wrlong(fp, x):
106106
fp.write(chr(a) + chr(b) + chr(c) + chr(d))
107107

108108
def getmtime(filename):
109-
import posix
109+
import os
110110
from stat import ST_MTIME
111111
try:
112-
return posix.stat(filename)[ST_MTIME]
113-
except posix.error:
112+
return os.stat(filename)[ST_MTIME]
113+
except os.error:
114114
return None
115115

116116
#
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
157157
fp = None
158158
else:
159159
for pc in sys.path:
160-
pn = path.join(pc, filename)
160+
pn = os.path.join(pc, filename)
161161
try:
162162
fp = open(pn, 'r')
163163
filename = pn

Lib/statcache.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Maintain a cache of file stats.
44
# There are functions to reset the cache or to selectively remove items.
55

6-
import posix
6+
import os
77
from stat import *
88

99
# The cache.
10-
# Keys are pathnames, values are `posix.stat' outcomes.
10+
# Keys are pathnames, values are `os.stat' outcomes.
1111
#
1212
cache = {}
1313

@@ -17,7 +17,7 @@
1717
def stat(path):
1818
if cache.has_key(path):
1919
return cache[path]
20-
cache[path] = ret = posix.stat(path)
20+
cache[path] = ret = os.stat(path)
2121
return ret
2222

2323

@@ -81,6 +81,6 @@ def forget_except_prefix(prefix):
8181
def isdir(path):
8282
try:
8383
st = stat(path)
84-
except posix.error:
84+
except os.error:
8585
return 0
8686
return S_ISDIR(st[ST_MODE])

Lib/stdwin/anywin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
import dirwin
55
import filewin
6-
import path
6+
import os
77

88
def open(name):
99
print 'opening', name, '...'
10-
if path.isdir(name):
10+
if os.path.isdir(name):
1111
w = dirwin.open(name)
1212
else:
1313
w = filewin.open(name)

Lib/stdwin/dirwin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22

33
# Directory windows, a subclass of listwin
44

5+
import os
56
import gwin
67
import listwin
78
import anywin
8-
import path
99
import dircache
1010

1111
def action(w, string, i, detail):
1212
(h, v), clicks, button, mask = detail
1313
if clicks == 2:
14-
name = path.join(w.name, string)
14+
name = os.path.join(w.name, string)
1515
try:
1616
w2 = anywin.open(name)
1717
w2.parent = w
18-
except posix.error, why:
18+
except os.error, why:
1919
stdwin.message('Can\'t open ' + name + ': ' + why[1])
2020

2121
def open(name):
22-
name = path.join(name, '')
22+
name = os.path.join(name, '')
2323
list = dircache.opendir(name)[:]
2424
list.sort()
2525
dircache.annotate(name, list)

0 commit comments

Comments
 (0)