Skip to content

Cleanup Python 2 compatibility wrappers - #231

Merged
DifferentialOrange merged 7 commits into
masterfrom
DifferentialOrange/gh-212-cleanup-python-2
Oct 10, 2022
Merged

Cleanup Python 2 compatibility wrappers#231
DifferentialOrange merged 7 commits into
masterfrom
DifferentialOrange/gh-212-cleanup-python-2

Conversation

@DifferentialOrange

@DifferentialOrangeDifferentialOrange commented Sep 9, 2022

Copy link
Copy Markdown
Member

code-health: remove built-in types wrappers

The built-in basestring abstract type was removed in Python 3 [1]. str must be used for strings and bytes for byte objects. long type was unified with int in Python 3 [2].

  1. https://docs.python.org/3/whatsnew/3.0.html?highlight=basestring
  2. https://peps.python.org/pep-0237/

Part of #212

code-health: remove utf-8 encoding instruction

Since Python 3 the default encoding of source files is already UTF-8 [1]. Unless instruction says something other than some variation of "utf-8", it has no effect [2].

  1. https://docs.python.org/3/howto/unicode.html#the-string-type
  2. https://stackoverflow.com/questions/4872007/where-does-this-come-from-coding-utf-8

Part of #212

code-health: remove print compatibility wrapper

future .print_function brings Python 3 print to Python 2 [1].

  1. https://docs.python.org/2/reference/simple_stmts.html#future

code-health: remove StandardError

StandardError was removed in Python 3 [1]. PEP 249 footnote 10 [2] declares that database modules targeting Python 3 should use Exception as base class instead.

  1. https://docs.python.org/3/whatsnew/3.0.html?highlight=standarderror
  2. https://peps.python.org/pep-0249/#footnotes

Part of #212

code-health: remove collections wrappers

collections.abc was introduced in Python 3.3 [1].

  1. https://docs.python.org/3/library/collections.abc.html

Part of #212

code-health: remove c_ssize_t type wrapper

ctypes.c_ssize_t was introduced in Python 2.7 [1] and Python 3.2 [2].

  1. https://docs.python.org/2.7/library/ctypes.html#ctypes.c_ssize_t
  2. https://docs.python.org/3.2/library/ctypes.html#ctypes.c_ssize_t

Part of #212

code-health: remove string encoding compatibility

See PR [1].

  1. types: support working with binary for Python 3 #211

Closes#212

@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 2da0f00 to f016dcaCompareSeptember 9, 2022 11:56
@DifferentialOrangeDifferentialOrange changed the title Cleanup Python 2 compatibility tracesCleanup Python 2 compatibility wrappersSep 9, 2022
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch 3 times, most recently from 93051e9 to 9b2554cCompareSeptember 9, 2022 15:15
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-229-interval branch from 406b2ef to f5deabeCompareSeptember 9, 2022 15:59
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 9b2554c to fc2052eCompareSeptember 9, 2022 15:59
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-229-interval branch 2 times, most recently from 0eb252d to e8b1be0CompareSeptember 21, 2022 12:37
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from fc2052e to 1bca525CompareSeptember 21, 2022 12:47
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-229-interval branch from e8b1be0 to bd9aebaCompareSeptember 21, 2022 13:46
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 1bca525 to 34df802CompareSeptember 21, 2022 13:46
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-229-interval branch from bd9aeba to c629676CompareSeptember 22, 2022 15:31
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 34df802 to 4f9b771CompareSeptember 22, 2022 15:32
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-229-interval branch from c629676 to afa8107CompareSeptember 26, 2022 07:04
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 4f9b771 to cd475e1CompareSeptember 26, 2022 07:05
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-229-interval branch from afa8107 to d4c577cCompareSeptember 26, 2022 07:10
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from cd475e1 to 0936426CompareSeptember 26, 2022 07:10
@DifferentialOrangeDifferentialOrange mentioned this pull request Sep 26, 2022
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-229-interval branch 8 times, most recently from ac7a1e3 to b121ac8CompareOctober 4, 2022 09:36
Base automatically changed from DifferentialOrange/gh-229-interval to masterOctober 5, 2022 09:16
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 0936426 to e9a4af6CompareOctober 5, 2022 09:25
@DifferentialOrange
DifferentialOrange marked this pull request as ready for review October 5, 2022 09:26
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from e9a4af6 to 2199421CompareOctober 5, 2022 09:27
The built-in `basestring` abstract type was removed in Python 3 [1].
`str` must be used for strings and `bytes` for byte objects. `long` type
was unified with `int` in Python 3 [2].
1. https://docs.python.org/3/whatsnew/3.0.html?highlight=basestring
2. https://peps.python.org/pep-0237/
Part of #212
Since Python 3 the default encoding of source files is already UTF-8 [1].
Unless instruction says something other than some variation of "utf-8",
it has no effect [2].
1. https://docs.python.org/3/howto/unicode.html#the-string-type
2. https://stackoverflow.com/questions/4872007/where-does-this-come-from-coding-utf-8
Part of #212
StandardError was removed in Python 3 [1]. PEP 249 footnote 10 [2]
declares that database modules targeting Python 3 should use Exception
as base class instead.
1. https://docs.python.org/3/whatsnew/3.0.html?highlight=standarderror
2. https://peps.python.org/pep-0249/#footnotes
Part of #212
@DifferentialOrange
DifferentialOrangeforce-pushed the DifferentialOrange/gh-212-cleanup-python-2 branch from 2199421 to ec97d90CompareOctober 6, 2022 06:06

@oleg-jukovecoleg-jukovec left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@DifferentialOrange
DifferentialOrange merged commit 12de422 into masterOct 10, 2022
@DifferentialOrange
DifferentialOrange deleted the DifferentialOrange/gh-212-cleanup-python-2 branch October 10, 2022 11:18
Sign up for freeto 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.

Clean up Python 2 compatibility wrappers

2 participants

@DifferentialOrange@oleg-jukovec