[Python 3] def ensure_binary / some ___prepare binary return fix
Needs ReviewPublic

Authored by ghane on Sep 30 2022, 1:38 PM.


Group Reviewers
PyKolab Developers

def ensure_binary added

"== None" -> new PEP8 style "is None"

def lsub ensure ml is str for variable manipulation
def lm prepare return bytes
manipulations and clauses between
prepare and docommand ensure to be bytes
as well, as var1, var2 =
docommand(), var2 ensure_str

Diff Detail

rP pykolab
Lint Skipped
Unit Tests Skipped

Event Timeline

ghane requested review of this revision.Sep 30 2022, 1:38 PM
ghane created this revision.
sicherha added inline comments.

In D3884 you try to ensure that lm() always receives a str. Here, by contrast, you change the parameter's default value to the type bytes. That looks inconsistent to me.

ghane abandoned this revision.Mon, Jan 2, 1:29 PM
ghane marked an inline comment as done.

Using text strings in module is not very suitable:

which is contra line def folder_utf7 line 295,

return imap_utf7.encode(folder)

Encoding to byte,

which is called before on def parse_mailfolder line 518

which causes wrong behaviour on python 3 as byte and text string of maifolderpath will be compared.

imap/ line 1202

Keeping to raw data

As it is decoded in line 582 it doesn't harm anyway, but as in line 578 and 579 the pattern is the same.

Because of "def decode" D3884 also dellivers a string like " b'mailbox' " as pattern

ghane reclaimed this revision.Mon, Jan 2, 1:44 PM
ghane marked an inline comment as done.

abandoned by error