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 os | |
from parso import parse | |
from collections import defaultdict | |
def get_arguments(i): | |
# parso represents functions with one argument and multiple arguments very differently, need to handle this here | |
if i.type == 'arglist': | |
return i.children | |
else: |
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
PEP: | |
Title: Keyword only argument on function call | |
Author: Anders Hovmöller <[email protected]>, | |
Johan Lübcke <[email protected]> | |
Status: Active | |
Type: Process | |
Content-Type: text/x-rst | |
Created: 23-Aug-2018 | |
Post-History: ??? |
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 os | |
from parso import parse | |
from collections import defaultdict | |
args = 0 | |
kwargs = 0 | |
kwargs_foo_equal_foo = 0 | |
passed_value = 0 | |
args_kwargs = 0 |
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 CoreFoundation | |
func timeIt(m: () -> ()) -> (Double, Int) { | |
let startTime = CFAbsoluteTimeGetCurrent() | |
var numberOfRuns = 0 | |
while true { | |
m() | |
numberOfRuns += 1 | |
let elapsed = CFAbsoluteTimeGetCurrent() - startTime | |
if elapsed > 0.5 { // we run the function up to 0.5 seconds, assuming here that we want to sample functions that are pretty fast |