zeushell 1.0.2__tar.gz → 1.1.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zeushell
3
- Version: 1.0.2
3
+ Version: 1.1.5
4
4
  Summary: A small Python package published to PyPI
5
5
  Author-email: Zeus <zeus@gmail.com>
6
6
  License: MIT
@@ -31,9 +31,12 @@ pip install zeushell
31
31
  from zeushell import Zeushell
32
32
 
33
33
  z = Zeushell()
34
- @z.function()
34
+ @z.function("hello")
35
35
  def hi(user):
36
36
  return "Hello "+user
37
+ @z.function()
38
+ def add(one,two):
39
+ return one+two
37
40
 
38
41
  z.name("zeushell")
39
42
  z.run()
@@ -42,8 +45,10 @@ z.run()
42
45
  Shell:
43
46
 
44
47
  ```
45
- zeushell: hi Tom
46
- hi Tom
48
+ zeushell: hello Tom
49
+ Hello Tom
50
+ zeushell: add 3 4
51
+ 7
47
52
  ```
48
53
 
49
54
  ## License
@@ -21,9 +21,12 @@ pip install zeushell
21
21
  from zeushell import Zeushell
22
22
 
23
23
  z = Zeushell()
24
- @z.function()
24
+ @z.function("hello")
25
25
  def hi(user):
26
26
  return "Hello "+user
27
+ @z.function()
28
+ def add(one,two):
29
+ return one+two
27
30
 
28
31
  z.name("zeushell")
29
32
  z.run()
@@ -32,8 +35,10 @@ z.run()
32
35
  Shell:
33
36
 
34
37
  ```
35
- zeushell: hi Tom
36
- hi Tom
38
+ zeushell: hello Tom
39
+ Hello Tom
40
+ zeushell: add 3 4
41
+ 7
37
42
  ```
38
43
 
39
44
  ## License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "zeushell"
3
- version = "1.0.2"
3
+ version = "1.1.5"
4
4
  description ="A small Python package published to PyPI"
5
5
  authors = [
6
6
  {name = "Zeus", email = "zeus@gmail.com"}
@@ -0,0 +1,53 @@
1
+
2
+ class Zeushell:
3
+ def __init__(self):
4
+ self.whitelist = {}
5
+ self.shellname = "Zeushell: "
6
+
7
+ def name(self, a):
8
+ self.shellname = a + ": "
9
+
10
+ def function(self, name=None):
11
+ def dd(func):
12
+ self.whitelist[name or func.__name__] = func
13
+ return func
14
+ return dd
15
+
16
+ def run(self):
17
+ while True:
18
+ try:
19
+ ino = input(self.shellname)
20
+ except (EOFError, KeyboardInterrupt):
21
+ print()
22
+ break
23
+
24
+ s = ino.split()
25
+
26
+ if not s:
27
+ continue
28
+
29
+ command = s[0]
30
+
31
+ if command not in self.whitelist:
32
+ print("You didn't have " + command + " function")
33
+ continue
34
+
35
+ args = []
36
+
37
+ for x in s[1:]:
38
+ try:
39
+ x = int(x)
40
+ except ValueError:
41
+ try:
42
+ x = float(x)
43
+ except ValueError:
44
+ pass
45
+
46
+ args.append(x)
47
+
48
+ try:
49
+ self.whitelist[command](*args)
50
+ except Exception as e:
51
+ print(f"Function error: {e}")
52
+
53
+ return 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zeushell
3
- Version: 1.0.2
3
+ Version: 1.1.5
4
4
  Summary: A small Python package published to PyPI
5
5
  Author-email: Zeus <zeus@gmail.com>
6
6
  License: MIT
@@ -31,9 +31,12 @@ pip install zeushell
31
31
  from zeushell import Zeushell
32
32
 
33
33
  z = Zeushell()
34
- @z.function()
34
+ @z.function("hello")
35
35
  def hi(user):
36
36
  return "Hello "+user
37
+ @z.function()
38
+ def add(one,two):
39
+ return one+two
37
40
 
38
41
  z.name("zeushell")
39
42
  z.run()
@@ -42,8 +45,10 @@ z.run()
42
45
  Shell:
43
46
 
44
47
  ```
45
- zeushell: hi Tom
46
- hi Tom
48
+ zeushell: hello Tom
49
+ Hello Tom
50
+ zeushell: add 3 4
51
+ 7
47
52
  ```
48
53
 
49
54
  ## License
@@ -1,60 +0,0 @@
1
- class Zeushell:
2
- def __init__(self):
3
- qqqqqqq=open("w.txt","w")
4
- qqqqqqq.write("[]")
5
- qqqqqqq.close()
6
- def name(a):
7
- global shellname
8
- shellname=a
9
- def function():
10
- import ast
11
- def dd(func):
12
- try:
13
- qqqqqqq=open("w.txt","r")
14
- funclist=ast.literal_eval(qqqqqqq.read())
15
- qqqqqqq.close()
16
- except:
17
- funclist=[]
18
- funclist.append(func.__name__)
19
- qqqqqqq=open("w.txt","w")
20
- qqqqqqq.write(str(funclist))
21
- qqqqqqq.close()
22
- return func
23
- return dd
24
- def run():
25
- import __main__
26
- import ast
27
- kwargs = {}
28
- try:
29
- shellname+=": "
30
- except:
31
- shellname="Zeushell: "
32
- while True:
33
- ino=input(shellname)
34
- s=ino.split()
35
- njdo=[]
36
- for i in s:
37
- try:
38
- siu=int(i)
39
- njdo.append(siu)
40
- except:
41
- njdo.append(i)
42
- s=njdo
43
- if s==[]:
44
- continue
45
- aaaaa=s[0]
46
- qqqqqqq=open("w.txt","r")
47
- wigeiu=qqqqqqq.read()
48
- qqqqqqq.close()
49
- if aaaaa not in ast.literal_eval(wigeiu):
50
- print('You didn\'t have '+aaaaa+' function')
51
- continue
52
- try:
53
- s=s[1:]
54
- except:
55
- s=[]
56
- try:
57
- __main__.__dict__[aaaaa](*s, **kwargs)
58
- except:
59
- print("function wrong")
60
- return 1
File without changes