%PDF- %PDF-
| Direktori : /usr/lib/python3/dist-packages/xdg/__pycache__/ |
| Current File : //usr/lib/python3/dist-packages/xdg/__pycache__/Mime.cpython-312.pyc |
�
�u�c�f � �\ � d Z ddlZddlZddlZddlZddlZddlmZ ddlZddl m
Z
mZ ddlm
Z
dZi ZdZdadZdaej( d dk\ Zd� Zd3d �Z G d
� de� Z G d� d
e� Z G d� de� Z G d� d� Z G d� de� Z G d� d� Z G d� de� Z! edd� Z" edd� Z# edd� Z$ edd� Z% edd� Z& edd � Z' edd!� Z( edd"� Z) edd#� Z* edd$� Z+d%a,d&� Z-d'� Z.d(� Z/d4d)�Z0d4d*�Z1d+� Z2d5d,�Z3d6d-�Z4d.� Z5erd/� Z6nd0� Z6da7d%a8d1� Z9d2� Z:y)7a�
This module is based on a rox module (LGPL):
http://cvs.sourceforge.net/viewcvs.py/rox/ROX-Lib2/python/rox/mime.py?rev=1.21&view=log
This module provides access to the shared MIME database.
types is a dictionary of all known MIME types, indexed by the type name, e.g.
types['application/x-python']
Applications can install information about MIME types by storing an
XML file as <MIME>/packages/<application>.xml and running the
update-mime-database command, which is provided by the freedesktop.org
shared mime database package.
See http://www.freedesktop.org/standards/shared-mime-info-spec/ for
information about the format of these files.
(based on version 0.13)
� N)�
BaseDirectory)�minidom�
XML_NAMESPACE)�defaultdictz5http://www.freedesktop.org/standards/shared-mime-info� c � � dj | j D �cg c] }|j �� c}� j � S c c}w )zGet text of XML node� )�join�
childNodes� nodeValue�strip)�node�ns �*/usr/lib/python3/dist-packages/xdg/Mime.py�_get_node_datar - s0 � �
�7�7����9�A�A�K�K�9�:�@�@�B�B��9s �Ac � � t | |� S )z�Get the MIMEtype object for the given type.
This remains for backwards compatibility; calling MIMEtype now does
the same thing.
The name can either be passed as one part ('text/plain'), or as two
('text', 'plain').
)�MIMEtype��media�subtypes r �lookupr 1 s � � �E�7�#�#� c �T � � e Zd ZdZd� fd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Z� xZ
S )r z�Class holding data about a MIME type.
Calling the class will return a cached instance, so there is only one
instance for each MIME type. The name can either be passed as one part
('text/plain'), or as two ('text', 'plain').
c � �� |�d|v r|j dd� \ }}d|vsJ �|j � }|j � } t ||f S # t $ r5 t t
| � | � }|j ||� |t ||f<