Skip to content

Commit 93948ef

Browse files
committed
adding run commands and fixes of examples
1 parent d5fd6bc commit 93948ef

File tree

6 files changed

+102
-159
lines changed

6 files changed

+102
-159
lines changed

cal_example.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Author: Mike Ryan
4+
Date: 2024/05/16
5+
License: MIT
6+
"""
7+
from dsg_lib.common_functions import calendar_functions
8+
9+
month_list: list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
10+
month_names: list = [
11+
"january",
12+
"february",
13+
"march",
14+
"april",
15+
"may",
16+
"june",
17+
"july",
18+
"august",
19+
"september",
20+
"october",
21+
"november",
22+
"december",
23+
"bob",
24+
]
25+
26+
27+
def calendar_check_number():
28+
for i in month_list:
29+
month = calendar_functions.get_month(month=i)
30+
print(month)
31+
32+
33+
def calendar_check_name():
34+
for i in month_names:
35+
month = calendar_functions.get_month_number(month_name=i)
36+
print(month)
37+
38+
39+
if __name__ == "__main__":
40+
calendar_check_number()
41+
calendar_check_name()

coverage-badge.svg

Lines changed: 1 addition & 1 deletion
Loading

coverage.xml

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" ?>
2-
<coverage version="7.6.1" timestamp="1725070854484" lines-valid="716" lines-covered="677" line-rate="0.9455" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
2+
<coverage version="7.6.1" timestamp="1725072044468" lines-valid="688" lines-covered="677" line-rate="0.984" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
33
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.6.1 -->
44
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
55
<sources>
@@ -8,48 +8,20 @@
88
<packages>
99
<package name="." line-rate="0" branch-rate="0" complexity="0">
1010
<classes>
11-
<class name="log_example.py" filename="log_example.py" complexity="0" line-rate="0" branch-rate="0">
11+
<class name="cal_example.py" filename="cal_example.py" complexity="0" line-rate="0" branch-rate="0">
1212
<methods/>
1313
<lines>
1414
<line number="7" hits="0"/>
15-
<line number="8" hits="0"/>
1615
<line number="9" hits="0"/>
1716
<line number="10" hits="0"/>
18-
<line number="13" hits="0"/>
19-
<line number="14" hits="0"/>
20-
<line number="16" hits="0"/>
21-
<line number="19" hits="0"/>
17+
<line number="27" hits="0"/>
18+
<line number="28" hits="0"/>
19+
<line number="29" hits="0"/>
20+
<line number="30" hits="0"/>
21+
<line number="33" hits="0"/>
22+
<line number="34" hits="0"/>
23+
<line number="35" hits="0"/>
2224
<line number="36" hits="0"/>
23-
<line number="37" hits="0"/>
24-
<line number="38" hits="0"/>
25-
<line number="39" hits="0"/>
26-
<line number="40" hits="0"/>
27-
<line number="41" hits="0"/>
28-
<line number="45" hits="0"/>
29-
<line number="46" hits="0"/>
30-
<line number="47" hits="0"/>
31-
<line number="48" hits="0"/>
32-
<line number="49" hits="0"/>
33-
<line number="50" hits="0"/>
34-
<line number="53" hits="0"/>
35-
<line number="54" hits="0"/>
36-
<line number="55" hits="0"/>
37-
<line number="56" hits="0"/>
38-
<line number="57" hits="0"/>
39-
<line number="58" hits="0"/>
40-
<line number="61" hits="0"/>
41-
<line number="62" hits="0"/>
42-
<line number="63" hits="0"/>
43-
<line number="64" hits="0"/>
44-
<line number="65" hits="0"/>
45-
<line number="68" hits="0"/>
46-
<line number="69" hits="0"/>
47-
<line number="70" hits="0"/>
48-
<line number="71" hits="0"/>
49-
<line number="72" hits="0"/>
50-
<line number="75" hits="0"/>
51-
<line number="76" hits="0"/>
52-
<line number="77" hits="0"/>
5325
</lines>
5426
</class>
5527
</classes>

examples/log_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,5 @@ def main(wqty: int = 100, lqty: int = 10, size: int = 256, workers: int = 16, th
108108
if __name__ == "__main__":
109109
from time import time
110110
start = time()
111-
main(wqty=20, lqty=100, size=64, workers=8, thread_test=False, process_test=True)
111+
main(wqty=5, lqty=50, size=64, workers=8, thread_test=False, process_test=True)
112112
print(f"Execution time: {time()-start:.2f} seconds")

log_example.py

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

makefile

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ isort: ## Sort imports in Python code
7373
isort $(TESTS_PATH)
7474
isort $(EXAMPLE_PATH)
7575

76-
run-fastapi: ## Run the example application
77-
uvicorn examples.fastapi_example:app --port ${PORT} --reload --log-level $(LOG_LEVEL)
78-
# uvicorn examples.fastapi_example:app --port ${PORT} --workers ${WORKER} --log-level $(LOG_LEVEL)
7976

8077
speedtest: ## Run a speed test
8178
if [ ! -f speedtest/http_request.so ]; then gcc -shared -o speedtest/http_request.so speedtest/http_request.c -lcurl -fPIC; fi
@@ -87,7 +84,7 @@ test: ## Run the project's tests
8784
sed -i 's|<source>/workspaces/$(REPONAME)</source>|<source>/github/workspace</source>|' /workspaces/$(REPONAME)/coverage.xml
8885
genbadge coverage -i /workspaces/$(REPONAME)/coverage.xml
8986
flake8 --tee . > htmlcov/_flake8Report.txt
90-
#flake8 --max-doc-length=132 --tee . > htmlcov/_flake8Report.txt
87+
make ex-all
9188

9289
build: ## Build the project
9390
python -m build
@@ -98,7 +95,52 @@ ruff: ## Format Python code with Ruff
9895
ruff check --fix --exit-non-zero-on-fix --show-fixes $(EXAMPLE_PATH)
9996

10097

101-
example-log: ## Run the example logging script
102-
cp /workspaces/devsetgo_lib/examples/log_example.py /workspaces/devsetgo_lib/
103-
python3 log_example.py
104-
cp /workspaces/devsetgo_lib/log_example.py /workspaces/devsetgo_lib/examples
98+
ex-fastapi: ## Run the example fast application
99+
uvicorn examples.fastapi_example:app --port ${PORT} --reload --log-level $(LOG_LEVEL)
100+
# uvicorn examples.fastapi_example:app --port ${PORT} --workers ${WORKER} --log-level $(LOG_LEVEL)
101+
102+
ex-log: ## Run the example logging script
103+
cp /workspaces/devsetgo_lib/examples/log_example.py /workspaces/devsetgo_lib/ex.py
104+
python3 ex.py
105+
rm /workspaces/devsetgo_lib/ex.py
106+
107+
108+
ex-cal: ## Run the example calendar script
109+
cp /workspaces/devsetgo_lib/examples/cal_example.py /workspaces/devsetgo_lib/ex.py
110+
python3 ex.py
111+
rm /workspaces/devsetgo_lib/ex.py
112+
113+
ex-csv: ## Run the example calendar script
114+
cp /workspaces/devsetgo_lib/examples/csv_example.py /workspaces/devsetgo_lib/ex.py
115+
python3 ex.py
116+
rm /workspaces/devsetgo_lib/ex.py
117+
118+
ex-json: ## Run the example calendar script
119+
cp /workspaces/devsetgo_lib/examples/json_example.py /workspaces/devsetgo_lib/ex.py
120+
python3 ex.py
121+
rm /workspaces/devsetgo_lib/ex.py
122+
123+
ex-pattern: ## Run the example calendar script
124+
cp /workspaces/devsetgo_lib/examples/pattern_example.py /workspaces/devsetgo_lib/ex.py
125+
python3 ex.py
126+
rm /workspaces/devsetgo_lib/ex.py
127+
128+
ex-text: ## Run the example calendar script
129+
cp /workspaces/devsetgo_lib/examples/text_example.py /workspaces/devsetgo_lib/ex.py
130+
python3 ex.py
131+
rm /workspaces/devsetgo_lib/ex.py
132+
133+
ex-email: ## Run the example calendar script
134+
cp /workspaces/devsetgo_lib/examples/validate_emails.py /workspaces/devsetgo_lib/ex.py
135+
python3 ex.py
136+
rm /workspaces/devsetgo_lib/ex.py
137+
138+
ex-all: ## Run all the examples, but fastapi
139+
140+
make ex-log
141+
make ex-cal
142+
make ex-csv
143+
make ex-json
144+
make ex-pattern
145+
make ex-text
146+
make ex-email

0 commit comments

Comments
 (0)