scratch-syntax 0.7.1__tar.gz → 0.7.3__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.7.1
3
+ Version: 0.7.3
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
@@ -15,7 +15,7 @@ Dynamic: license-file
15
15
 
16
16
  # Scratch_Syntax
17
17
 
18
- ## This is a custom Python library designed make python syntax more like scratch.
18
+ ## This is a custom Python library designed to make python syntax more like scratch.
19
19
 
20
20
  # Installation
21
21
 
@@ -71,6 +71,12 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
71
71
  ## Update 0.7.0 notes. Keyboard update!!!
72
72
  * Added keyboard function (when_key_pressed())!!!
73
73
 
74
+ ## Update 0.7.2 note:
75
+ * I changed the wait_until function a bit so now it goes ```wait_until(condition) ``` instead of ```wait_until(action, condition)```
76
+
77
+ ## Update 0.7.3:
78
+ * Made the ```when_key_pressed()``` and ```wait_until()``` functions faster
79
+
74
80
 
75
81
 
76
82
  # All Functions
@@ -79,3 +85,24 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
79
85
  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()
80
86
 
81
87
  ```
88
+ Also heres an example code
89
+ ```python
90
+ from scratch_syntax import *
91
+
92
+ say("welcome to this beautiful thing!")
93
+ ask("hmm what do you think? answer yes please ")
94
+ wait_until(answer() == "yes")
95
+ say("hahaha no way you said it!!!")
96
+ repeat_until(
97
+ lambda: (
98
+ say_for_seconds("hello guys!", 1),
99
+ ask("stop running?"),
100
+ ),
101
+ lambda: answer() == "yes",
102
+ )
103
+ say("done!")
104
+ say("now it is time for us to part!")
105
+ repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
106
+ wait(1)
107
+ stop_all()
108
+ ```
@@ -1,6 +1,6 @@
1
1
  # Scratch_Syntax
2
2
 
3
- ## This is a custom Python library designed make python syntax more like scratch.
3
+ ## This is a custom Python library designed to make python syntax more like scratch.
4
4
 
5
5
  # Installation
6
6
 
@@ -56,6 +56,12 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
56
56
  ## Update 0.7.0 notes. Keyboard update!!!
57
57
  * Added keyboard function (when_key_pressed())!!!
58
58
 
59
+ ## Update 0.7.2 note:
60
+ * I changed the wait_until function a bit so now it goes ```wait_until(condition) ``` instead of ```wait_until(action, condition)```
61
+
62
+ ## Update 0.7.3:
63
+ * Made the ```when_key_pressed()``` and ```wait_until()``` functions faster
64
+
59
65
 
60
66
 
61
67
  # All Functions
@@ -64,3 +70,24 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
64
70
  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()
65
71
 
66
72
  ```
73
+ Also heres an example code
74
+ ```python
75
+ from scratch_syntax import *
76
+
77
+ say("welcome to this beautiful thing!")
78
+ ask("hmm what do you think? answer yes please ")
79
+ wait_until(answer() == "yes")
80
+ say("hahaha no way you said it!!!")
81
+ repeat_until(
82
+ lambda: (
83
+ say_for_seconds("hello guys!", 1),
84
+ ask("stop running?"),
85
+ ),
86
+ lambda: answer() == "yes",
87
+ )
88
+ say("done!")
89
+ say("now it is time for us to part!")
90
+ repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
91
+ wait(1)
92
+ stop_all()
93
+ ```
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scratch_syntax"
7
- version = "0.7.1"
7
+ version = "0.7.3"
8
8
  authors = [
9
- { name="Cade", email="cadey.matignas@gmail.com" },
9
+ { name="Cade", email="cadey.matignas@gmail.com" },
10
10
  ]
11
11
  description = "A syntax library designed to help scratch users transition to python"
12
12
  readme = "README.md"
@@ -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
+ """Picks a random number. example: pick_random_numer_from(1,100)"""
40
+ return randint(a, b)
41
+
42
+
43
+ def stop_all():
44
+ sys.exit(0)
45
+
46
+
47
+ def add_to_list(listname, item):
48
+ listname.append(item)
49
+
50
+
51
+ def insert_in_list(listname, index, item):
52
+ listname.insert(index, item)
53
+
54
+
55
+ def delete_from_list(listname, index):
56
+ listname.pop(index)
57
+
58
+
59
+ def delete_all_from_list(listname):
60
+ listname.clear()
61
+
62
+
63
+ def replace_in_list(listname, index, item):
64
+ listname[index] = item
65
+
66
+
67
+ def wait_until(condit):
68
+ while not condit:
69
+ sleep(0.01)
70
+
71
+
72
+ def repeat(action, timy):
73
+ for _ in range(timy):
74
+ action()
75
+
76
+
77
+ def forever(actiono):
78
+ while True:
79
+ actiono()
80
+
81
+
82
+ def repeat_until(actionon, condition):
83
+ """This one repeats until condition becomes true"""
84
+ while True:
85
+ actionon()
86
+ if condition():
87
+ break
88
+
89
+
90
+ def when_key_pressed(key):
91
+ """This function checks when key is pressed"""
92
+ if is_pressed(key):
93
+ sleep(0.01)
94
+ return True
95
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scratch_syntax
3
- Version: 0.7.1
3
+ Version: 0.7.3
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
@@ -15,7 +15,7 @@ Dynamic: license-file
15
15
 
16
16
  # Scratch_Syntax
17
17
 
18
- ## This is a custom Python library designed make python syntax more like scratch.
18
+ ## This is a custom Python library designed to make python syntax more like scratch.
19
19
 
20
20
  # Installation
21
21
 
@@ -71,6 +71,12 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
71
71
  ## Update 0.7.0 notes. Keyboard update!!!
72
72
  * Added keyboard function (when_key_pressed())!!!
73
73
 
74
+ ## Update 0.7.2 note:
75
+ * I changed the wait_until function a bit so now it goes ```wait_until(condition) ``` instead of ```wait_until(action, condition)```
76
+
77
+ ## Update 0.7.3:
78
+ * Made the ```when_key_pressed()``` and ```wait_until()``` functions faster
79
+
74
80
 
75
81
 
76
82
  # All Functions
@@ -79,3 +85,24 @@ Also btw don't forget to put from scratch_syntax import * so the functions run c
79
85
  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()
80
86
 
81
87
  ```
88
+ Also heres an example code
89
+ ```python
90
+ from scratch_syntax import *
91
+
92
+ say("welcome to this beautiful thing!")
93
+ ask("hmm what do you think? answer yes please ")
94
+ wait_until(answer() == "yes")
95
+ say("hahaha no way you said it!!!")
96
+ repeat_until(
97
+ lambda: (
98
+ say_for_seconds("hello guys!", 1),
99
+ ask("stop running?"),
100
+ ),
101
+ lambda: answer() == "yes",
102
+ )
103
+ say("done!")
104
+ say("now it is time for us to part!")
105
+ repeat_until(lambda: ask("would you like to leave?"), lambda: answer() == "yes")
106
+ wait(1)
107
+ stop_all()
108
+ ```
@@ -1,95 +0,0 @@
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
File without changes
File without changes