Skip to content

Commit ea2f2af

Browse files
split up to test and library
1 parent 5176a7a commit ea2f2af

17 files changed

+17
-306
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ python.dialoget.com is a test framework for multilanguage source code, based on
66
pip install --upgrade pip
77
pip install requests
88
pip install behave
9+
pip install setuptools
910
chmod +x test.sh
1011
```
1112

@@ -18,7 +19,7 @@ with one bash script
1819
or each script in command line
1920

2021
```bash
21-
cd test
22+
cd test/dialoget
2223
python3 update_repo_on_github.py
2324
python3 update_repo_on_github2.py
2425
python3 create_repo_on_org_github.py

data/env.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

data/map.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

data/prompt.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

data/user.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/create_repo_on_org_github.py

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 10 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
import sys
2-
sys.path.append('../')
31
import os
4-
#from functools import wraps
52
import functools
63
import csv
74
from datetime import datetime
85

9-
106
# root path to the project
11-
#ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
12-
ROOT_PATH=''
13-
LOG_FILE='log.csv'
14-
ERROR_FILE='error.csv'
7+
# ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
8+
ROOT_PATH = ''
9+
LOG_FILE = 'log.csv'
10+
ERROR_FILE = 'error.csv'
1511
LOG_PATH = os.path.join(ROOT_PATH, LOG_FILE)
1612
ERROR_PATH = os.path.join(ROOT_PATH, ERROR_FILE)
1713

14+
1815
def dialoget(template, logs_path=''):
19-
USER_ERROR = os.path.abspath( os.path.join(logs_path,ERROR_PATH) )
20-
USER_LOGS = os.path.abspath( os.path.join(logs_path,LOG_PATH) )
16+
USER_ERROR = os.path.abspath(os.path.join(logs_path, ERROR_PATH))
17+
USER_LOGS = os.path.abspath(os.path.join(logs_path, LOG_PATH))
18+
2119
def decorator(func):
2220
@functools.wraps(func)
2321
def wrapper(*args, **kwargs):
@@ -50,8 +48,10 @@ def wrapper(*args, **kwargs):
5048
return func(*args, **kwargs)
5149

5250
return wrapper
51+
5352
return decorator
5453

54+
5555
def log_to_csv(file_name, log_dict):
5656
# Write log message or error to a CSV file
5757
with open(file_name, mode='a', newline='') as file:
@@ -60,62 +60,3 @@ def log_to_csv(file_name, log_dict):
6060
writer.writeheader()
6161
writer.writerow(log_dict)
6262

63-
64-
"""
65-
def dialoget(template):
66-
def decorator(func):
67-
@functools.wraps(func)
68-
def wrapper(*args, **kwargs):
69-
# Assuming the function returns a dictionary of replacements
70-
replacements = func(*args, **kwargs)
71-
72-
# Replace placeholders in the template with actual values
73-
filled_template = template.format(**replacements)
74-
75-
# Print or use the filled template string
76-
print(filled_template) # or you can return it, if needed
77-
78-
# Return the result of the function, if it's necessary.
79-
return replacements
80-
81-
return wrapper
82-
83-
return decorator
84-
85-
86-
87-
# This is the decorator factory that accepts arguments
88-
def dialoget2(sentence="Sentence"):
89-
# This is the actual decorator
90-
def decorator(func):
91-
call_count = 0
92-
93-
@functools.wraps(func)
94-
def wrapper(*args, **kwargs):
95-
nonlocal call_count
96-
call_count += 1
97-
print(f"The sentence: {sentence} {func.__name__} has been called {call_count} times")
98-
return func(*args, **kwargs)
99-
100-
return wrapper
101-
return decorator
102-
103-
104-
105-
106-
# Usage example with decorator arguments
107-
108-
def nfunc(func):
109-
# This will hold the number of times the function has been called
110-
call_count = 0
111-
112-
@wraps(func) # Use this to preserve the original function's metadata
113-
def wrapper(*args, **kwargs):
114-
nonlocal call_count
115-
call_count += 1
116-
print(f"Function {func.__name__} has been called {call_count} times")
117-
return func(*args, **kwargs)
118-
119-
return wrapper
120-
121-
"""

src/update_repo_on_github.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/update_repo_on_github2.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)