test-ai-tools 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
area/__init__.py ADDED
File without changes
area/area.py ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import sys
4
+ # Import our standalone calculator class
5
+ from calc import calculator
6
+
7
+ class area:
8
+ """Manages parsing terminal arguments and formatting outputs."""
9
+
10
+ def __init__(self):
11
+ self.parser = argparse.ArgumentParser(
12
+ description="Calculate shape areas via separate decoupled modules."
13
+ )
14
+ self._setup_arguments()
15
+
16
+ def _setup_arguments(self):
17
+ self.parser.add_argument('-c', '--circle', type=float, metavar='DIAMETER',
18
+ help='Calculate circle area using diameter')
19
+ self.parser.add_argument('-r', '--rectangle', type=float, nargs=2, metavar=('WIDTH', 'HEIGHT'),
20
+ help='Calculate rectangle area using width and height')
21
+ self.parser.add_argument('-t', '--triangle', type=float, nargs=2, metavar=('BASE', 'HEIGHT'),
22
+ help='Calculate triangle area using base and height')
23
+
24
+ def run(self):
25
+ args = self.parser.parse_args()
26
+
27
+ try:
28
+ if args.circle is not None:
29
+ area = calculator.circle(args.circle)
30
+ print(f"Circle Area (Diameter {args.circle}): {area:.2f}")
31
+
32
+ elif args.rectangle is not None:
33
+ w, h = args.rectangle
34
+ area = calculator.rectangle(w, h)
35
+ print(f"Rectangle Area ({w}x{h}): {area:.2f}")
36
+
37
+ elif args.triangle is not None:
38
+ b, h = args.triangle
39
+ area = calculator.triangle(b, h)
40
+ print(f"Triangle Area (Base {b}, Height {h}): {area:.2f}")
41
+
42
+ else:
43
+ self.parser.print_help()
44
+ sys.exit(1)
45
+
46
+ except ValueError as e:
47
+ print(f"Error: {e}", file=sys.stderr)
48
+ sys.exit(1)
49
+
50
+ def main():
51
+ cli = area()
52
+ cli.run()
53
+ if __name__ == '__main__':
54
+ main()
area/calc.py ADDED
@@ -0,0 +1,24 @@
1
+ import argparse , math, sys
2
+
3
+ class calculator:
4
+
5
+ @staticmethod
6
+ def circle(diameter: float) -> float:
7
+ if diameter < 0:
8
+ raise ValueError("Diameter cannot be negative.")
9
+ radius = diameter / 2
10
+ return math.pi * (radius ** 2)
11
+
12
+ @staticmethod
13
+ def rectangle(width: float, height: float) -> float:
14
+ if width < 0 or height < 0:
15
+ raise ValueError("Dimensions cannot be negative.")
16
+ return width * height
17
+
18
+ @staticmethod
19
+ def triangle(base: float, height: float) -> float:
20
+ if base < 0 or height < 0:
21
+ raise ValueError("Dimensions cannot be negative.")
22
+ return 0.5 * base * height
23
+
24
+
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: test-ai-tools
3
+ Version: 0.0.1
4
+ Summary: A CLI that can used by AI LLM
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: Operating System :: OS Independent
7
+ Requires-Python: >=3.7
8
+ Description-Content-Type: text/markdown
@@ -0,0 +1,8 @@
1
+ area/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ area/area.py,sha256=UqEgZn5PGhN84Y6_47djXIrxDQCdiE7p-KQMHrGC_FY,1961
3
+ area/calc.py,sha256=K2i8-prpkm1bxZx73dS5O4hMmSANoQzV1Pl6Ju2cSAc,681
4
+ test_ai_tools-0.0.1.dist-info/METADATA,sha256=IvBZlqnm7rDUSOzAg6rsXl50IH8kCKBI-5s05AQpZPA,254
5
+ test_ai_tools-0.0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
6
+ test_ai_tools-0.0.1.dist-info/entry_points.txt,sha256=Jkh7oVVaMA_0zs7YutrP_devBGVPIIjMoB4SnnQLOmc,48
7
+ test_ai_tools-0.0.1.dist-info/top_level.txt,sha256=AGsODuMO72ggpG-8SmSzh3Q3UcBdXcp1zu1BhecCE20,5
8
+ test_ai_tools-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ area = area_pkg.area_cli:main
@@ -0,0 +1 @@
1
+ area