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
36dd9cca
Commit
36dd9cca
authored
Oct 17, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The usual
parent
71171b26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
Lib/dos-8x3/mimetype.py
Lib/dos-8x3/mimetype.py
+21
-0
Lib/dos-8x3/py_compi.py
Lib/dos-8x3/py_compi.py
+1
-1
No files found.
Lib/dos-8x3/mimetype.py
View file @
36dd9cca
...
...
@@ -25,6 +25,7 @@ read_mime_types(file) -- parse one file, return a dictionary or None
import
string
import
posixpath
import
urllib
knownfiles
=
[
"/usr/local/etc/httpd/conf/mime.types"
,
...
...
@@ -53,6 +54,26 @@ def guess_type(url):
"""
if
not
inited
:
init
()
scheme
,
url
=
urllib
.
splittype
(
url
)
if
scheme
==
'data'
:
# syntax of data URLs:
# dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
# mediatype := [ type "/" subtype ] *( ";" parameter )
# data := *urlchar
# parameter := attribute "=" value
# type/subtype defaults to "text/plain"
comma
=
string
.
find
(
url
,
','
)
if
comma
<
0
:
# bad data URL
return
None
,
None
semi
=
string
.
find
(
url
,
';'
,
0
,
comma
)
if
semi
>=
0
:
type
=
url
[:
semi
]
else
:
type
=
url
[:
comma
]
if
'='
in
type
or
'/'
not
in
type
:
type
=
'text/plain'
return
type
,
None
# never compressed, so encoding is None
base
,
ext
=
posixpath
.
splitext
(
url
)
while
suffix_map
.
has_key
(
ext
):
base
,
ext
=
posixpath
.
splitext
(
base
+
suffix_map
[
ext
])
...
...
Lib/dos-8x3/py_compi.py
View file @
36dd9cca
...
...
@@ -44,7 +44,7 @@ def compile(file, cfile=None, dfile=None):
import
os
,
marshal
,
__builtin__
f
=
open
(
file
)
try
:
timestamp
=
os
.
fstat
(
file
.
fileno
()
)
timestamp
=
long
(
os
.
fstat
(
f
.
fileno
())[
8
]
)
except
AttributeError
:
timestamp
=
long
(
os
.
stat
(
file
)[
8
])
codestring
=
f
.
read
()
...
...
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