Page MenuHomePhorge

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

Authored by ghane on Sep 30 2022, 1:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jul 5, 12:33 AM
Unknown Object (File)
Thu, Jul 4, 2:04 AM
Unknown Object (File)
Sun, Jun 23, 9:56 PM
Unknown Object (File)
Jun 8 2024, 2:55 PM
Unknown Object (File)
Jun 8 2024, 12:10 PM
Unknown Object (File)
Jun 7 2024, 11:13 AM
Unknown Object (File)
Jun 6 2024, 9:03 PM
Unknown Object (File)
Jun 6 2024, 6:31 PM

Details

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 Not Applicable
Unit
Tests Not Applicable

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 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 marked an inline comment as done.

abandoned by error

What is it that currently doesn't work and afterwards works? (e.g. a kolab command that currently fails)

python3 ./kolab-cli.py lm
should show list but is empty on actual git version

python3 ./kolab-cli.py dm ...

analogy:
prepare
do somthing
docommand

I just retested with lm command to be sure the fixes are still relevant for python3.

This revision is now accepted and ready to land.Mar 7 2023, 9:31 PM
This revision was automatically updated to reflect the committed changes.