blog_parametrize/app/code.py

34 lines
671 B
Python
Raw Permalink 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:
2024-01-28 11:29:56 +01:00
def foo() -> int:
return int(True)
2024-01-27 19:13:22 +01:00
logger.info("deprecated complex")
2024-01-28 11:29:56 +01:00
return x * y * foo()