Author YoSTEALTH
Recipients YoSTEALTH
Date 2018-10-08.06:07:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538978844.01.0.545547206417.issue34926@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2018-10-08 06:07:24YoSTEALTHsetrecipients: + YoSTEALTH
2018-10-08 06:07:24YoSTEALTHsetmessageid: <1538978844.01.0.545547206417.issue34926@psf.upfronthosting.co.za>
2018-10-08 06:07:23YoSTEALTHlinkissue34926 messages
2018-10-08 06:07:23YoSTEALTHcreate