Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e2ad88c2
Commit
e2ad88c2
authored
Aug 12, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite normcase() using string.translate...
parent
efa68372
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
Lib/ntpath.py
Lib/ntpath.py
+6
-14
No files found.
Lib/ntpath.py
View file @
e2ad88c2
...
...
@@ -5,23 +5,15 @@ import stat
import
string
# Normalize the case of a pathname.
# On MS-DOS it maps the pathname to lowercase, turns slashes into
# backslashes.
# Other normalizations (such as optimizing '../' away) are not allowed
# Normalize the case of a pathname and map slashes to backslashes.
# Other normalizations (such as optimizing '../' away) are not done
# (this is done by normpath).
# Previously, this version mapped invalid consecutive characters to a
# single '_', but this has been removed. This functionality should
# possibly be added as a new function.
_normtable
=
string
.
maketrans
(
string
.
uppercase
+
"
\
\
/"
,
string
.
lowercase
+
os
.
sep
*
2
)
def
normcase
(
s
):
res
,
s
=
splitdrive
(
s
)
for
c
in
s
:
if
c
in
'/
\
\
'
:
res
=
res
+
os
.
sep
else
:
res
=
res
+
c
return
string
.
lower
(
res
)
return
string
.
translate
(
s
,
_normtable
)
# Return wheter a path is absolute.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment