scratch-syntax 0.6.1__tar.gz → 0.7.0__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.4
2
2
  Name: scratch_syntax
3
- Version: 0.6.1
3
+ Version: 0.7.0
4
4
  Summary: A syntax library designed to help scratch users transition to python
5
5
  Author-email: Cade <cadey.matignas@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/cadeymatignas-source/scratch_syntax
@@ -61,15 +61,20 @@ pip install --upgrade scratch_syntax
61
61
 
62
62
  repeat(lambda: say("hello!"), 5)
63
63
  forever(lambda: say("hiya!"))
64
- repeat_until(lambda: say("do you like this?"), condition())
64
+ repeat_until(lambda: say("do you like this?"), lambda: condition())
65
65
 
66
66
  ```
67
67
 
68
68
  Also btw don't forget to put from scratch_syntax import * so the functions run correctly as is
69
+
70
+ ## Update 0.7.0 notes. Keyboard update!!!
71
+ * Added keyboard function (when_key_pressed())!!!
72
+
73
+
69
74
 
70
75
  # All Functions
71
76
 
72
77
  ```bash
73
- say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until()
78
+ say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed()
74
79
 
75
80
  ```
@@ -47,15 +47,20 @@ pip install --upgrade scratch_syntax
47
47
 
48
48
  repeat(lambda: say("hello!"), 5)
49
49
  forever(lambda: say("hiya!"))
50
- repeat_until(lambda: say("do you like this?"), condition())
50
+ repeat_until(lambda: say("do you like this?"), lambda: condition())
51
51
 
52
52
  ```
53
53
 
54
54
  Also btw don't forget to put from scratch_syntax import * so the functions run correctly as is
55
+
56
+ ## Update 0.7.0 notes. Keyboard update!!!
57
+ * Added keyboard function (when_key_pressed())!!!
58
+
59
+
55
60
 
56
61
  # All Functions
57
62
 
58
63
  ```bash
59
- say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until()
64
+ say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed()
60
65
 
61
66
  ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scratch_syntax"
7
- version = "0.6.1"
7
+ version = "0.7.0"
8
8
  authors = [
9
9
  { name="Cade", email="cadey.matignas@gmail.com" },
10
10
  ]
@@ -0,0 +1,95 @@
1
+ __lazy_modules__ = ["random", "time", "sys", "keyboard"]
2
+
3
+ import sys
4
+ from random import randint
5
+ from time import sleep
6
+
7
+ from keyboard import is_pressed
8
+
9
+ _scratch_data = {"answer": ""}
10
+
11
+
12
+ def say(text):
13
+ """This function says text. etc. say("hello")"""
14
+ print(text)
15
+
16
+
17
+ def say_for_seconds(texty, secs):
18
+ """This function is basically saying text then waiting. etc. say_for_seconds("hello", 2)"""
19
+ print(texty)
20
+ sleep(secs)
21
+
22
+
23
+ def ask(question):
24
+ """This one is like scratch's ask then wait function"""
25
+ _scratch_data["answer"] = input(question)
26
+ return _scratch_data["answer"]
27
+
28
+
29
+ def answer():
30
+ return _scratch_data["answer"]
31
+
32
+
33
+ def wait(seconds):
34
+ """This function waits. etc. wait(1)"""
35
+ sleep(seconds)
36
+
37
+
38
+ def pick_random_number_from(a, b):
39
+ return randint(a, b)
40
+
41
+
42
+ def stop_all():
43
+ sys.exit(0)
44
+
45
+
46
+ def add_to_list(listname, item):
47
+ listname.append(item)
48
+
49
+
50
+ def insert_in_list(listname, index, item):
51
+ listname.insert(index, item)
52
+
53
+
54
+ def delete_from_list(listname, index):
55
+ listname.pop(index)
56
+
57
+
58
+ def delete_all_from_list(listname):
59
+ listname.clear()
60
+
61
+
62
+ def replace_in_list(listname, index, item):
63
+ listname[index] = item
64
+
65
+
66
+ def wait_until(varibab, condit):
67
+ while varibab != condit:
68
+ sleep(1)
69
+
70
+
71
+ def repeat(action, timy):
72
+ for _ in range(timy):
73
+ action()
74
+
75
+
76
+ def forever(actiono):
77
+ while True:
78
+ actiono()
79
+
80
+
81
+ def repeat_until(actionon, condition):
82
+ """This one repeats until condition becomes true"""
83
+ while True:
84
+ actionon()
85
+ if condition():
86
+ break
87
+
88
+
89
+ def when_key_pressed(key):
90
+ """This function checks when key is pressed"""
91
+ if is_pressed(key):
92
+ while is_pressed(key):
93
+ sleep(0.1)
94
+ return True
95
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scratch_syntax
3
- Version: 0.6.1
3
+ Version: 0.7.0
4
4
  Summary: A syntax library designed to help scratch users transition to python
5
5
  Author-email: Cade <cadey.matignas@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/cadeymatignas-source/scratch_syntax
@@ -61,15 +61,20 @@ pip install --upgrade scratch_syntax
61
61
 
62
62
  repeat(lambda: say("hello!"), 5)
63
63
  forever(lambda: say("hiya!"))
64
- repeat_until(lambda: say("do you like this?"), condition())
64
+ repeat_until(lambda: say("do you like this?"), lambda: condition())
65
65
 
66
66
  ```
