Skip to content

update xrange() to range(), as Python 2 has been deprecate#19336

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
kyshel:patch-1
Jan 18, 2021
Merged

update xrange() to range(), as Python 2 has been deprecate#19336
opencv-pushbot merged 1 commit intoopencv:3.4from
kyshel:patch-1

Conversation

@kyshel
Copy link
Copy Markdown
Contributor

@kyshel kyshel commented Jan 16, 2021

update xrange() to range(), as Python 2 has been deprecate, more info:

  1. Python 2 has been no longer supported officially since January 1, 2020. Check https://www.python.org/doc/sunset-python-2
  2. xrange() was renamed to range() in Python 3. Check https://stackoverflow.com/questions/17192158/nameerror-global-name-xrange-is-not-defined-in-python-3/17192181#17192181

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 17, 2021

Thank you for contribution!

There are several similar places in tutorials. Please fix them too:

$ grep -Rn xrange ./doc/py_tutorials/
./doc/py_tutorials/py_imgproc/py_pyramids/py_pyramids.markdown:91:for i in xrange(6):
./doc/py_tutorials/py_imgproc/py_pyramids/py_pyramids.markdown:98:for i in xrange(6):
./doc/py_tutorials/py_imgproc/py_pyramids/py_pyramids.markdown:104:for i in xrange(5,0,-1):
./doc/py_tutorials/py_imgproc/py_pyramids/py_pyramids.markdown:111:for i in xrange(5,0,-1):
./doc/py_tutorials/py_imgproc/py_pyramids/py_pyramids.markdown:125:for i in xrange(1,6):
./doc/py_tutorials/py_imgproc/py_thresholding/py_thresholding.markdown:50:for i in xrange(6):
./doc/py_tutorials/py_imgproc/py_thresholding/py_thresholding.markdown:101:for i in xrange(4):
./doc/py_tutorials/py_imgproc/py_thresholding/py_thresholding.markdown:156:for i in xrange(3):
./doc/py_tutorials/py_imgproc/py_thresholding/py_thresholding.markdown:199:for i in xrange(1,256):
./doc/py_tutorials/py_imgproc/py_transforms/py_fourier_transform/py_fourier_transform.markdown:271:for i in xrange(6):
./doc/py_tutorials/py_photo/py_non_local_means/py_non_local_means.markdown:111:img = [cap.read()[1] for i in xrange(5)]

As a "bugfix" this patch should go into 3.4 branch first.
We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

Please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

@kyshel kyshel changed the base branch from master to 3.4 January 18, 2021 09:22
@kyshel kyshel changed the base branch from 3.4 to master January 18, 2021 09:28
update xrange() to range() as Python 2 has been deprecate, more info:
1.  Python 2 has been no longer supported officially since January 1, 2020.  Check  https://www.python.org/doc/sunset-python-2/
2.  xrange() was renamed to range() in Python 3. Check  https://stackoverflow.com/questions/17192158/nameerror-global-name-xrange-is-not-defined-in-python-3/17192181#17192181

update xrange() to range()

Update py_fourier_transform.markdown

update xrange() to range()
@kyshel kyshel changed the base branch from master to 3.4 January 18, 2021 12:01
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Well done! Thank you for contribution 👍

@opencv-pushbot opencv-pushbot merged commit 291dbdf into opencv:3.4 Jan 18, 2021
@alalek alalek mentioned this pull request Jan 22, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug category: documentation Documentation fix or update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants