Skip to content
This repository has been archived by the owner on Apr 10, 2021. It is now read-only.

Commit

Permalink
Only import modules if needed
Browse files Browse the repository at this point in the history
Some platforms such as Google App Engine blacklist ctypes modules. If
time.monotonic is available, don't import a bunch of useless and potentially
unavailable module.

See jd/tenacity#116
  • Loading branch information
jd authored and atdt committed May 3, 2018
1 parent 9b843d4 commit 7aa14d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions monotonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
limitations under the License.
"""
import ctypes
import ctypes.util
import os
import sys
import threading
import time


Expand All @@ -52,6 +47,11 @@
try:
monotonic = time.monotonic
except AttributeError:
import ctypes
import ctypes.util
import os
import sys
import threading
try:
if sys.platform == 'darwin': # OS X, iOS
# See Technical Q&A QA1398 of the Mac Developer Library:
Expand Down

0 comments on commit 7aa14d0

Please sign in to comment.