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 | |
def mock(mock_func): | |
def decorate_inner(func): | |
# Feel free to use functools wraps to preserve introspection info | |
def inner(*args, **kwargs): | |
if os.environ.get("ENV") == "test": | |
return mock_func(*args, **kwargs) | |
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
defmodule Roman do | |
@values [i: 1, v: 5, x: 10, l: 50, c: 100, d: 500, m: 1000] | |
@valid_transitions %{ | |
m: [:c, :d, :l, :x, :v, :i], | |
d: [:c, :l, :x, :v, :i], | |
c: [:m, :d, :c, :l, :x, :v, :i], | |
l: [:x, :v, :i], | |
x: [:c, :l, :x, :v, :i], | |
v: [:i], |
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
vals = [1,2,3] | |
def afunc(v1, v2): | |
return v1 * v2 | |
for k in vals: | |
for j in vals: | |
print(afunc(k, j)) | |
# Result |