Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usage of time.clock() with time.time() #6

Merged
merged 1 commit into from
Oct 22, 2019

Conversation

Harmon758
Copy link

time.clock() has been deprecated since Python 3.3:
https://docs.python.org/3.3/whatsnew/3.3.html#deprecated-python-modules-functions-and-methods
https://bugs.python.org/issue14309, https://www.python.org/dev/peps/pep-0418/#deprecated-function, https://hg.python.org/cpython/rev/314c3faea2fb, python/cpython@47620a6

With Python 3.7, it now emits a DeprecationWarning:
https://bugs.python.org/issue31803, python/cpython#4020, python/cpython@884d13a

C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:132: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  start = time.clock()
C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:159: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  print( "Kernel bootstrap completed in %.2f seconds" % (time.clock() - start) )
C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:193: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  start = time.clock()
C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:196: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  end = time.clock() - start
C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:202: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  start = time.clock()
C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:205: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  print( "done (%.2f seconds)" % (time.clock() - start) )
C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:329: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  start = time.clock()
C:\Program Files\Python37\lib\site-packages\aiml\Kernel.py:344: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  print( "done (%.2f seconds)" % (time.clock() - start) )

With Python 3.8:

The function time.clock() has been removed, it was deprecated since Python 3.3

https://docs.python.org/3.8/whatsnew/3.8.html#api-and-feature-removals
https://bugs.python.org/issue36895, python/cpython#13270, python/cpython@e250061, python/cpython#13286, python/cpython@b6a09ae

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python38\lib\site-packages\aiml\Kernel.py", line 132, in bootstrap
    start = time.clock()
AttributeError: module 'time' has no attribute 'clock'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python38\lib\site-packages\aiml\Kernel.py", line 202, in saveBrain
    start = time.clock()
AttributeError: module 'time' has no attribute 'clock'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python38\lib\site-packages\aiml\Kernel.py", line 329, in learn
    start = time.clock()
AttributeError: module 'time' has no attribute 'clock'

@Harmon758
Copy link
Author

@paulovn Python 3.8.0 has now been released.
Can this be merged and released so the library can support Python 3.8?

@paulovn paulovn merged commit e6feb02 into paulovn:master Oct 22, 2019
@Harmon758
Copy link
Author

Thanks!

@Harmon758 Harmon758 deleted the time.clock-to-time.time branch October 22, 2019 18:20
@paulovn
Copy link
Owner

paulovn commented Oct 22, 2019

Thanks for the patch. I've generated version 0.9.3 (also updated to PyPi)

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.

2 participants