/usr/lib/python2.7/dist-packages/mailutils/url.py is in python-mailutils 1:2.99.98-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | # GNU Mailutils -- a suite of utilities for electronic mail
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General
# Public License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
from mailutils.c_api import url
from mailutils import secret
from mailutils.error import *
class Url:
__owner = False
def __init__ (self, u):
if isinstance (u, url.UrlType):
self.url = u
else:
self.url = url.UrlType ()
self.__owner = True
status = url.create (self.url, u)
if status:
raise UrlError (status)
def __del__ (self):
if self.__owner:
url.destroy (self.url)
del self.url
def __str__ (self):
return url.to_string (self.url)
def get_port (self):
status, port = url.get_port (self.url)
if status:
raise UrlError (status)
return port
def get_scheme (self):
status, scheme = url.get_scheme (self.url)
if status == MU_ERR_NOENT:
return ''
elif status:
raise UrlError (status)
return scheme
def get_user (self):
status, user = url.get_user (self.url)
if status == MU_ERR_NOENT:
return ''
elif status:
raise UrlError (status)
return user
def get_secret (self):
status, sec = url.get_secret (self.url)
if status == MU_ERR_NOENT:
return secret.Secret ('')
elif status:
raise UrlError (status)
return secret.Secret (sec)
def get_auth (self):
status, auth = url.get_auth (self.url)
if status == MU_ERR_NOENT:
return ''
elif status:
raise UrlError (status)
return auth
def get_host (self):
status, host = url.get_host (self.url)
if status == MU_ERR_NOENT:
return ''
elif status:
raise UrlError (status)
return host
def get_path (self):
status, path = url.get_path (self.url)
if status == MU_ERR_NOENT:
return ''
elif status:
raise UrlError (status)
return path
def get_query (self):
status, query = url.get_query (self.url)
if status == MU_ERR_NOENT:
return ''
elif status:
raise UrlError (status)
return query
|