This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def download_file_from_google_drive(id, destination): | |
def get_confirm_token(response): | |
for key, value in response.cookies.items(): | |
if key.startswith('download_warning'): | |
return value | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def primes(n): | |
if n==2: | |
return [2] | |
elif n<2: | |
return [] | |
s=range(3,n+1,2) | |
mroot = n ** 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def primes(n): | |
if n == 2: | |
return [2] | |
elif n < 2: | |
return [] | |
s = [] | |
for i in range(3, n+1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Timer unit: 1e-06 s | |
Total time: 181.595 s | |
File: 03.primes-v1.py | |
Function: primes at line 3 | |
Line # Hits Time Per Hit % Time Line Contents | |
============================================================== | |
3 @profile | |
4 def primes(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Benchmark duration: 886.8774709701538 seconds | |
Command line: ['03.primes-v1.py'] | |
Total duration: 886.878s | |
File: 03.primes-v1.py | |
File duration: 886.878s (100.00%) | |
Line #| Hits| Time| Time per hit| %|Source code | |
------+----------+-------------+-------------+-------+----------- | |
1| 2| 7.10487e-05| 3.55244e-05| 0.00%|import time | |
2| 0| 0| 0| 0.00%| | |
3| 0| 0| 0| 0.00%| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def primes(n): | |
if n==2: | |
return [2] | |
elif n<2: | |
return [] | |
s=range(3,n+1,2) | |
mroot = n ** 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def primes(n): | |
if n == 2: | |
return [2] | |
elif n < 2: | |
return [] | |
s = [] | |
for i in range(3, n+1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Benchmark duration: 30.11158514022827 seconds | |
23139965 function calls in 30.112 seconds | |
Ordered by: standard name | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1 0.000 0.000 30.112 30.112 03.primes.py:1(<module>) | |
40 19.760 0.494 29.896 0.747 03.primes.py:3(primes) | |
1 0.216 0.216 30.112 30.112 03.primes.py:31(benchmark) | |
40 0.000 0.000 0.000 0.000 {len} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from memory_profiler import profile | |
@profile(precision=6) | |
def primes(n): | |
if n == 2: | |
return [2] | |
elif n < 2: | |
return [] | |
s = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from memory_profiler import profile | |
@profile(precision=6) | |
def primes(n): | |
if n == 2: | |
return [2] | |
elif n < 2: | |
return [] | |
s = range(3, n + 1, 2) |
NewerOlder