67
67
 
68
68
  Also btw don't forget to put from scratch_syntax import * so the functions run correctly as is
69
+
70
+ ## Update 0.7.0 notes. Keyboard update!!!
71
+ * Added keyboard function (when_key_pressed())!!!
72
+
73
+
69
74
 
70
75
  # All Functions
71
76
 
72
77
  ```bash
73
- say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until()
78
+ say(), ask(), wait(), pick_random_number_from(), stop_all(), add_to_list(), insert_in_list(), delete_from_list(), delete_all_from_list(), replace_from_list(), answer(), say_for_seconds(), wait_until(), repeat(), forever(), repeat_until(), when_key_pressed()
74
79
 
75
80
  ```
@@ -1,80 +0,0 @@
1
- import sys
2
-
3
- __lazy_modules__ = ["random", "time"]
4
-
5
- from random import randint
6
- from time import sleep
7
-
8
- _scratch_data = {"answer": ""}
9
-
10
-
11
- def say(text):
12
- print(text)
13
-
14
-
15
- def say_for_seconds(texty, secs):
16
- print(texty)
17
- sleep(secs)
18
-
19
-
20
- def ask(question):
21
- _scratch_data["answer"] = input(question)
22
- return _scratch_data["answer"]
23
-
24
-
25
- def answer():
26
- return _scratch_data["answer"]
27
-
28
-
29
- def wait(seconds):
30
- sleep(seconds)
31
-
32
-
33
- def pick_random_number_from(a, b):
34
- return randint(a, b)
35
-
36
-
37
- def stop_all():
38
- sys.exit(0)
39
-
40
-
41
- def add_to_list(listname, item):
42
- listname.append(item)
43
-
44
-
45
- def insert_in_list(listname, index, item):
46
- listname.insert(index, item)
47
-
48
-
49
- def delete_from_list(listname, index):
50
- listname.pop(index)
51
-
52
-
53
- def delete_all_from_list(listname):
54
- listname.clear()
55
-
56
-
57
- def replace_in_list(listname, index, item):
58
- listname[index] = item
59
-
60
-
61
- def wait_until(varibab, condit):
62
- while varibab != condit:
63
- sleep(1)
64
-
65
-
66
- def repeat(action, timy):
67
- for _ in range(timy):
68
- action()
69
-
70
-
71
- def forever(actiono):
72
- while True:
73
- actiono()
74
-
75
-
76
- def repeat_until(actionon, condition):
77
- while True:
78
- actionon()
79
- if condition():
80
- break
File without changes
File without changes