blog_parametrize/app/code.py

33 lines
671 B
Python

# 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:
def foo() -> int:
return int(True)
logger.info("deprecated complex")
return x * y * foo()