pyestrombe 0.2.1__tar.gz

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.
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyestrombe
3
+ Version: 0.2.1
4
+ Summary: A CLI tool to inspect practical source codes
5
+ Author-email: Developer <developer@example.com>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+
12
+ # pyestrombe
13
+
14
+ quick tool to show practical code in terminal
15
+
16
+ ---
17
+
18
+ ## install
19
+
20
+ ```bash
21
+ pip install pyestrombe
22
+ ```
23
+
24
+ ---
25
+
26
+ ## use
27
+
28
+ list all:
29
+
30
+ ```bash
31
+ pyestrombe list
32
+ ```
33
+
34
+ get any practical:
35
+
36
+ ```bash
37
+ pyestrombe 1
38
+ pyestrombe 2
39
+ pyestrombe 3
40
+ ```
41
+
42
+ it will just give the access of exact code
43
+
44
+ ---
45
+
46
+ ## structure
47
+
48
+ ```
49
+ modules/
50
+ m01.py
51
+ m02.py
52
+ ...
53
+ m08.py
54
+ ```
55
+
56
+ ---
57
+
58
+
59
+ ---
60
+
61
+ ## notes
62
+
63
+ * made for exams (fast access)
64
+
65
+ ---
66
+
67
+ done 👍
@@ -0,0 +1,56 @@
1
+ # pyestrombe
2
+
3
+ quick tool to show practical code in terminal
4
+
5
+ ---
6
+
7
+ ## install
8
+
9
+ ```bash
10
+ pip install pyestrombe
11
+ ```
12
+
13
+ ---
14
+
15
+ ## use
16
+
17
+ list all:
18
+
19
+ ```bash
20
+ pyestrombe list
21
+ ```
22
+
23
+ get any practical:
24
+
25
+ ```bash
26
+ pyestrombe 1
27
+ pyestrombe 2
28
+ pyestrombe 3
29
+ ```
30
+
31
+ it will just give the access of exact code
32
+
33
+ ---
34
+
35
+ ## structure
36
+
37
+ ```
38
+ modules/
39
+ m01.py
40
+ m02.py
41
+ ...
42
+ m08.py
43
+ ```
44
+
45
+ ---
46
+
47
+
48
+ ---
49
+
50
+ ## notes
51
+
52
+ * made for exams (fast access)
53
+
54
+ ---
55
+
56
+ done 👍
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyestrombe
3
+ Version: 0.2.1
4
+ Summary: A CLI tool to inspect practical source codes
5
+ Author-email: Developer <developer@example.com>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+
12
+ # pyestrombe
13
+
14
+ quick tool to show practical code in terminal
15
+
16
+ ---
17
+
18
+ ## install
19
+
20
+ ```bash
21
+ pip install pyestrombe
22
+ ```
23
+
24
+ ---
25
+
26
+ ## use
27
+
28
+ list all:
29
+
30
+ ```bash
31
+ pyestrombe list
32
+ ```
33
+
34
+ get any practical:
35
+
36
+ ```bash
37
+ pyestrombe 1
38
+ pyestrombe 2
39
+ pyestrombe 3
40
+ ```
41
+
42
+ it will just give the access of exact code
43
+
44
+ ---
45
+
46
+ ## structure
47
+
48
+ ```
49
+ modules/
50
+ m01.py
51
+ m02.py
52
+ ...
53
+ m08.py
54
+ ```
55
+
56
+ ---
57
+
58
+
59
+ ---
60
+
61
+ ## notes
62
+
63
+ * made for exams (fast access)
64
+
65
+ ---
66
+
67
+ done 👍
@@ -0,0 +1,25 @@
1
+ README.md
2
+ pyproject.toml
3
+ pyestrombe.egg-info/PKG-INFO
4
+ pyestrombe.egg-info/SOURCES.txt
5
+ pyestrombe.egg-info/dependency_links.txt
6
+ pyestrombe.egg-info/entry_points.txt
7
+ pyestrombe.egg-info/top_level.txt
8
+ pyinspect_cli/__init__.py
9
+ pyinspect_cli/cli.py
10
+ pyinspect_cli/modules/CS.txt
11
+ pyinspect_cli/modules/CS1.txt
12
+ pyinspect_cli/modules/__init__.py
13
+ pyinspect_cli/modules/asmx5.txt
14
+ pyinspect_cli/modules/buttons5.txt
15
+ pyinspect_cli/modules/helloservice.txt
16
+ pyinspect_cli/modules/javaclient.txt
17
+ pyinspect_cli/modules/maxnum.txt
18
+ pyinspect_cli/modules/multi.text
19
+ pyinspect_cli/modules/prac6.txt
20
+ pyinspect_cli/modules/reqmulti.txt
21
+ pyinspect_cli/modules/reqnum.txt
22
+ pyinspect_cli/modules/request5.txt
23
+ pyinspect_cli/modules/students.txt
24
+ pyinspect_cli/modules/sun.txt
25
+ pyinspect_cli/modules/webxml.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyestrombe = pyinspect_cli.cli:main
@@ -0,0 +1 @@
1
+ pyinspect_cli
File without changes
@@ -0,0 +1,87 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ import sys
5
+ from importlib import resources
6
+
7
+ MODULE_PATTERN = re.compile(r"^m(\d{2})\.py$")
8
+
9
+
10
+ def _available_modules() -> list[int]:
11
+ modules_pkg = resources.files("pyinspect_cli.modules")
12
+ found: list[int] = []
13
+ for entry in modules_pkg.iterdir():
14
+ if not entry.is_file():
15
+ continue
16
+ match = MODULE_PATTERN.match(entry.name)
17
+ if match:
18
+ found.append(int(match.group(1)))
19
+ return sorted(found)
20
+
21
+
22
+ def _named_files() -> dict[str, object]:
23
+ modules_pkg = resources.files("pyinspect_cli.modules")
24
+ names: dict[str, object] = {}
25
+ for entry in modules_pkg.iterdir():
26
+ if not entry.is_file():
27
+ continue
28
+ # Keep numbered python modules managed by numeric lookup.
29
+ if MODULE_PATTERN.match(entry.name):
30
+ continue
31
+ stem = entry.name.rsplit(".", 1)[0].lower()
32
+ if stem == "__init__":
33
+ continue
34
+ names[stem] = entry
35
+ return names
36
+
37
+
38
+ def _print_usage() -> None:
39
+ print("Usage: pyestrombe <number|name> | pyestrombe list")
40
+
41
+
42
+ def main() -> None:
43
+ args = sys.argv[1:]
44
+
45
+ if not args:
46
+ _print_usage()
47
+ sys.exit(1)
48
+
49
+ cmd = args[0]
50
+ available = _available_modules()
51
+ named = _named_files()
52
+
53
+ if cmd == 'list':
54
+ if not available and not named:
55
+ print("No modules or named files found.")
56
+ return
57
+ for num in available:
58
+ print(f"{num} - Module {num}")
59
+ for name in sorted(named):
60
+ print(f"{name} - Named file")
61
+ return
62
+
63
+ if cmd.isdigit():
64
+ module_num = int(cmd)
65
+ if module_num not in available:
66
+ if not available:
67
+ print("Error: No modules are available.")
68
+ else:
69
+ min_mod, max_mod = available[0], available[-1]
70
+ print(
71
+ f"Error: Module {module_num} not found. "
72
+ f"Available range: {min_mod} to {max_mod}."
73
+ )
74
+ sys.exit(1)
75
+
76
+ file_name = f"m{module_num:02d}.py"
77
+ module_file = resources.files("pyinspect_cli.modules").joinpath(file_name)
78
+ print(module_file.read_text(encoding="utf-8"))
79
+ elif cmd.lower() in named:
80
+ print(named[cmd.lower()].read_text(encoding="utf-8"))
81
+ else:
82
+ print(f"Error: Invalid command or module number/name '{cmd}'.")
83
+ _print_usage()
84
+ sys.exit(1)
85
+
86
+ if __name__ == "__main__":
87
+ main()
@@ -0,0 +1,22 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using System.Threading.Tasks;
5
+ using Microsoft.AspNetCore.Mvc;
6
+
7
+ namespace WebApplication17.Controllers
8
+ {
9
+ public class HelloController : Controller
10
+ {
11
+ public IActionResult Index()
12
+ {
13
+ return View();
14
+ }
15
+
16
+ [HttpGet("{name}")]
17
+ public string GetHello(string name)
18
+ {
19
+ return $"Hello {name} from .NET";
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,5 @@
1
+ import requests
2
+ url = "https://localhost:44380/Ash"
3
+ response = requests.get(url, verify = False)
4
+ print(response.text)
5
+ # python -m pip install requests
File without changes
@@ -0,0 +1,37 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using System.Web;
5
+ using System.Web.Services;
6
+
7
+ namespace WebApplication15
8
+ {
9
+ /// <summary>
10
+ /// Summary description for WebService1
11
+ /// </summary>
12
+ [WebService(Namespace = "http://tempuri.org/")]
13
+ [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
14
+ [System.ComponentModel.ToolboxItem(false)]
15
+ // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
16
+ // [System.Web.Script.Services.ScriptService]
17
+ public class WebService1 : System.Web.Services.WebService
18
+ {
19
+
20
+
21
+
22
+ [WebMethod]
23
+ public double CelsiusToFarenheit(double cel)
24
+ {
25
+ return (cel * 9 / 5) + 32;
26
+ }
27
+
28
+
29
+ [WebMethod]
30
+ public double FarenheitToCelsius(double fahr)
31
+ {
32
+ return (fahr - 32) * 5 / 9;
33
+ }
34
+ }
35
+
36
+ }
37
+
@@ -0,0 +1,42 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using System.Web;
5
+ using System.Web.UI;
6
+ using System.Web.UI.WebControls;
7
+
8
+ namespace WebApplication15
9
+ {
10
+ public partial class WebForm1 : System.Web.UI.Page
11
+ {
12
+ protected void Page_Load(object sender, EventArgs e)
13
+ {
14
+
15
+ }
16
+
17
+ protected void ctof_Click(object sender, EventArgs e)
18
+ {
19
+ WebService1 t = new WebService1();
20
+
21
+
22
+ fah.Text = t.CelsiusToFarenheit(
23
+ Double.Parse(celbox.Text)
24
+ ).ToString();
25
+
26
+
27
+ }
28
+
29
+ protected void ctoc_Click(object sender, EventArgs e)
30
+ {
31
+ WebService1 t = new WebService1();
32
+
33
+
34
+ cel.Text = t.FarenheitToCelsius(
35
+ Double.Parse(fahbox.Text)
36
+ ).ToString();
37
+
38
+ }
39
+ }
40
+ }
41
+
42
+ #<asp:TextBox ID="celbox" runat="server"></asp:TextBox></p>
@@ -0,0 +1,36 @@
1
+ package com.mycompany.prac10;
2
+
3
+
4
+ import javax.jws.WebService;
5
+ import javax.jws.WebMethod;
6
+
7
+
8
+ @WebService
9
+ public class HelloService {
10
+
11
+
12
+ @WebMethod
13
+ public String sayHello(String name) {
14
+ return "Hello " + name;
15
+ }
16
+ }
17
+ #cube
18
+
19
+ package com.mycompany.prac10;
20
+
21
+ import javax.jws.WebService;
22
+ import javax.jws.WebMethod;
23
+
24
+ @WebService
25
+ public class NumberService {
26
+
27
+ @WebMethod
28
+ public int square(int num) {
29
+ return num * num;
30
+ }
31
+
32
+ @WebMethod
33
+ public int cube(int num) {
34
+ return num * num * num;
35
+ }
36
+ }
@@ -0,0 +1,21 @@
1
+ import java.net.URL;
2
+ import javax.xml.namespace.QName;
3
+ import javax.xml.ws.Service;
4
+
5
+ public class Client {
6
+ public static void main(String[] args) throws Exception {
7
+
8
+ URL url = new URL("http://localhost:8080/YourProjectName/NumberService?wsdl");
9
+
10
+ QName qname = new QName("http://prac10.mycompany.com/", "NumberServiceService");
11
+
12
+ Service service = Service.create(url, qname);
13
+
14
+ NumberService obj = service.getPort(NumberService.class);
15
+
16
+ int num = 5;
17
+
18
+ System.out.println("Square: " + obj.square(num));
19
+ System.out.println("Cube: " + obj.cube(num));
20
+ }
21
+ }
@@ -0,0 +1,24 @@
1
+ from flask import Flask, request, jsonify
2
+ app=Flask(__name__)
3
+
4
+ @app.route("/")
5
+ def home():
6
+ return "it is running"
7
+
8
+ @app.route("/num", methods=["GET", "POST"])
9
+ def num():
10
+ if request.method=="POST":
11
+ data=request.get_json()
12
+ a=data.get("a")
13
+ b=data.get("b")
14
+ c=data.get("c")
15
+ else:
16
+ a=int(request.args.get("a"))
17
+ b=int(request.args.get("b"))
18
+ c=int(request.args.get("c"))
19
+
20
+ return jsonify({"max": max(a,b,c)})
21
+
22
+
23
+ if __name__=="__main__":
24
+ app.run(debug=True)
@@ -0,0 +1,21 @@
1
+ from flask import Flask, request, jsonify
2
+
3
+ app = Flask(__name__)
4
+
5
+ @app.route("/")
6
+ def home():
7
+ return "Multiplication Table Service Running"
8
+
9
+ @app.route("/table", methods=["GET", "POST"])
10
+ def table():
11
+ if request.method == "POST":
12
+ data = request.get_json()
13
+ num = data.get("num")
14
+ else:
15
+ num = int(request.args.get("num"))
16
+
17
+ result = {i: num * i for i in range(1, 11)}
18
+ return jsonify(result)
19
+
20
+ if __name__ == "__main__":
21
+ app.run(debug=True)
@@ -0,0 +1,25 @@
1
+ #add?a=10&b=6
2
+ from flask import Flask, jsonify, request
3
+
4
+ app = Flask(__name__)
5
+
6
+ @app.route("/")
7
+ def home():
8
+ return "Python Web Service is running!"
9
+
10
+ @app.route("/hello")
11
+ def hello():
12
+ return jsonify({"message": "Hello from Python Web Service"})
13
+
14
+ @app.route("/add", methods=["GET", "POST"])
15
+ def add():
16
+ if request.method == "POST":
17
+ data = request.get_json()
18
+ a, b = data.get("a"), data.get("b")
19
+ else:
20
+ a, b = int(request.args.get("a")), int(request.args.get("b"))
21
+
22
+ return jsonify({"result": a + b})
23
+
24
+ if __name__ == "__main__":
25
+ app.run(debug=True)
@@ -0,0 +1,9 @@
1
+ import requests
2
+
3
+ data = {"num": 5}
4
+
5
+ res = requests.post("http://127.0.0.1:5000/table", json=data)
6
+
7
+ print(res.json())
8
+
9
+ #pip install flask requests
@@ -0,0 +1,7 @@
1
+ import requests
2
+
3
+ data = {"a": 5, "b": 10, "c": 3}
4
+
5
+ res = requests.post("http://127.0.0.1:5000/num", json=data)
6
+
7
+ print(res.json())
@@ -0,0 +1,11 @@
1
+ import requests
2
+
3
+ url = "https://localhost:44343/WebService1.asmx/FarenheitToCelsius"
4
+
5
+ data = {
6
+ "fahr": 210
7
+ }
8
+
9
+ req = requests.post(url, data=data, verify=False)
10
+ print(req.text)
11
+ #python -m pip install requests
@@ -0,0 +1,31 @@
1
+ from flask import Flask, jsonify, request
2
+
3
+ app = Flask(__name__)
4
+
5
+ students = {
6
+ 1: {"name": "Alice", "marks": 85},
7
+ 2: {"name": "Bob", "marks": 90},
8
+ 3: {"name": "Charlie", "marks": 78}
9
+ }
10
+
11
+ @app.route("/")
12
+ def home():
13
+ return "Student Service Running"
14
+
15
+ @app.route("/students")
16
+ def get_students():
17
+ return jsonify(students)
18
+
19
+ @app.route("/students/<int:id>")
20
+ def get_student(id):
21
+ return jsonify(students.get(id, {"error": "Not found"}))
22
+
23
+ @app.route("/students", methods=["POST"])
24
+ def add_student():
25
+ data = request.get_json()
26
+ students[data["id"]] = {"name": data["name"], "marks": data["marks"]}
27
+ return jsonify({"msg": "Added"})
28
+
29
+ if __name__ == "__main__":
30
+ app.run(debug=True)
31
+ #add?id=4&name=David&marks=88
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <endpoints
3
+ xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
4
+ version="2.0">
5
+
6
+
7
+ <endpoint
8
+ name="HelloService"
9
+ implementation="com.mycompany.prac10.HelloService"
10
+ url-pattern="/HelloService"/>
11
+ </endpoints>
12
+
13
+ #cube
14
+ <?xml version="1.0" encoding="UTF-8"?>
15
+ <endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
16
+ version="2.0">
17
+
18
+ <endpoint
19
+ name="NumberService"
20
+ implementation="com.mycompany.prac10.NumberService"
21
+ url-pattern="/NumberService" />
22
+
23
+ </endpoints>
@@ -0,0 +1,53 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3
+ version="3.1">
4
+
5
+
6
+ <listener>
7
+ <listener-class>
8
+ com.sun.xml.ws.transport.http.servlet.WSServletContextListener
9
+ </listener-class>
10
+ </listener>
11
+
12
+
13
+ <servlet>
14
+ <servlet-name>HelloService</servlet-name>
15
+ <servlet-class>
16
+ com.sun.xml.ws.transport.http.servlet.WSServlet
17
+ </servlet-class>
18
+ </servlet>
19
+
20
+
21
+ <servlet-mapping>
22
+ <servlet-name>HelloService</servlet-name>
23
+ <url-pattern>/HelloService</url-pattern>
24
+ </servlet-mapping>
25
+
26
+
27
+ </web-app>
28
+
29
+
30
+ #cube
31
+ <?xml version="1.0" encoding="UTF-8"?>
32
+ <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
33
+ version="3.1">
34
+
35
+ <listener>
36
+ <listener-class>
37
+ com.sun.xml.ws.transport.http.servlet.WSServletContextListener
38
+ </listener-class>
39
+ </listener>
40
+
41
+ <servlet>
42
+ <servlet-name>NumberService</servlet-name>
43
+ <servlet-class>
44
+ com.sun.xml.ws.transport.http.servlet.WSServlet
45
+ </servlet-class>
46
+ </servlet>
47
+
48
+ <servlet-mapping>
49
+ <servlet-name>NumberService</servlet-name>
50
+ <url-pattern>/NumberService</url-pattern>
51
+ </servlet-mapping>
52
+
53
+ </web-app>
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pyestrombe"
7
+ version = "0.2.1"
8
+ description = "A CLI tool to inspect practical source codes"
9
+ authors = [
10
+ { name = "Developer", email = "developer@example.com" }
11
+ ]
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ [project.scripts]
21
+ pyestrombe = "pyinspect_cli.cli:main"
22
+
23
+ [tool.setuptools]
24
+ packages = ["pyinspect_cli", "pyinspect_cli.modules"]
25
+
26
+ [tool.setuptools.package-data]
27
+ "pyinspect_cli.modules" = ["*.py", "*.txt", "*.text"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+