Message327323
How about adding basic "mime_type" method to "pathlib.Path" ?
Code would do something like:
import mimetypes
def mime_type(name):
"""Mime-type of the file."""
find = name.rfind('.')
ext = '' if find == -1 else name[find:]
return mimetypes.types_map.get(ext, 'application/octet-stream')
Users would use it like so:
import pathlib
file = pathlib.Path('hello_world.py')
print(file.mime_type) # 'text/x-python' |
|
Date |
User |
Action |
Args |
2018-10-08 06:07:24 | YoSTEALTH | set | recipients:
+ YoSTEALTH |
2018-10-08 06:07:24 | YoSTEALTH | set | messageid: <1538978844.01.0.545547206417.issue34926@psf.upfronthosting.co.za> |
2018-10-08 06:07:23 | YoSTEALTH | link | issue34926 messages |
2018-10-08 06:07:23 | YoSTEALTH | create | |
|