From 49bb0c37251479e34c65fbf7a33c5e925cf79917 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 1 Feb 2026 23:47:38 +0000 Subject: [PATCH] Add example projects --- examples/complex_project/processor.py | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 examples/complex_project/processor.py diff --git a/examples/complex_project/processor.py b/examples/complex_project/processor.py new file mode 100644 index 0000000..a9ac4f9 --- /dev/null +++ b/examples/complex_project/processor.py @@ -0,0 +1,47 @@ +""" +Data processing module. +""" + +from typing import Dict, Any, List +from .config import AppConfig + + +class DataProcessor: + """Processes data according to configuration.""" + + def __init__(self, config: AppConfig): + self.config = config + self.cache: Dict[str, Any] = {} + + def process_data(self, data: Dict[str, Any]) -> Dict[str, Any]: + """Process input data.""" + cache_key = str(data) + + if cache_key in self.cache: + return self.cache[cache_key] + + result = self._transform(data) + self.cache[cache_key] = result + + return result + + def _transform(self, data: Dict[str, Any]) -> Dict[str, Any]: + """Transform data.""" + return { + "processed": True, + "data": data, + "timestamp": self._get_timestamp() + } + + def _get_timestamp(self) -> str: + """Get current timestamp.""" + import datetime + return datetime.datetime.now().isoformat() + + def batch_process(self, items: List[Dict]) -> List[Dict]: + """Process multiple items.""" + return [self.process_data(item) for item in items] + + def clear_cache(self) -> None: + """Clear the cache.""" + self.cache.clear()