Minor PEP 8 changes in Python API.
Showing
14 changed files
with
27 additions
and
28 deletions
... | @@ -33,10 +33,9 @@ is licensed using the GNU GPL. | ... | @@ -33,10 +33,9 @@ is licensed using the GNU GPL. |
33 | 33 | ||
34 | See http://www.gnu.org/software/mailutils/ for more information about | 34 | See http://www.gnu.org/software/mailutils/ for more information about |
35 | GNU Mailutils. | 35 | GNU Mailutils. |
36 | |||
37 | """ | 36 | """ |
38 | 37 | ||
39 | __all__ = [ | 38 | __all__ = ( |
40 | "error", | 39 | "error", |
41 | "address", | 40 | "address", |
42 | "attribute", | 41 | "attribute", |
... | @@ -59,4 +58,4 @@ __all__ = [ | ... | @@ -59,4 +58,4 @@ __all__ = [ |
59 | "stream", | 58 | "stream", |
60 | "url", | 59 | "url", |
61 | "util", | 60 | "util", |
62 | ] | 61 | ) | ... | ... |
... | @@ -21,7 +21,7 @@ from mailutils.error import AuthError | ... | @@ -21,7 +21,7 @@ from mailutils.error import AuthError |
21 | 21 | ||
22 | MU_AF_QUOTA = 0x1 | 22 | MU_AF_QUOTA = 0x1 |
23 | 23 | ||
24 | def register_module (name = None): | 24 | def register_module (name=None): |
25 | if name == None: | 25 | if name == None: |
26 | status = auth.register_module () | 26 | status = auth.register_module () |
27 | elif isinstance (name, types.TupleType) \ | 27 | elif isinstance (name, types.TupleType) \ |
... | @@ -51,7 +51,7 @@ def set_pam_service (pam_service): | ... | @@ -51,7 +51,7 @@ def set_pam_service (pam_service): |
51 | class Authority: | 51 | class Authority: |
52 | __owner = False | 52 | __owner = False |
53 | 53 | ||
54 | def __init__ (self, authority = None): | 54 | def __init__ (self, authority=None): |
55 | if isinstance (authority, auth.AuthorityType): | 55 | if isinstance (authority, auth.AuthorityType): |
56 | self.authority = authority | 56 | self.authority = authority |
57 | else: | 57 | else: |
... | @@ -85,7 +85,7 @@ class Authority: | ... | @@ -85,7 +85,7 @@ class Authority: |
85 | class Ticket: | 85 | class Ticket: |
86 | __owner = False | 86 | __owner = False |
87 | 87 | ||
88 | def __init__ (self, ticket = None): | 88 | def __init__ (self, ticket=None): |
89 | if isinstance (ticket, auth.TicketType): | 89 | if isinstance (ticket, auth.TicketType): |
90 | self.ticket = ticket | 90 | self.ticket = ticket |
91 | else: | 91 | else: |
... | @@ -108,7 +108,7 @@ class Ticket: | ... | @@ -108,7 +108,7 @@ class Ticket: |
108 | class Wicket: | 108 | class Wicket: |
109 | __owner = False | 109 | __owner = False |
110 | 110 | ||
111 | def __init__ (self, wicket = None): | 111 | def __init__ (self, wicket=None): |
112 | if isinstance (wicket, auth.WicketType): | 112 | if isinstance (wicket, auth.WicketType): |
113 | self.wicket = wicket | 113 | self.wicket = wicket |
114 | else: | 114 | else: | ... | ... |
... | @@ -37,7 +37,7 @@ class Debug: | ... | @@ -37,7 +37,7 @@ class Debug: |
37 | def __del__ (self): | 37 | def __del__ (self): |
38 | del self.dbg | 38 | del self.dbg |
39 | 39 | ||
40 | def set_level (self, level = MU_DEBUG_PROT): | 40 | def set_level (self, level=MU_DEBUG_PROT): |
41 | status = debug.set_level (self.dbg, level) | 41 | status = debug.set_level (self.dbg, level) |
42 | if status: | 42 | if status: |
43 | raise DebugError (status) | 43 | raise DebugError (status) | ... | ... |
... | @@ -29,8 +29,8 @@ MU_FILTER_WRITE = MU_STREAM_WRITE | ... | @@ -29,8 +29,8 @@ MU_FILTER_WRITE = MU_STREAM_WRITE |
29 | MU_FILTER_RDWR = MU_STREAM_RDWR | 29 | MU_FILTER_RDWR = MU_STREAM_RDWR |
30 | 30 | ||
31 | class FilterStream (Stream): | 31 | class FilterStream (Stream): |
32 | def __init__ (self, transport, name, type = MU_FILTER_DECODE, | 32 | def __init__ (self, transport, name, type=MU_FILTER_DECODE, |
33 | direction = MU_FILTER_READ): | 33 | direction=MU_FILTER_READ): |
34 | Stream.__init__ (self) | 34 | Stream.__init__ (self) |
35 | status = filter.create (self.stm, transport.stm, name, | 35 | status = filter.create (self.stm, transport.stm, name, |
36 | type, direction) | 36 | type, direction) | ... | ... |
... | @@ -77,7 +77,7 @@ class Folder: | ... | @@ -77,7 +77,7 @@ class Folder: |
77 | raise FolderError (status) | 77 | raise FolderError (status) |
78 | return url.Url (u) | 78 | return url.Url (u) |
79 | 79 | ||
80 | def list (self, dirname, pattern, max_level = 0): | 80 | def list (self, dirname, pattern, max_level=0): |
81 | status, lst = folder.list (self.folder, dirname, pattern, max_level) | 81 | status, lst = folder.list (self.folder, dirname, pattern, max_level) |
82 | if status: | 82 | if status: |
83 | raise FolderError (status) | 83 | raise FolderError (status) | ... | ... |
... | @@ -82,7 +82,7 @@ class Header: | ... | @@ -82,7 +82,7 @@ class Header: |
82 | raise HeaderError (status) | 82 | raise HeaderError (status) |
83 | return lines | 83 | return lines |
84 | 84 | ||
85 | def get_value (self, name, default = None): | 85 | def get_value (self, name, default=None): |
86 | status, value = header.get_value (self.hdr, name) | 86 | status, value = header.get_value (self.hdr, name) |
87 | if status == MU_ERR_NOENT: | 87 | if status == MU_ERR_NOENT: |
88 | if default != None: | 88 | if default != None: |
... | @@ -93,7 +93,7 @@ class Header: | ... | @@ -93,7 +93,7 @@ class Header: |
93 | raise HeaderError (status) | 93 | raise HeaderError (status) |
94 | return value | 94 | return value |
95 | 95 | ||
96 | def get_value_n (self, name, n = 1, default = None): | 96 | def get_value_n (self, name, n=1, default=None): |
97 | status, value = header.get_value_n (self.hdr, name, n) | 97 | status, value = header.get_value_n (self.hdr, name, n) |
98 | if status == MU_ERR_NOENT: | 98 | if status == MU_ERR_NOENT: |
99 | if default != None: | 99 | if default != None: |
... | @@ -104,7 +104,7 @@ class Header: | ... | @@ -104,7 +104,7 @@ class Header: |
104 | raise HeaderError (status) | 104 | raise HeaderError (status) |
105 | return value | 105 | return value |
106 | 106 | ||
107 | def set_value (self, name, value, replace = True): | 107 | def set_value (self, name, value, replace=True): |
108 | status = header.set_value (self.hdr, name, value, replace) | 108 | status = header.set_value (self.hdr, name, value, replace) |
109 | if status: | 109 | if status: |
110 | raise HeaderError (status) | 110 | raise HeaderError (status) | ... | ... |
... | @@ -24,7 +24,7 @@ from mailutils import debug | ... | @@ -24,7 +24,7 @@ from mailutils import debug |
24 | from mailutils.error import MailboxError | 24 | from mailutils.error import MailboxError |
25 | 25 | ||
26 | class MailboxBase: | 26 | class MailboxBase: |
27 | def open (self, mode = 0): | 27 | def open (self, mode=0): |
28 | """Open the connection. | 28 | """Open the connection. |
29 | 29 | ||
30 | 'mode' may be a string, consisting of the characters described | 30 | 'mode' may be a string, consisting of the characters described |
... | @@ -65,7 +65,7 @@ class MailboxBase: | ... | @@ -65,7 +65,7 @@ class MailboxBase: |
65 | if status: | 65 | if status: |
66 | raise MailboxError (status) | 66 | raise MailboxError (status) |
67 | 67 | ||
68 | def flush (self, expunge = False): | 68 | def flush (self, expunge=False): |
69 | """Flush the mailbox.""" | 69 | """Flush the mailbox.""" |
70 | status = mailbox.flush (self.mbox, expunge) | 70 | status = mailbox.flush (self.mbox, expunge) |
71 | if status: | 71 | if status: |
... | @@ -216,7 +216,7 @@ class Mailbox (MailboxBase): | ... | @@ -216,7 +216,7 @@ class Mailbox (MailboxBase): |
216 | del self.mbox | 216 | del self.mbox |
217 | 217 | ||
218 | class MailboxDefault (MailboxBase): | 218 | class MailboxDefault (MailboxBase): |
219 | def __init__ (self, name = None): | 219 | def __init__ (self, name=None): |
220 | """MailboxDefault creates a Mailbox object for the supplied | 220 | """MailboxDefault creates a Mailbox object for the supplied |
221 | mailbox 'name'. Before creating, the name is expanded using | 221 | mailbox 'name'. Before creating, the name is expanded using |
222 | the rules below: | 222 | the rules below: | ... | ... |
... | @@ -37,7 +37,7 @@ class Mailer: | ... | @@ -37,7 +37,7 @@ class Mailer: |
37 | else: | 37 | else: |
38 | raise AttributeError, name | 38 | raise AttributeError, name |
39 | 39 | ||
40 | def open (self, flags = 0): | 40 | def open (self, flags=0): |
41 | status = mailer.open (self.mlr, flags) | 41 | status = mailer.open (self.mlr, flags) |
42 | if status: | 42 | if status: |
43 | raise MailerError (status) | 43 | raise MailerError (status) | ... | ... |
... | @@ -25,7 +25,7 @@ from mailutils.error import MessageError | ... | @@ -25,7 +25,7 @@ from mailutils.error import MessageError |
25 | class Message: | 25 | class Message: |
26 | __owner = False | 26 | __owner = False |
27 | 27 | ||
28 | def __init__ (self, msg = None): | 28 | def __init__ (self, msg=None): |
29 | if msg == None: | 29 | if msg == None: |
30 | self.msg = message.MessageType () | 30 | self.msg = message.MessageType () |
31 | self.__owner = True | 31 | self.__owner = True |
... | @@ -141,7 +141,7 @@ class Message: | ... | @@ -141,7 +141,7 @@ class Message: |
141 | raise MessageError (status) | 141 | raise MessageError (status) |
142 | return name, lang | 142 | return name, lang |
143 | 143 | ||
144 | def save_attachment (self, filename = ''): | 144 | def save_attachment (self, filename=''): |
145 | status = message.save_attachment (self.msg, filename) | 145 | status = message.save_attachment (self.msg, filename) |
146 | if status: | 146 | if status: |
147 | raise MessageError (status) | 147 | raise MessageError (status) | ... | ... |
... | @@ -23,7 +23,7 @@ MU_MIME_MULTIPART_MIXED = 0x1 | ... | @@ -23,7 +23,7 @@ MU_MIME_MULTIPART_MIXED = 0x1 |
23 | MU_MIME_MULTIPART_ALT = 0x2 | 23 | MU_MIME_MULTIPART_ALT = 0x2 |
24 | 24 | ||
25 | class Mime: | 25 | class Mime: |
26 | def __init__ (self, msg, flags = 0): | 26 | def __init__ (self, msg, flags=0): |
27 | self.mime = mime.MimeType () | 27 | self.mime = mime.MimeType () |
28 | status = mime.create (self.mime, msg.msg, flags) | 28 | status = mime.create (self.mime, msg.msg, flags) |
29 | if status: | 29 | if status: | ... | ... |
... | @@ -18,7 +18,7 @@ | ... | @@ -18,7 +18,7 @@ |
18 | import types | 18 | import types |
19 | from mailutils.c_api import registrar | 19 | from mailutils.c_api import registrar |
20 | 20 | ||
21 | def register_format (name = None): | 21 | def register_format (name=None): |
22 | """Register desired mailutils 'name' format. | 22 | """Register desired mailutils 'name' format. |
23 | 23 | ||
24 | A list or tuple of strings can be given. | 24 | A list or tuple of strings can be given. | ... | ... |
... | @@ -43,7 +43,7 @@ MU_STDERR_FD = 2 | ... | @@ -43,7 +43,7 @@ MU_STDERR_FD = 2 |
43 | class Stream: | 43 | class Stream: |
44 | __refcount = 0 | 44 | __refcount = 0 |
45 | 45 | ||
46 | def __init__ (self, stm = None): | 46 | def __init__ (self, stm=None): |
47 | if isinstance (stm, stream.StreamType): | 47 | if isinstance (stm, stream.StreamType): |
48 | self.stm = stm | 48 | self.stm = stm |
49 | else: | 49 | else: |
... | @@ -104,14 +104,14 @@ class Stream: | ... | @@ -104,14 +104,14 @@ class Stream: |
104 | return rbuf | 104 | return rbuf |
105 | 105 | ||
106 | class TcpStream (Stream): | 106 | class TcpStream (Stream): |
107 | def __init__ (self, host, port, flags = MU_STREAM_READ): | 107 | def __init__ (self, host, port, flags=MU_STREAM_READ): |
108 | Stream.__init__ (self) | 108 | Stream.__init__ (self) |
109 | status = stream.tcp_stream_create (self.stm, host, port, flags) | 109 | status = stream.tcp_stream_create (self.stm, host, port, flags) |
110 | if status: | 110 | if status: |
111 | raise StreamError (status) | 111 | raise StreamError (status) |
112 | 112 | ||
113 | class FileStream (Stream): | 113 | class FileStream (Stream): |
114 | def __init__ (self, filename, flags = MU_STREAM_READ): | 114 | def __init__ (self, filename, flags=MU_STREAM_READ): |
115 | Stream.__init__ (self) | 115 | Stream.__init__ (self) |
116 | status = stream.file_stream_create (self.stm, filename, flags) | 116 | status = stream.file_stream_create (self.stm, filename, flags) |
117 | if status: | 117 | if status: |
... | @@ -125,7 +125,7 @@ class StdioStream (Stream): | ... | @@ -125,7 +125,7 @@ class StdioStream (Stream): |
125 | raise StreamError (status) | 125 | raise StreamError (status) |
126 | 126 | ||
127 | class ProgStream (Stream): | 127 | class ProgStream (Stream): |
128 | def __init__ (self, progname, flags = MU_STREAM_READ): | 128 | def __init__ (self, progname, flags=MU_STREAM_READ): |
129 | Stream.__init__ (self) | 129 | Stream.__init__ (self) |
130 | status = stream.prog_stream_create (self.stm, progname, flags) | 130 | status = stream.prog_stream_create (self.stm, progname, flags) |
131 | if status: | 131 | if status: | ... | ... |
... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
17 | 17 | ||
18 | from mailutils.c_api import util | 18 | from mailutils.c_api import util |
19 | 19 | ||
20 | def get_user_email (name = None): | 20 | def get_user_email (name=None): |
21 | if name == None: | 21 | if name == None: |
22 | return util.get_user_email () | 22 | return util.get_user_email () |
23 | else: | 23 | else: |
... | @@ -33,5 +33,5 @@ def get_user_email_domain (): | ... | @@ -33,5 +33,5 @@ def get_user_email_domain (): |
33 | def set_user_email_domain (domain): | 33 | def set_user_email_domain (domain): |
34 | util.set_user_email_domain (domain) | 34 | util.set_user_email_domain (domain) |
35 | 35 | ||
36 | def tempname (tmpdir = None): | 36 | def tempname (tmpdir=None): |
37 | return util.tempname (tmpdir) | 37 | return util.tempname (tmpdir) | ... | ... |
-
Please register or sign in to post a comment