Page MenuHomekolab.org

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

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

Details

Reviewers
None
Group Reviewers
PyKolab Developers
Summary

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

Repository
rP pykolab
Lint
Lint Skipped
Unit
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.
cyruslib.py
564

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 cyruslib.py module is not very suitable:

which is contra cyrus.py line def folder_utf7 cyrus.py line 295,

return imap_utf7.encode(folder)

Encoding to byte,

which is called before on def parse_mailfolder cyrus.py line 518

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

imap/__init__.py line 1202

Keeping cyruslib.py to raw data

cyruslib.py
564

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