scratch-syntax 0.6.0__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.
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/PKG-INFO +12 -5
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/README.md +11 -4
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/pyproject.toml +1 -1
- scratch_syntax-0.7.0/src/scratch_syntax/core.py +95 -0
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/src/scratch_syntax.egg-info/PKG-INFO +12 -5
- scratch_syntax-0.6.0/src/scratch_syntax/core.py +0 -81
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/LICENSE +0 -0
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/setup.cfg +0 -0
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/src/scratch_syntax/__init__.py +0 -0
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/src/scratch_syntax.egg-info/SOURCES.txt +0 -0
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/src/scratch_syntax.egg-info/dependency_links.txt +0 -0
- {scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/src/scratch_syntax.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scratch_syntax
|
|
3
|
-
Version: 0.
|
|
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
|
|
@@ -16,7 +16,7 @@ Dynamic: license-file
|
|
|
16
16
|
|
|
17
17
|
## This is a custom Python library designed make python syntax more like scratch.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# Installation
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
|
|
@@ -55,19 +55,26 @@ pip install --upgrade scratch_syntax
|
|
|
55
55
|
|
|
56
56
|
## Update 0.6.0. ReRun's UPDATE!!!
|
|
57
57
|
* The return of classic repeats... in a different way!!!
|
|
58
|
-
* Added new
|
|
58
|
+
* Added new repeat_until() function!!!
|
|
59
59
|
* Now needs the lambda function. etc:
|
|
60
60
|
```bash
|
|
61
61
|
|
|
62
62
|
repeat(lambda: say("hello!"), 5)
|
|
63
|
+
forever(lambda: say("hiya!"))
|
|
64
|
+
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
63
65
|
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
|
|
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
|
+
|
|
67
74
|
|
|
68
75
|
# All Functions
|
|
69
76
|
|
|
70
77
|
```bash
|
|
71
|
-
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()
|
|
72
79
|
|
|
73
80
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## This is a custom Python library designed make python syntax more like scratch.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
|
|
@@ -41,19 +41,26 @@ pip install --upgrade scratch_syntax
|
|
|
41
41
|
|
|
42
42
|
## Update 0.6.0. ReRun's UPDATE!!!
|
|
43
43
|
* The return of classic repeats... in a different way!!!
|
|
44
|
-
* Added new
|
|
44
|
+
* Added new repeat_until() function!!!
|
|
45
45
|
* Now needs the lambda function. etc:
|
|
46
46
|
```bash
|
|
47
47
|
|
|
48
48
|
repeat(lambda: say("hello!"), 5)
|
|
49
|
+
forever(lambda: say("hiya!"))
|
|
50
|
+
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
49
51
|
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
|
|
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
|
+
|
|
53
60
|
|
|
54
61
|
# All Functions
|
|
55
62
|
|
|
56
63
|
```bash
|
|
57
|
-
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()
|
|
58
65
|
|
|
59
66
|
```
|
|
@@ -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.
|
|
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
|
|
@@ -16,7 +16,7 @@ Dynamic: license-file
|
|
|
16
16
|
|
|
17
17
|
## This is a custom Python library designed make python syntax more like scratch.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# Installation
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
|
|
@@ -55,19 +55,26 @@ pip install --upgrade scratch_syntax
|
|
|
55
55
|
|
|
56
56
|
## Update 0.6.0. ReRun's UPDATE!!!
|
|
57
57
|
* The return of classic repeats... in a different way!!!
|
|
58
|
-
* Added new
|
|
58
|
+
* Added new repeat_until() function!!!
|
|
59
59
|
* Now needs the lambda function. etc:
|
|
60
60
|
```bash
|
|
61
61
|
|
|
62
62
|
repeat(lambda: say("hello!"), 5)
|
|
63
|
+
forever(lambda: say("hiya!"))
|
|
64
|
+
repeat_until(lambda: say("do you like this?"), lambda: condition())
|
|
63
65
|
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
|
|
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
|
+
|
|
67
74
|
|
|
68
75
|
# All Functions
|
|
69
76
|
|
|
70
77
|
```bash
|
|
71
|
-
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()
|
|
72
79
|
|
|
73
80
|
```
|
|
@@ -1,81 +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 not condition:
|
|
78
|
-
actionon()
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# For anyone reading the code, I skipped the forever and repeat functions not because I wanted to but because it doesnt work: Cade
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scratch_syntax-0.6.0 → scratch_syntax-0.7.0}/src/scratch_syntax.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|