Skip to content

Futurize pass 2#15

Merged
psafont merged 38 commits intoxenserver:masterfrom
ydirson:futurize-pass-2
Nov 25, 2022
Merged

Futurize pass 2#15
psafont merged 38 commits intoxenserver:masterfrom
ydirson:futurize-pass-2

Conversation

@ydirson
Copy link
Copy Markdown
Contributor

@ydirson ydirson commented Sep 21, 2022

@ydirson ydirson force-pushed the futurize-pass-2 branch 3 times, most recently from 5bb8720 to 76459c6 Compare September 26, 2022 11:47
@ydirson ydirson mentioned this pull request Sep 26, 2022
This is a common error documented in
https://docs.python.org/2.7/whatsnew/2.6.html#pep-3110-exception-handling-changes

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Note there are indentation issues introduced in xcp.repository, as well
as uses of the `future` package (which are not supposed to happen in
pass 1), and several smaller issues.  All of this is handled separately
in further patches, so we can easily reconstruct this patch by running
`futurize -wn1`.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…lengths

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This API change requires switching literals from str to unicode.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This implementation of CpioFileCompat.write cannot work with python
2.7, as adding new attributes to a ZipInfo triggers an exception.
`tarfile.py` in Python 2.7 has a fix, but this method is clearly not
used, so there's no reason to keep it, especially as its use of
StringIO should likely switch to BytesIO and we would need to write
tests for this.

Also note that in python3 the TarFileCompat class is removed.  We could
probably just drop our CpioFileCompat completely, if we're sure noone uses
it, but it likely only exists because there was a TarFileCompat.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
... on locations reported by futurize

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This is the only usage we have of `future`, where we used `six`
instead everywhere else.  At least `future` has the advantage of being
really easy to drop when we cull python2 support.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
These changes come from a `futurize -2` or `2to3` run, but are for some
reason not applied by the `urllib` fix itself.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Changes driven by "futurize -f libfuturize.fixes.fix_xrange_with_import",
but not using "from builtins import range", which only brings
negligible performance degradation on python2.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
There has not been any distinction at the python code level between `long`
and `int` since 2.2.

`2to3 -f long` would replace them with casts to `int` instead, which would
just be a no-op.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…bility

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Only exclude a change to `xcp.accessor`.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…timal

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…eeded

2to3 uses list comprehensions to replace `map` calls in many places where
they're not needed, and would yield worse perf than `map`.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…filter())`

Looks like a bug/limitation in `2to3`.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…ions

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…Address" arguments

Pylint would report:

  xcp/accessor.py:377: W0221: (arguments-differ), HTTPAccessor.openAddress: Parameters differ from overridden 'openAddress' method

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…ture"

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This one is only for checking feature availability.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…iltin

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
… dicts

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…on convention

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…public-methods

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…lengths

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
@psafont psafont merged commit b04c5e4 into xenserver:master Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants