Skip to content

Commit 32bc765

Browse files
committed
تمييز دالة استيراد البيانات على أنها تحت التجربة والتطوير
1 parent 0ed6854 commit 32bc765

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

zakat/zakat_tracker.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,34 @@
7777
import tarfile
7878
import io
7979
import re
80+
import warnings
81+
import functools
8082
from typing import Optional
8183
from pprint import PrettyPrinter as pp
8284

8385

86+
def experimental(func):
87+
"""
88+
Marks a function as experimental.
89+
90+
This decorator will issue a FutureWarning when the decorated
91+
function is called, indicating that the function's API
92+
may change or be removed without notice.
93+
94+
Parameters:
95+
- func: The function to decorate.
96+
97+
Returns:
98+
- The decorated function.
99+
"""
100+
@functools.wraps(func) # Preserves original function's metadata
101+
def wrapper(*args, **kwargs):
102+
warnings.warn(f"[WARNING] {func.__name__} is an experimental feature and may change or be removed without notice.",
103+
category=FutureWarning)
104+
return func(*args, **kwargs)
105+
return wrapper
106+
107+
84108
# fix WindowsOS encoding issue
85109
if not 'pytest' in sys.modules or sys.platform.startswith('win'): # workaround for https://github.com/pytest-dev/pytest/issues/4843
86110
sys.stdin.reconfigure(encoding='utf-8', errors='namereplace')
@@ -3712,6 +3736,7 @@ def get_transaction_csv_headers() -> list[str]:
37123736
"reference",
37133737
]
37143738

3739+
@experimental
37153740
def import_csv(self, path: str = 'file.csv', scale_decimal_places: int = 0, delimiter: str = ',', debug: bool = False) -> ImportReport:
37163741
"""
37173742
The function reads the CSV file, checks for duplicate transactions and tries it's best to creates the transactions history accordingly in the system.

0 commit comments

Comments
 (0)