blog_parametrize/app/code.py

31 lines
615 B
Python
Raw Normal View History

2024-01-27 19:13:22 +01:00
# coding: utf-8
import logging
from waffle import switch_is_active
logger = logging.getLogger("app_tests")
def simple(name: str) -> str:
name = name.replace(" ", "-")
name = name.lower()
return name
def complex_function(x: int, y: int) -> int:
if switch_is_active("new_complex"):
return rewrite_complex_function(x, y)
return deprecated_complex_function(x, y)
def rewrite_complex_function(x: int, y: int) -> int:
logger.info("rewrite complex")
return x * y
def deprecated_complex_function(x: int, y: int) -> int:
logger.info("deprecated complex")
return x * y