penglang 0.1.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.
- penglang-0.1.1/LICENSE +21 -0
- penglang-0.1.1/PKG-INFO +89 -0
- penglang-0.1.1/README.md +74 -0
- penglang-0.1.1/penglang/__init__.py +9 -0
- penglang-0.1.1/penglang/modules/__init__.py +11 -0
- penglang-0.1.1/penglang/modules/pengmath.py +83 -0
- penglang-0.1.1/penglang/modules/pengwindow.py +158 -0
- penglang-0.1.1/penglang/penglang.py +259 -0
- penglang-0.1.1/penglang.egg-info/PKG-INFO +89 -0
- penglang-0.1.1/penglang.egg-info/SOURCES.txt +12 -0
- penglang-0.1.1/penglang.egg-info/dependency_links.txt +1 -0
- penglang-0.1.1/penglang.egg-info/top_level.txt +2 -0
- penglang-0.1.1/pyproject.toml +23 -0
- penglang-0.1.1/setup.cfg +4 -0
penglang-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bebeday10
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
penglang-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: penglang
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: a nonserious language module for penguins
|
|
5
|
+
Author: bebeday10
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/bebeday10/penglang
|
|
8
|
+
Project-URL: Repository, https://github.com/bebeday10/penglang
|
|
9
|
+
Project-URL: Issues, https://github.com/bebeday10/penglang/issues
|
|
10
|
+
Keywords: language,penguin,nonserious,fun,programming
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# PengLang, that one penguin language
|
|
17
|
+
|
|
18
|
+
Hello and welcome to **PengLang**, this language is created by *Penguins*™, that's why it's called PengLang because *Penguins*™.
|
|
19
|
+
|
|
20
|
+
# Why does this exist
|
|
21
|
+
|
|
22
|
+
I don't know either. Actually, the *Penguins*™ made it.
|
|
23
|
+
Ask them.
|
|
24
|
+
The python snake also helped.
|
|
25
|
+
Ask them.
|
|
26
|
+
|
|
27
|
+
# Things you can do
|
|
28
|
+
The main point is:
|
|
29
|
+
Dancing.
|
|
30
|
+
|
|
31
|
+
Other usual *Penguin*™ things:
|
|
32
|
+
- saying stuff
|
|
33
|
+
- fishing stuff
|
|
34
|
+
- assigning tasks
|
|
35
|
+
- doing tasks
|
|
36
|
+
|
|
37
|
+
These are the main things *Penguin*™ can do in order to *Survive*™.
|
|
38
|
+
Please do these *Things*™.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
Things penguins might do in a while:
|
|
43
|
+
|
|
44
|
+
- penguin do over
|
|
45
|
+
- shouting
|
|
46
|
+
- making a *List*™ to keep track of *Things*™
|
|
47
|
+
- making a *Dictionary*™ because language is hard
|
|
48
|
+
- making a variable because **why *not***
|
|
49
|
+
|
|
50
|
+
These are probable *Things*™.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
Things penguins would do if they had *Friends*™:
|
|
55
|
+
|
|
56
|
+
- answering yes-no questions to help *Friends*™
|
|
57
|
+
- doing a penguin noise because **why *not***
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
Errors
|
|
62
|
+
|
|
63
|
+
- PenguinError: because penguin errorment
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# This is Python what are you thinking
|
|
67
|
+
|
|
68
|
+
No it isn't this is a module of Python
|
|
69
|
+
|
|
70
|
+
# Modules
|
|
71
|
+
|
|
72
|
+
Here are some modules included in PengLang.
|
|
73
|
+
|
|
74
|
+
## Pengmath
|
|
75
|
+
|
|
76
|
+
A basic math module that let's you let *Penguins*™ count because they are *Smart*™.
|
|
77
|
+
|
|
78
|
+
- addition
|
|
79
|
+
- subtraction
|
|
80
|
+
- multiplication
|
|
81
|
+
- division
|
|
82
|
+
|
|
83
|
+
## Pengwindow
|
|
84
|
+
|
|
85
|
+
Make *Windows*™. Add things to *Window*™. Add child *Window*™.
|
|
86
|
+
|
|
87
|
+
# Conclusion
|
|
88
|
+
|
|
89
|
+
This is a penguin-made *"""language"""*.
|
penglang-0.1.1/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# PengLang, that one penguin language
|
|
2
|
+
|
|
3
|
+
Hello and welcome to **PengLang**, this language is created by *Penguins*™, that's why it's called PengLang because *Penguins*™.
|
|
4
|
+
|
|
5
|
+
# Why does this exist
|
|
6
|
+
|
|
7
|
+
I don't know either. Actually, the *Penguins*™ made it.
|
|
8
|
+
Ask them.
|
|
9
|
+
The python snake also helped.
|
|
10
|
+
Ask them.
|
|
11
|
+
|
|
12
|
+
# Things you can do
|
|
13
|
+
The main point is:
|
|
14
|
+
Dancing.
|
|
15
|
+
|
|
16
|
+
Other usual *Penguin*™ things:
|
|
17
|
+
- saying stuff
|
|
18
|
+
- fishing stuff
|
|
19
|
+
- assigning tasks
|
|
20
|
+
- doing tasks
|
|
21
|
+
|
|
22
|
+
These are the main things *Penguin*™ can do in order to *Survive*™.
|
|
23
|
+
Please do these *Things*™.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
Things penguins might do in a while:
|
|
28
|
+
|
|
29
|
+
- penguin do over
|
|
30
|
+
- shouting
|
|
31
|
+
- making a *List*™ to keep track of *Things*™
|
|
32
|
+
- making a *Dictionary*™ because language is hard
|
|
33
|
+
- making a variable because **why *not***
|
|
34
|
+
|
|
35
|
+
These are probable *Things*™.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
Things penguins would do if they had *Friends*™:
|
|
40
|
+
|
|
41
|
+
- answering yes-no questions to help *Friends*™
|
|
42
|
+
- doing a penguin noise because **why *not***
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
Errors
|
|
47
|
+
|
|
48
|
+
- PenguinError: because penguin errorment
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# This is Python what are you thinking
|
|
52
|
+
|
|
53
|
+
No it isn't this is a module of Python
|
|
54
|
+
|
|
55
|
+
# Modules
|
|
56
|
+
|
|
57
|
+
Here are some modules included in PengLang.
|
|
58
|
+
|
|
59
|
+
## Pengmath
|
|
60
|
+
|
|
61
|
+
A basic math module that let's you let *Penguins*™ count because they are *Smart*™.
|
|
62
|
+
|
|
63
|
+
- addition
|
|
64
|
+
- subtraction
|
|
65
|
+
- multiplication
|
|
66
|
+
- division
|
|
67
|
+
|
|
68
|
+
## Pengwindow
|
|
69
|
+
|
|
70
|
+
Make *Windows*™. Add things to *Window*™. Add child *Window*™.
|
|
71
|
+
|
|
72
|
+
# Conclusion
|
|
73
|
+
|
|
74
|
+
This is a penguin-made *"""language"""*.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# this is the math module for the penguin language, it has functions for addition, subtraction, multiplication, division, etc. that use penguin words instead of python keywords
|
|
2
|
+
from .. import penglang as peng
|
|
3
|
+
|
|
4
|
+
def penguin_add(a, b, *args, log: bool = False):
|
|
5
|
+
"""
|
|
6
|
+
add something with addition
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
a (int): The first number to add.
|
|
10
|
+
b (int): The second number to add.
|
|
11
|
+
*args (int): Additional numbers to add.
|
|
12
|
+
log (bool, optional): Whether to log the result. Defaults to False.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
int: The sum of the numbers.
|
|
16
|
+
"""
|
|
17
|
+
total = a + b
|
|
18
|
+
for num in args:
|
|
19
|
+
total += num
|
|
20
|
+
if log:
|
|
21
|
+
peng.say(f"Sum: {total}")
|
|
22
|
+
return total
|
|
23
|
+
|
|
24
|
+
def penguin_subtract(a, b, *args, log: bool = False):
|
|
25
|
+
"""
|
|
26
|
+
subtract something with subtraction
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
a (int): The first number to subtract.
|
|
30
|
+
b (int): The second number to subtract.
|
|
31
|
+
*args (int): Additional numbers to subtract.
|
|
32
|
+
log (bool, optional): Whether to log the result. Defaults to False.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
int: The difference of the numbers.
|
|
36
|
+
"""
|
|
37
|
+
total = a - b
|
|
38
|
+
for num in args:
|
|
39
|
+
total -= num
|
|
40
|
+
if log:
|
|
41
|
+
peng.say(f"Difference: {total}")
|
|
42
|
+
return total
|
|
43
|
+
|
|
44
|
+
def penguin_multiply(a, b, *args, log: bool = False):
|
|
45
|
+
"""
|
|
46
|
+
multiply something with multiplication
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
a (int): The first number to multiply.
|
|
50
|
+
b (int): The second number to multiply.
|
|
51
|
+
*args (int): Additional numbers to multiply.
|
|
52
|
+
log (bool, optional): Whether to log the result. Defaults to False.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
int: The product of the numbers.
|
|
56
|
+
"""
|
|
57
|
+
total = a * b
|
|
58
|
+
for num in args:
|
|
59
|
+
total *= num
|
|
60
|
+
if log:
|
|
61
|
+
peng.say(f"Product: {total}")
|
|
62
|
+
return total
|
|
63
|
+
|
|
64
|
+
def penguin_divide(a, b, *args, log: bool = False):
|
|
65
|
+
"""
|
|
66
|
+
divide something with division
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
a (int): The first number to divide.
|
|
70
|
+
b (int): The second number to divide.
|
|
71
|
+
*args (int): Additional numbers to divide by.
|
|
72
|
+
log (bool, optional): Whether to log the result. Defaults to False.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
float: The quotient of the numbers.
|
|
76
|
+
"""
|
|
77
|
+
total = a / b
|
|
78
|
+
for num in args:
|
|
79
|
+
total /= num
|
|
80
|
+
if log:
|
|
81
|
+
peng.say(f"Quotient: {total}")
|
|
82
|
+
return total
|
|
83
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import tkinter as tk
|
|
2
|
+
from .. import penglang as peng
|
|
3
|
+
|
|
4
|
+
def penguin_window(title="Penguin Window", width=400, height=300,color="lightgray", log: bool = False):
|
|
5
|
+
"""
|
|
6
|
+
add a root window
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
title (str, optional): The title of the window. Defaults to "Penguin Window".
|
|
10
|
+
width (int, optional): The width of the window. Defaults to 400.
|
|
11
|
+
height (int, optional): The height of the window. Defaults to 300.
|
|
12
|
+
color (str, optional): The background color of the window. Defaults to "lightgray".
|
|
13
|
+
log (bool, optional): Whether to log the creation of the window. Defaults to False.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
tk.Tk: the window object that was created
|
|
17
|
+
"""
|
|
18
|
+
window = tk.Tk()
|
|
19
|
+
window.title(title)
|
|
20
|
+
window.geometry(f"{width}x{height}")
|
|
21
|
+
window.configure(bg=color)
|
|
22
|
+
if log:
|
|
23
|
+
peng.say(f"Created a penguin window with title: {title}, width: {width}, height: {height}")
|
|
24
|
+
return window
|
|
25
|
+
|
|
26
|
+
def wait_for_window(target_title, parent, action, log: bool = False, forever_check: bool = False, *action_args, **action_kwargs):
|
|
27
|
+
"""
|
|
28
|
+
wait for a windows existance, then do the action
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
target_title (str): The title of the window to wait for.
|
|
32
|
+
parent (tk.Tk): The parent window.
|
|
33
|
+
action (callable): The function to call when the window is found.
|
|
34
|
+
log (bool, optional): Whether to log the process. Defaults to False.
|
|
35
|
+
forever_check (bool, optional): Whether to keep checking indefinitely. Defaults to False.
|
|
36
|
+
*action_args: Positional arguments to pass to the action function.
|
|
37
|
+
**action_kwargs: Keyword arguments to pass to the action function.
|
|
38
|
+
"""
|
|
39
|
+
target_window = None
|
|
40
|
+
for child in parent.winfo_children():
|
|
41
|
+
if isinstance(child, tk.Toplevel) and child.wm_title() == target_title:
|
|
42
|
+
target_window = child
|
|
43
|
+
break
|
|
44
|
+
|
|
45
|
+
if target_window == None:
|
|
46
|
+
parent.after(100, lambda: wait_for_window(target_title, parent, action, log, forever_check, *action_args, **action_kwargs))
|
|
47
|
+
else:
|
|
48
|
+
if log:
|
|
49
|
+
peng.say(f"Found the target window with title: {target_title}")
|
|
50
|
+
try:
|
|
51
|
+
action(*action_args, **action_kwargs)
|
|
52
|
+
except Exception as e:
|
|
53
|
+
if log:
|
|
54
|
+
peng.say(f"tried to run the action, but the window closed before it could run.")
|
|
55
|
+
if forever_check:
|
|
56
|
+
parent.after(100, lambda: wait_for_window(target_title, parent, action, log, forever_check, *action_args, **action_kwargs))
|
|
57
|
+
|
|
58
|
+
def penguin_label(window, text="Penguin Label", log: bool = False):
|
|
59
|
+
"""
|
|
60
|
+
make a label
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
window (tk.Tk): The window to add the label to.
|
|
64
|
+
text (str, optional): The text for the label. Defaults to "Penguin Label".
|
|
65
|
+
log (bool, optional): Whether to log the creation of the label. Defaults to False.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
tk.Label: The created label widget.
|
|
69
|
+
"""
|
|
70
|
+
label = tk.Label(window, text=text)
|
|
71
|
+
label.pack()
|
|
72
|
+
if log:
|
|
73
|
+
peng.say(f"Created a penguin label with text: {text}")
|
|
74
|
+
return label
|
|
75
|
+
|
|
76
|
+
def penguin_button(window, text="Penguin Button", command=None, log: bool = False):
|
|
77
|
+
"""
|
|
78
|
+
make a button
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
window (tk.Tk): The window to add the button to.
|
|
82
|
+
text (str, optional): The text for the button. Defaults to "Penguin Button".
|
|
83
|
+
command (callable, optional): The function to call when the button is clicked. Defaults to None.
|
|
84
|
+
log (bool, optional): Whether to log the creation of the button. Defaults to False.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
tk.Button: The created button widget.
|
|
88
|
+
"""
|
|
89
|
+
button = tk.Button(window, text=text, command=command)
|
|
90
|
+
button.pack()
|
|
91
|
+
if log:
|
|
92
|
+
peng.say(f"Created a penguin button with text: {text}, command: {command}")
|
|
93
|
+
return button
|
|
94
|
+
|
|
95
|
+
def color_widget(widget, color, log: bool = False):
|
|
96
|
+
widget.configure(bg=color)
|
|
97
|
+
if log:
|
|
98
|
+
peng.say(f"Changed the penguin widget color to: {color}")
|
|
99
|
+
|
|
100
|
+
def penguin_extra_window(title="Penguin Extra Window", width=400, height=300,color="lightgray", log: bool = False): # the problem is you can't add a widget to this window because we don't know if the window exists or not, but we can still create the window and show it!
|
|
101
|
+
"""
|
|
102
|
+
add an extra window
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
title (str, optional): The title of the extra window. Defaults to "Penguin Extra Window".
|
|
106
|
+
width (int, optional): The width of the extra window. Defaults to 400.
|
|
107
|
+
height (int, optional): The height of the extra window. Defaults to 300.
|
|
108
|
+
color (str, optional): The background color of the extra window. Defaults to "lightgray".
|
|
109
|
+
log (bool, optional): Whether to log the creation of the extra window. Defaults to False.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
tk.Toplevel: The created extra window.
|
|
113
|
+
|
|
114
|
+
Note:
|
|
115
|
+
This function cannot be assigned to a variable from a button command, for that, use penguin_window_maker instead.
|
|
116
|
+
"""
|
|
117
|
+
# how do we add a widget once it is created without having to use this function to edit the window
|
|
118
|
+
# i know we can wait for the widget to make it when the window is created so the other funcs like color_widget can find it, but that is a bit hacky, but it is the best I can do with this language
|
|
119
|
+
window = tk.Toplevel()
|
|
120
|
+
window.title(title)
|
|
121
|
+
window.geometry(f"{width}x{height}")
|
|
122
|
+
window.configure(bg=color)
|
|
123
|
+
if log:
|
|
124
|
+
peng.say(f"Created a penguin extra window with title: {title}, width: {width}, height: {height}")
|
|
125
|
+
return window
|
|
126
|
+
|
|
127
|
+
def penguin_window_maker(parent, name, sendfunc,width=400, height=300, log: bool = False):
|
|
128
|
+
"""
|
|
129
|
+
make a window that's assigned to a dictionary
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
parent (tk.Tk): The parent window.
|
|
133
|
+
name (str): The name of the window.
|
|
134
|
+
sendfunc (callable): The function to send the window reference.
|
|
135
|
+
width (int, optional): The width of the window. Defaults to 400.
|
|
136
|
+
height (int, optional): The height of the window. Defaults to 300.
|
|
137
|
+
log (bool, optional): Whether to log the creation of the window. Defaults to False.
|
|
138
|
+
"""
|
|
139
|
+
w = tk.Toplevel(parent)
|
|
140
|
+
w.title(name)
|
|
141
|
+
w.geometry(f"{width}x{height}")
|
|
142
|
+
sendfunc(name, w)
|
|
143
|
+
if log:
|
|
144
|
+
peng.say(f"Created a penguin window with name: {name}, sendfunc: {sendfunc}")
|
|
145
|
+
|
|
146
|
+
def penguin_spacing(window, spacing=10, log: bool = False):
|
|
147
|
+
"""
|
|
148
|
+
add spacing to all widgets in a window
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
window (tk.Toplevel | tk.Tk): The window to add spacing to.
|
|
152
|
+
spacing (int, optional): The amount of spacing to add. Defaults to 10.
|
|
153
|
+
log (bool, optional): Whether to log the action. Defaults to False.
|
|
154
|
+
"""
|
|
155
|
+
for widget in window.winfo_children():
|
|
156
|
+
widget.pack_configure(padx=spacing, pady=spacing)
|
|
157
|
+
if log:
|
|
158
|
+
peng.say(f"Added spacing of {spacing} to all penguin widgets in the window")
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# this is a funny penguin language using python as syntax, but with penguin words instead of python keywords
|
|
2
|
+
"""This is a funny penguin language using python as syntax.
|
|
3
|
+
This language is not meant to be taken seriously, it's just for fun!
|
|
4
|
+
You can use this language to write code that looks like it's written by a penguin, but it's still valid python code!
|
|
5
|
+
things you can do with this language:
|
|
6
|
+
- say things
|
|
7
|
+
- make lists and dictionaries
|
|
8
|
+
- make variables
|
|
9
|
+
- make functions that do things
|
|
10
|
+
- make functions that do things if a condition is true"""
|
|
11
|
+
|
|
12
|
+
def say(message):
|
|
13
|
+
"""
|
|
14
|
+
This is a task that makes penguins say stuff
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
message (Any): the message to say, can be any type, it will be converted to a string before being printed
|
|
18
|
+
"""
|
|
19
|
+
print(message)
|
|
20
|
+
|
|
21
|
+
def fish(thing):
|
|
22
|
+
"""
|
|
23
|
+
fish something (returns item)
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
thing (Any): the item to fish out
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
Any: the item that was fished out
|
|
30
|
+
"""
|
|
31
|
+
return thing # this is a function that does nothing, just for fun
|
|
32
|
+
|
|
33
|
+
def task(function):
|
|
34
|
+
"""
|
|
35
|
+
do a task
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
function (Callable): the function to execute
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
Any: the result of the function execution
|
|
42
|
+
"""
|
|
43
|
+
return function # this is a decorator that does nothing, just for fun
|
|
44
|
+
|
|
45
|
+
def do(function):
|
|
46
|
+
"""
|
|
47
|
+
does a task
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
function (Callable): the function to execute
|
|
51
|
+
"""
|
|
52
|
+
function()
|
|
53
|
+
|
|
54
|
+
# what else to add?
|
|
55
|
+
|
|
56
|
+
def penguin_do_over(iterable):
|
|
57
|
+
"""
|
|
58
|
+
says each item in the iterable
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
iterable (Iterable): the iterable to iterate over
|
|
62
|
+
"""
|
|
63
|
+
if isinstance(iterable, dict):
|
|
64
|
+
for key, value in iterable.items():
|
|
65
|
+
say(f"{key}: {value}")
|
|
66
|
+
else:
|
|
67
|
+
for item in iterable:
|
|
68
|
+
say(item)
|
|
69
|
+
|
|
70
|
+
def shout(message):
|
|
71
|
+
"""
|
|
72
|
+
shout a message
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
message (Any): the message to shout, can be any type, it will be converted to a string before being printed
|
|
76
|
+
"""
|
|
77
|
+
str(message) # convert message to string just in case it's not already a string
|
|
78
|
+
print(message.upper() + "!!!")
|
|
79
|
+
|
|
80
|
+
# how to make a rhing that makes a list using a function? how about this:
|
|
81
|
+
def penguin_list(*items):
|
|
82
|
+
"""
|
|
83
|
+
make a list of items
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
*items: the items to include in the list
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
list: the list containing the items
|
|
90
|
+
"""
|
|
91
|
+
return list(items)
|
|
92
|
+
|
|
93
|
+
def penguin_dict(**kwargs):
|
|
94
|
+
"""
|
|
95
|
+
make a dictionary
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
**kwargs: the key-value pairs for the dictionary
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
dict: the dictionary containing the key-value pairs
|
|
102
|
+
"""
|
|
103
|
+
return dict(kwargs)
|
|
104
|
+
|
|
105
|
+
def penguin_variable(name, value):
|
|
106
|
+
"""
|
|
107
|
+
make a variable
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
name (str): the name of the variable
|
|
111
|
+
value (Any): the value of the variable
|
|
112
|
+
"""
|
|
113
|
+
globals()[name] = value # how to make a thing that makes a variable? this is a hacky way to do it, but it works! # this doesn't declare the variable though, so anywhere else you want to use it, you have to use the same name as a string, which is not ideal, but it's the best I can do with this language
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# sadly you can't make statements like if, for, while, etc. in this language, but you can make functions that do things!
|
|
117
|
+
|
|
118
|
+
def penguin_yesno_question(thing, condition = True, log: bool = False):
|
|
119
|
+
"""
|
|
120
|
+
ask the penguin a question
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
thing (Any): the thing to check
|
|
124
|
+
condition (Any, optional): the condition to check against. Defaults to True.
|
|
125
|
+
log (bool, optional): whether to log the result. Defaults to False.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
bool: True if the condition is met, False otherwise
|
|
129
|
+
"""
|
|
130
|
+
if thing == condition:
|
|
131
|
+
if log:
|
|
132
|
+
say(f"{thing} is {condition}!")
|
|
133
|
+
return True
|
|
134
|
+
else:
|
|
135
|
+
if log:
|
|
136
|
+
say(f"{thing} is not {condition}!")
|
|
137
|
+
return False
|
|
138
|
+
|
|
139
|
+
# what if we want to make a function that does something if a condition is true? we can use the penguin_yesno_question function for that!
|
|
140
|
+
# do we want to make modules for this language? maybe we can make a module for math functions, a module for string functions, etc. that use penguin words instead of python keywords? that could be fun!
|
|
141
|
+
# what should we make first? maybe a math module? we can make functions for addition, subtraction, multiplication, division, etc. that use penguin words instead of python keywords!
|
|
142
|
+
|
|
143
|
+
# should we make error messages that are more penguin-like? maybe we can make a function that raises an error with a penguin message instead of a python message? that could be fun!
|
|
144
|
+
class PenguinError(Exception):
|
|
145
|
+
"""
|
|
146
|
+
the basic penguinerror when you decide it
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
Exception (str): the error message to raise
|
|
150
|
+
"""
|
|
151
|
+
pass
|
|
152
|
+
def penguin_error(type, message):
|
|
153
|
+
"""
|
|
154
|
+
raise a penguin error
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
type (str): the type of error
|
|
158
|
+
message (str): the error message
|
|
159
|
+
|
|
160
|
+
Raises:
|
|
161
|
+
PenguinError: the penguin error
|
|
162
|
+
"""
|
|
163
|
+
raise PenguinError(f"{type} - {message}")
|
|
164
|
+
|
|
165
|
+
# what other fun things can we add to this language? maybe we can make a function that makes a penguin noise? or a function that makes a penguin dance? the possibilities are endless!
|
|
166
|
+
|
|
167
|
+
def dance(dance_style = "penguin", shouting: bool = False):
|
|
168
|
+
"""
|
|
169
|
+
make a penguin dance.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
dance_style (str, optional): the style of dance. Defaults to "penguin".
|
|
173
|
+
shouting (bool, optional): whether the penguin should shout while dancing. Defaults to False.
|
|
174
|
+
"""
|
|
175
|
+
say(f"The penguin is dancing the {dance_style} dance!")
|
|
176
|
+
if shouting:
|
|
177
|
+
shout("Penguin dance!")
|
|
178
|
+
|
|
179
|
+
def penguin_noise(noise = "penguin", shouting: bool = False, times: int = 1):
|
|
180
|
+
"""
|
|
181
|
+
make a penguin make a noise.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
noise (str, optional): the noise to make. Defaults to "penguin".
|
|
185
|
+
shouting (bool, optional): whether the penguin should shout the noise. Defaults to False.
|
|
186
|
+
times (int, optional): how many times to make the noise. Defaults to 1.
|
|
187
|
+
"""
|
|
188
|
+
for _ in range(times):
|
|
189
|
+
say(f"The penguin says: {noise}!")
|
|
190
|
+
if shouting:
|
|
191
|
+
shout(f"{noise}!")
|
|
192
|
+
|
|
193
|
+
# could we make like a tkinter type of module for this language? that would be fun! we could make functions for creating windows, buttons, labels, etc. that use penguin words instead of python keywords! maybe we can call it pengtkinter or something like that!
|
|
194
|
+
# let's call it pengwindow! we can make functions for creating windows, buttons, labels, etc. that use penguin words instead of python keywords! that could be fun!
|
|
195
|
+
# i just did that just now, check it out!
|
|
196
|
+
|
|
197
|
+
# make a help function
|
|
198
|
+
|
|
199
|
+
def penguin_help(function):
|
|
200
|
+
"""
|
|
201
|
+
get help on a function
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
function (Callable): the function to get help on
|
|
205
|
+
"""
|
|
206
|
+
if hasattr(function, "__doc__") and function.__doc__:
|
|
207
|
+
say(f"here is the help for {function.__name__}:")
|
|
208
|
+
say(function.__doc__)
|
|
209
|
+
else:
|
|
210
|
+
say(f"penguin scoured the depths of the ocean but couldn't find any help for {function.__name__}!")
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
# make a function factory
|
|
214
|
+
# what else can we add to the factory?
|
|
215
|
+
|
|
216
|
+
def penguin_function_maker(typeofthing, log_: bool = False, **funcargs):
|
|
217
|
+
"""
|
|
218
|
+
make a function
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
typeofthing (str): the type of function to create
|
|
222
|
+
log_ (bool, optional): whether to log the creation of the function. Defaults to False.
|
|
223
|
+
|
|
224
|
+
Returns:
|
|
225
|
+
Callable: the created function
|
|
226
|
+
"""
|
|
227
|
+
if log_:
|
|
228
|
+
say(f"Creating a penguin function of type: {typeofthing} with message: {funcargs.get('message', 'No message provided')}")
|
|
229
|
+
def inner():
|
|
230
|
+
if typeofthing == "dance":
|
|
231
|
+
|
|
232
|
+
return dance(funcargs.get("dance_style", "penguin"), funcargs.get("shouting", False))
|
|
233
|
+
elif typeofthing == "noise":
|
|
234
|
+
|
|
235
|
+
return penguin_noise(funcargs.get("noise", "penguin"), funcargs.get("shouting", False), funcargs.get("times", 1))
|
|
236
|
+
elif typeofthing == "shout":
|
|
237
|
+
|
|
238
|
+
return shout(funcargs.get("message", "Penguin Shout!"))
|
|
239
|
+
elif typeofthing == "say":
|
|
240
|
+
|
|
241
|
+
return say(funcargs.get("message", "Penguin says something!"))
|
|
242
|
+
|
|
243
|
+
elif typeofthing == "help":
|
|
244
|
+
|
|
245
|
+
return penguin_help(funcargs.get("function", lambda: None))
|
|
246
|
+
|
|
247
|
+
return inner
|
|
248
|
+
|
|
249
|
+
# multi command func
|
|
250
|
+
|
|
251
|
+
def penguin_multi_command(*commands):
|
|
252
|
+
"""
|
|
253
|
+
execute multiple commands in sequence
|
|
254
|
+
|
|
255
|
+
Args:
|
|
256
|
+
*commands (Callable): the commands to execute, each command should be a callable
|
|
257
|
+
"""
|
|
258
|
+
for command in commands:
|
|
259
|
+
command()
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: penglang
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: a nonserious language module for penguins
|
|
5
|
+
Author: bebeday10
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/bebeday10/penglang
|
|
8
|
+
Project-URL: Repository, https://github.com/bebeday10/penglang
|
|
9
|
+
Project-URL: Issues, https://github.com/bebeday10/penglang/issues
|
|
10
|
+
Keywords: language,penguin,nonserious,fun,programming
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# PengLang, that one penguin language
|
|
17
|
+
|
|
18
|
+
Hello and welcome to **PengLang**, this language is created by *Penguins*™, that's why it's called PengLang because *Penguins*™.
|
|
19
|
+
|
|
20
|
+
# Why does this exist
|
|
21
|
+
|
|
22
|
+
I don't know either. Actually, the *Penguins*™ made it.
|
|
23
|
+
Ask them.
|
|
24
|
+
The python snake also helped.
|
|
25
|
+
Ask them.
|
|
26
|
+
|
|
27
|
+
# Things you can do
|
|
28
|
+
The main point is:
|
|
29
|
+
Dancing.
|
|
30
|
+
|
|
31
|
+
Other usual *Penguin*™ things:
|
|
32
|
+
- saying stuff
|
|
33
|
+
- fishing stuff
|
|
34
|
+
- assigning tasks
|
|
35
|
+
- doing tasks
|
|
36
|
+
|
|
37
|
+
These are the main things *Penguin*™ can do in order to *Survive*™.
|
|
38
|
+
Please do these *Things*™.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
Things penguins might do in a while:
|
|
43
|
+
|
|
44
|
+
- penguin do over
|
|
45
|
+
- shouting
|
|
46
|
+
- making a *List*™ to keep track of *Things*™
|
|
47
|
+
- making a *Dictionary*™ because language is hard
|
|
48
|
+
- making a variable because **why *not***
|
|
49
|
+
|
|
50
|
+
These are probable *Things*™.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
Things penguins would do if they had *Friends*™:
|
|
55
|
+
|
|
56
|
+
- answering yes-no questions to help *Friends*™
|
|
57
|
+
- doing a penguin noise because **why *not***
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
Errors
|
|
62
|
+
|
|
63
|
+
- PenguinError: because penguin errorment
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# This is Python what are you thinking
|
|
67
|
+
|
|
68
|
+
No it isn't this is a module of Python
|
|
69
|
+
|
|
70
|
+
# Modules
|
|
71
|
+
|
|
72
|
+
Here are some modules included in PengLang.
|
|
73
|
+
|
|
74
|
+
## Pengmath
|
|
75
|
+
|
|
76
|
+
A basic math module that let's you let *Penguins*™ count because they are *Smart*™.
|
|
77
|
+
|
|
78
|
+
- addition
|
|
79
|
+
- subtraction
|
|
80
|
+
- multiplication
|
|
81
|
+
- division
|
|
82
|
+
|
|
83
|
+
## Pengwindow
|
|
84
|
+
|
|
85
|
+
Make *Windows*™. Add things to *Window*™. Add child *Window*™.
|
|
86
|
+
|
|
87
|
+
# Conclusion
|
|
88
|
+
|
|
89
|
+
This is a penguin-made *"""language"""*.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
penglang/__init__.py
|
|
5
|
+
penglang/penglang.py
|
|
6
|
+
penglang.egg-info/PKG-INFO
|
|
7
|
+
penglang.egg-info/SOURCES.txt
|
|
8
|
+
penglang.egg-info/dependency_links.txt
|
|
9
|
+
penglang.egg-info/top_level.txt
|
|
10
|
+
penglang/modules/__init__.py
|
|
11
|
+
penglang/modules/pengmath.py
|
|
12
|
+
penglang/modules/pengwindow.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "penglang"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "a nonserious language module for penguins"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "bebeday10"}
|
|
13
|
+
]
|
|
14
|
+
license = "MIT"
|
|
15
|
+
keywords = ["language", "penguin", "nonserious", "fun", "programming"]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://github.com/bebeday10/penglang"
|
|
19
|
+
Repository = "https://github.com/bebeday10/penglang"
|
|
20
|
+
Issues = "https://github.com/bebeday10/penglang/issues"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
where = ["."]
|
penglang-0.1.1/setup.cfg
ADDED