mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
Automatically generate cassette names from function names. Add
`path_transformer` and `func_path_generator`. Closes #151.
This commit is contained in:
16
vcr/util.py
Normal file
16
vcr/util.py
Normal file
@@ -0,0 +1,16 @@
|
||||
def partition_dict(predicate, dictionary):
|
||||
true_dict = {}
|
||||
false_dict = {}
|
||||
for key, value in dictionary.items():
|
||||
this_dict = true_dict if predicate(key, value) else false_dict
|
||||
this_dict[key] = value
|
||||
return true_dict, false_dict
|
||||
|
||||
|
||||
def compose(*functions):
|
||||
def composed(incoming):
|
||||
res = incoming
|
||||
for function in functions[::-1]:
|
||||
res = function(res)
|
||||
return res
|
||||
return composed
|
||||
Reference in New Issue
Block a user