Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
1417084b
...
1417084b72f9a2eb6547b65982e314e07fd9b012
authored
2010-10-17 10:48:30 +0200
by
Wojciech Polak
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Minor PEP 8 changes in Python API.
1 parent
cea1ebcb
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
27 additions
and
28 deletions
python/mailutils/__init__.py
python/mailutils/address.py
python/mailutils/auth.py
python/mailutils/debug.py
python/mailutils/filter.py
python/mailutils/folder.py
python/mailutils/header.py
python/mailutils/mailbox.py
python/mailutils/mailer.py
python/mailutils/message.py
python/mailutils/mime.py
python/mailutils/registrar.py
python/mailutils/stream.py
python/mailutils/util.py
python/mailutils/__init__.py
View file @
1417084
...
...
@@ -33,10 +33,9 @@ is licensed using the GNU GPL.
See http://www.gnu.org/software/mailutils/ for more information about
GNU Mailutils.
"""
__all__
=
[
__all__
=
(
"error"
,
"address"
,
"attribute"
,
...
...
@@ -59,4 +58,4 @@ __all__ = [
"stream"
,
"url"
,
"util"
,
]
)
...
...
python/mailutils/address.py
View file @
1417084
python/mailutils/auth.py
View file @
1417084
...
...
@@ -21,7 +21,7 @@ from mailutils.error import AuthError
MU_AF_QUOTA
=
0x1
def
register_module
(
name
=
None
):
def
register_module
(
name
=
None
):
if
name
==
None
:
status
=
auth
.
register_module
()
elif
isinstance
(
name
,
types
.
TupleType
)
\
...
...
@@ -51,7 +51,7 @@ def set_pam_service (pam_service):
class
Authority
:
__owner
=
False
def
__init__
(
self
,
authority
=
None
):
def
__init__
(
self
,
authority
=
None
):
if
isinstance
(
authority
,
auth
.
AuthorityType
):
self
.
authority
=
authority
else
:
...
...
@@ -85,7 +85,7 @@ class Authority:
class
Ticket
:
__owner
=
False
def
__init__
(
self
,
ticket
=
None
):
def
__init__
(
self
,
ticket
=
None
):
if
isinstance
(
ticket
,
auth
.
TicketType
):
self
.
ticket
=
ticket
else
:
...
...
@@ -108,7 +108,7 @@ class Ticket:
class
Wicket
:
__owner
=
False
def
__init__
(
self
,
wicket
=
None
):
def
__init__
(
self
,
wicket
=
None
):
if
isinstance
(
wicket
,
auth
.
WicketType
):
self
.
wicket
=
wicket
else
:
...
...
python/mailutils/debug.py
View file @
1417084
...
...
@@ -37,7 +37,7 @@ class Debug:
def
__del__
(
self
):
del
self
.
dbg
def
set_level
(
self
,
level
=
MU_DEBUG_PROT
):
def
set_level
(
self
,
level
=
MU_DEBUG_PROT
):
status
=
debug
.
set_level
(
self
.
dbg
,
level
)
if
status
:
raise
DebugError
(
status
)
...
...
python/mailutils/filter.py
View file @
1417084
...
...
@@ -29,8 +29,8 @@ MU_FILTER_WRITE = MU_STREAM_WRITE
MU_FILTER_RDWR
=
MU_STREAM_RDWR
class
FilterStream
(
Stream
):
def
__init__
(
self
,
transport
,
name
,
type
=
MU_FILTER_DECODE
,
direction
=
MU_FILTER_READ
):
def
__init__
(
self
,
transport
,
name
,
type
=
MU_FILTER_DECODE
,
direction
=
MU_FILTER_READ
):
Stream
.
__init__
(
self
)
status
=
filter
.
create
(
self
.
stm
,
transport
.
stm
,
name
,
type
,
direction
)
...
...
python/mailutils/folder.py
View file @
1417084
...
...
@@ -77,7 +77,7 @@ class Folder:
raise
FolderError
(
status
)
return
url
.
Url
(
u
)
def
list
(
self
,
dirname
,
pattern
,
max_level
=
0
):
def
list
(
self
,
dirname
,
pattern
,
max_level
=
0
):
status
,
lst
=
folder
.
list
(
self
.
folder
,
dirname
,
pattern
,
max_level
)
if
status
:
raise
FolderError
(
status
)
...
...
python/mailutils/header.py
View file @
1417084
...
...
@@ -82,7 +82,7 @@ class Header:
raise
HeaderError
(
status
)
return
lines
def
get_value
(
self
,
name
,
default
=
None
):
def
get_value
(
self
,
name
,
default
=
None
):
status
,
value
=
header
.
get_value
(
self
.
hdr
,
name
)
if
status
==
MU_ERR_NOENT
:
if
default
!=
None
:
...
...
@@ -93,7 +93,7 @@ class Header:
raise
HeaderError
(
status
)
return
value
def
get_value_n
(
self
,
name
,
n
=
1
,
default
=
None
):
def
get_value_n
(
self
,
name
,
n
=
1
,
default
=
None
):
status
,
value
=
header
.
get_value_n
(
self
.
hdr
,
name
,
n
)
if
status
==
MU_ERR_NOENT
:
if
default
!=
None
:
...
...
@@ -104,7 +104,7 @@ class Header:
raise
HeaderError
(
status
)
return
value
def
set_value
(
self
,
name
,
value
,
replace
=
True
):
def
set_value
(
self
,
name
,
value
,
replace
=
True
):
status
=
header
.
set_value
(
self
.
hdr
,
name
,
value
,
replace
)
if
status
:
raise
HeaderError
(
status
)
...
...
python/mailutils/mailbox.py
View file @
1417084
...
...
@@ -24,7 +24,7 @@ from mailutils import debug
from
mailutils.error
import
MailboxError
class
MailboxBase
:
def
open
(
self
,
mode
=
0
):
def
open
(
self
,
mode
=
0
):
"""Open the connection.
'mode' may be a string, consisting of the characters described
...
...
@@ -65,7 +65,7 @@ class MailboxBase:
if
status
:
raise
MailboxError
(
status
)
def
flush
(
self
,
expunge
=
False
):
def
flush
(
self
,
expunge
=
False
):
"""Flush the mailbox."""
status
=
mailbox
.
flush
(
self
.
mbox
,
expunge
)
if
status
:
...
...
@@ -216,7 +216,7 @@ class Mailbox (MailboxBase):
del
self
.
mbox
class
MailboxDefault
(
MailboxBase
):
def
__init__
(
self
,
name
=
None
):
def
__init__
(
self
,
name
=
None
):
"""MailboxDefault creates a Mailbox object for the supplied
mailbox 'name'. Before creating, the name is expanded using
the rules below:
...
...
python/mailutils/mailer.py
View file @
1417084
...
...
@@ -37,7 +37,7 @@ class Mailer:
else
:
raise
AttributeError
,
name
def
open
(
self
,
flags
=
0
):
def
open
(
self
,
flags
=
0
):
status
=
mailer
.
open
(
self
.
mlr
,
flags
)
if
status
:
raise
MailerError
(
status
)
...
...
python/mailutils/message.py
View file @
1417084
...
...
@@ -25,7 +25,7 @@ from mailutils.error import MessageError
class
Message
:
__owner
=
False
def
__init__
(
self
,
msg
=
None
):
def
__init__
(
self
,
msg
=
None
):
if
msg
==
None
:
self
.
msg
=
message
.
MessageType
()
self
.
__owner
=
True
...
...
@@ -141,7 +141,7 @@ class Message:
raise
MessageError
(
status
)
return
name
,
lang
def
save_attachment
(
self
,
filename
=
''
):
def
save_attachment
(
self
,
filename
=
''
):
status
=
message
.
save_attachment
(
self
.
msg
,
filename
)
if
status
:
raise
MessageError
(
status
)
...
...
python/mailutils/mime.py
View file @
1417084
...
...
@@ -23,7 +23,7 @@ MU_MIME_MULTIPART_MIXED = 0x1
MU_MIME_MULTIPART_ALT
=
0x2
class
Mime
:
def
__init__
(
self
,
msg
,
flags
=
0
):
def
__init__
(
self
,
msg
,
flags
=
0
):
self
.
mime
=
mime
.
MimeType
()
status
=
mime
.
create
(
self
.
mime
,
msg
.
msg
,
flags
)
if
status
:
...
...
python/mailutils/registrar.py
View file @
1417084
...
...
@@ -18,7 +18,7 @@
import
types
from
mailutils.c_api
import
registrar
def
register_format
(
name
=
None
):
def
register_format
(
name
=
None
):
"""Register desired mailutils 'name' format.
A list or tuple of strings can be given.
...
...
python/mailutils/stream.py
View file @
1417084
...
...
@@ -43,7 +43,7 @@ MU_STDERR_FD = 2
class
Stream
:
__refcount
=
0
def
__init__
(
self
,
stm
=
None
):
def
__init__
(
self
,
stm
=
None
):
if
isinstance
(
stm
,
stream
.
StreamType
):
self
.
stm
=
stm
else
:
...
...
@@ -104,14 +104,14 @@ class Stream:
return
rbuf
class
TcpStream
(
Stream
):
def
__init__
(
self
,
host
,
port
,
flags
=
MU_STREAM_READ
):
def
__init__
(
self
,
host
,
port
,
flags
=
MU_STREAM_READ
):
Stream
.
__init__
(
self
)
status
=
stream
.
tcp_stream_create
(
self
.
stm
,
host
,
port
,
flags
)
if
status
:
raise
StreamError
(
status
)
class
FileStream
(
Stream
):
def
__init__
(
self
,
filename
,
flags
=
MU_STREAM_READ
):
def
__init__
(
self
,
filename
,
flags
=
MU_STREAM_READ
):
Stream
.
__init__
(
self
)
status
=
stream
.
file_stream_create
(
self
.
stm
,
filename
,
flags
)
if
status
:
...
...
@@ -125,7 +125,7 @@ class StdioStream (Stream):
raise
StreamError
(
status
)
class
ProgStream
(
Stream
):
def
__init__
(
self
,
progname
,
flags
=
MU_STREAM_READ
):
def
__init__
(
self
,
progname
,
flags
=
MU_STREAM_READ
):
Stream
.
__init__
(
self
)
status
=
stream
.
prog_stream_create
(
self
.
stm
,
progname
,
flags
)
if
status
:
...
...
python/mailutils/util.py
View file @
1417084
...
...
@@ -17,7 +17,7 @@
from
mailutils.c_api
import
util
def
get_user_email
(
name
=
None
):
def
get_user_email
(
name
=
None
):
if
name
==
None
:
return
util
.
get_user_email
()
else
:
...
...
@@ -33,5 +33,5 @@ def get_user_email_domain ():
def
set_user_email_domain
(
domain
):
util
.
set_user_email_domain
(
domain
)
def
tempname
(
tmpdir
=
None
):
def
tempname
(
tmpdir
=
None
):
return
util
.
tempname
(
tmpdir
)
...
...
Please
register
or
sign in
to post a comment