#685 Rest of automated conversion from py3 changes
Merged 5 years ago by mikem. Opened 6 years ago by tkopecek.
tkopecek/koji python3-simple  into  master

No commits found

It is quite easier to review it separately than as a part of #451.

rebased onto e399029d51f9ba7d1a3f45a90cbfbf4f23dcc665

6 years ago

rebased onto d15fec590699f8c6ff1a23adafe7ecee96c912ff

6 years ago

Is list really needed in all the dict(list(zip(...))) expressions?

Is list needed in a,b = list(zip(*fields)) statements?

Expressions like list(brmap.values()) work for both py2 and 3, but result in a redundant data copy in py2. Gotta wonder if there is a way to cast without forcing a copy. Granted, perhaps the waste is not worth worrying about in these cases.

1 new commit added

  • clean iterator fixes
6 years ago

Would be list(six.itervalues(brmap) better?

4 new commits added

  • file -> open in kojid
  • fix numbers, make kojid parsable with py3
  • python-modernize -f libmodernize.fixes.fix_int_long_tuple -w .
  • python-modernize -f libmodernize.fixes.fix_basestring -w .
6 years ago

Maybe something like this?

def listconv(l):
    if isinstance(l, list):
        return l
    else:
        return list(l)

Unless there is some saner built-in for this

rebased onto 4d26980e9d9ba97129785db002137b3fc4962286

5 years ago

I've rebased it, cleaned and added few more fixes. Also added 'koji.util.to_list' helper.

btw, merging this will greatly simplify PR #891 and #921

Whoops, spoke too soon...

Traceback (most recent call last):
  File "/usr/share/koji-hub/kojixmlrpc.py", line 713, in application
    memory_usage_at_start = get_memory_usage()
  File "/usr/share/koji-hub/kojixmlrpc.py", line 653, in get_memory_usage
    statm = [pagesize * y // 1024 for y in "".join(open("/proc/self/statm").readlines()).strip().split()]
TypeError: unsupported operand type(s) for //: 'str' and 'int'

rebased onto d749b8ed547a2b0cc6d720cd7d5d2c5d41b67734

5 years ago

fixed (it was manual part of "fixing" automated output :-( )

rebased onto a7cdc5324c06990eb021828a50bb9e345dbef1bc

5 years ago

rebased onto 92c2e37

5 years ago

Syntax error in koji-shadow:

from koji.util import import to_list

kojivmd still has some old-style except syntax

5 new commits added

  • fix tuple expansion in args
  • python-modernize -f lib2to3.fixes.fix_numliterals
  • python-modernize -f lib2to3.fixes.fix_except
  • fix sort(l) vs l.sort() typo
  • fix double import typo
5 years ago

Hmm, it was missed by PR #666 :-( Run these fixes once more for all files.

rebased onto fe293d9

5 years ago

Commit 147f781 fixes this pull-request

Pull-Request has been merged by mikem

5 years ago