cozy-kit 0.2.3__py3-none-any.whl

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.
cozy_kit/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .core import Yoyo
2
+ from .timer import Timer
3
+ from .text_studio import TextStudio
cozy_kit/core.py ADDED
@@ -0,0 +1,208 @@
1
+ import json, random
2
+ from pathlib import Path
3
+ import datetime
4
+
5
+ """This module is the module you might use everyday:
6
+ welcome() welcomes you,
7
+ bye() says goodbye to you,
8
+ good_night() tells you a bedtime story
9
+ good_morning() gives you a paragraph for the morning"""
10
+
11
+ BASE_DIR = Path(__file__).resolve().parent
12
+
13
+ class Yoyo:
14
+ def __init__(self, **details):
15
+ """Here is what you can enter:
16
+ name,
17
+ age,
18
+ height,
19
+ weight,
20
+ eye_color,
21
+ hair_color,
22
+ gender,
23
+ and nickname"""
24
+ self.details = details
25
+ self.name = details.get("name")
26
+ self.age = details.get('age')
27
+ self.height = details.get('height')
28
+ self.weight = details.get('weight')
29
+ self.eye_color = details.get('eye_color')
30
+ self.hair_color = details.get('hair_color')
31
+ self.gender = details.get('gender')
32
+ self.nickname = details.get('nickname')
33
+
34
+ def welcome(self):
35
+ message = f'Welcome {self.name}!'
36
+
37
+
38
+ if self.nickname:
39
+ message += f'\nOr welcome {self.nickname}!'
40
+
41
+ return message
42
+
43
+ def bye(self, destination="Where ever you're gonna go"):
44
+ message = f'Bye {self.name}! Have a nice day at {destination}!'
45
+ if self.nickname:
46
+ message += f'\nOr bye {self.nickname}!'
47
+ return message
48
+
49
+ def good_night(self):
50
+ message = f'Good night {self.name}!'
51
+ if self.nickname:
52
+ message += f'\nOr {self.nickname}!'
53
+
54
+ message += "\nAnyways, here's a quick bedtime story.\n"
55
+
56
+ bedtime_path = BASE_DIR / "jsons" / "bedtime_stories.json"
57
+
58
+ with open(bedtime_path, 'r', encoding='utf-8') as bedtime_stories:
59
+ stories = json.load(bedtime_stories)
60
+
61
+ random_title = random.choice(
62
+ list(stories['bedtime_stories'].keys())
63
+ )
64
+
65
+ random_story = stories['bedtime_stories'][random_title]
66
+
67
+ bedtime = f'{random_title}\n\n{random_story}'
68
+
69
+ return f"{message}\n\n{bedtime}"
70
+
71
+ def good_morning(self):
72
+ message = f'Good morning {self.name}!'
73
+
74
+ if self.nickname:
75
+ message += f'\nOr {self.nickname}!'
76
+
77
+ message += "\nAnyways, here's a quick morning quote.\n"
78
+
79
+ mornings_path = BASE_DIR / "jsons" / "mornings.json"
80
+
81
+ with open(mornings_path, 'r', encoding='utf-8') as morning_quotes:
82
+ quotes = json.load(morning_quotes)
83
+ morning = random.choice(
84
+ quotes['mornings']
85
+ )
86
+
87
+ morning_quote = (
88
+ f"{morning['name']}\n\n"
89
+ f"{morning['content']}"
90
+ )
91
+
92
+ return f"{message}\n\n{morning_quote}"
93
+
94
+ def motivate(self):
95
+
96
+ mots_path = BASE_DIR / "jsons" / "motivations.json"
97
+
98
+ with open(mots_path, 'r', encoding='utf-8') as file:
99
+ motivates = json.load(file)
100
+
101
+ motivation = random.choice(
102
+ motivates['motivations']
103
+ )
104
+
105
+ return motivation['name'], motivation['content']
106
+
107
+ def fun_facts(self):
108
+ facts_path = BASE_DIR / "jsons" / "fun_facts.json"
109
+
110
+ with open(facts_path, 'r') as file:
111
+ fun_facts = json.load(file)
112
+
113
+ fun_fact = random.choice(fun_facts['facts'])
114
+
115
+ return f"{fun_fact['name']}\n\n{fun_fact['content']}"
116
+
117
+ def good_afternoon(self):
118
+ message = f'Good afternoon {self.name}!'
119
+
120
+ if self.nickname:
121
+ message += f'\nOr good afternoon {self.nickname}!'
122
+
123
+ message += "\nAnyways, here's a quick afternoon quote.\n"
124
+
125
+ afternoons_path = BASE_DIR / "jsons" / "afternoons.json"
126
+
127
+ with open(afternoons_path, 'r', encoding='utf-8') as afternoon_quotes:
128
+ quotes = json.load(afternoon_quotes)
129
+
130
+ quote = random.choice(quotes['afternoons'])
131
+
132
+ return f"{message}\n{quote['name']}\n\n{quote['content']}"
133
+
134
+ def good_evening(self):
135
+ message = f'Good evening {self.name}!'
136
+
137
+ if self.nickname:
138
+ message += f'\nOr good evening {self.nickname}!'
139
+
140
+ message += "\nAnyways, here's a quick evening quote.\n"
141
+
142
+ afternoons_path = BASE_DIR / "jsons" / "afternoons.json"
143
+
144
+ with open(afternoons_path, 'r', encoding='utf-8') as afternoon_quotes:
145
+ quotes = json.load(afternoon_quotes)
146
+
147
+ quote = random.choice(quotes['afternoons'])
148
+
149
+ return f"{message}\n{quote['name']}\n\n{quote['content']}"
150
+
151
+ def auto_greet(self):
152
+ hour = datetime.datetime.now().hour
153
+ month = datetime.datetime.now().month
154
+
155
+ # Detect season
156
+ if month in [12, 1, 2]:
157
+ season = "winter"
158
+
159
+ elif month in [3, 4, 5]:
160
+ season = "spring"
161
+
162
+ elif month in [6, 7, 8]:
163
+ season = "summer"
164
+
165
+ else:
166
+ season = "autumn"
167
+
168
+ # Winter times
169
+ if season == "winter":
170
+ if 6 <= hour < 11:
171
+ return self.good_morning()
172
+
173
+ elif 11 <= hour < 16:
174
+ return self.good_afternoon()
175
+
176
+ elif 16 <= hour < 20:
177
+ return self.good_evening()
178
+
179
+ else:
180
+ return self.good_night()
181
+
182
+ # Summer times
183
+ elif season == "summer":
184
+ if 5 <= hour < 12:
185
+ return self.good_morning()
186
+
187
+ elif 12 <= hour < 18:
188
+ return self.good_afternoon()
189
+
190
+ elif 18 <= hour < 22:
191
+ return self.good_evening()
192
+
193
+ else:
194
+ return self.good_night()
195
+
196
+ # Spring & autumn
197
+ else:
198
+ if 6 <= hour < 12:
199
+ return self.good_morning()
200
+
201
+ elif 12 <= hour < 17:
202
+ return self.good_afternoon()
203
+
204
+ elif 17 <= hour < 21:
205
+ return self.good_evening()
206
+
207
+ else:
208
+ return self.good_night()
@@ -0,0 +1,137 @@
1
+ import string
2
+
3
+
4
+ class TextStudio:
5
+
6
+ def to_morse(self, text):
7
+ morse_code = {
8
+ 'A': '.-',
9
+ 'B': '-...',
10
+ 'C': '-.-.',
11
+ 'D': '-..',
12
+ 'E': '.',
13
+ 'F': '..-.',
14
+ 'G': '--.',
15
+ 'H': '....',
16
+ 'I': '..',
17
+ 'J': '.---',
18
+ 'K': '-.-',
19
+ 'L': '.-..',
20
+ 'M': '--',
21
+ 'N': '-.',
22
+ 'O': '---',
23
+ 'P': '.--.',
24
+ 'Q': '--.-',
25
+ 'R': '.-.',
26
+ 'S': '...',
27
+ 'T': '-',
28
+ 'U': '..-',
29
+ 'V': '...-',
30
+ 'W': '.--',
31
+ 'X': '-..-',
32
+ 'Y': '-.--',
33
+ 'Z': '--..',
34
+
35
+ '0': '-----',
36
+ '1': '.----',
37
+ '2': '..---',
38
+ '3': '...--',
39
+ '4': '....-',
40
+ '5': '.....',
41
+ '6': '-....',
42
+ '7': '--...',
43
+ '8': '---..',
44
+ '9': '----.',
45
+
46
+ '.': '.-.-.-',
47
+ ',': '--..--',
48
+ '?': '..--..',
49
+ '!': '-.-.--',
50
+ '/': '-..-.',
51
+ '(': '-.--.',
52
+ ')': '-.--.-',
53
+ ':': '---...',
54
+ "'": '.----.',
55
+ '=': '-...-',
56
+ '+': '.-.-.',
57
+ '-': '-....-',
58
+ ' ': '/'
59
+ }
60
+
61
+ result = ''
62
+
63
+ for letter in text.upper():
64
+ result += f"{morse_code.get(letter, '?')} "
65
+
66
+ return result.strip()
67
+
68
+ def to_upper(self, text):
69
+ return text.upper()
70
+
71
+ def to_title(self, text):
72
+ return text.title()
73
+
74
+ def to_lower(self, text):
75
+ return text.lower()
76
+
77
+ def replace_with_spaces(self, text, replacement):
78
+ return text.replace(replacement, ' ')
79
+
80
+ def space_out_letters(self, text):
81
+ result = ''
82
+
83
+ for char in text:
84
+ result += f'{char} '
85
+
86
+ return result.strip()
87
+
88
+ def reverse(self, text):
89
+ return text[::-1]
90
+
91
+ def word_count(self, text):
92
+ return len(text.split())
93
+
94
+ def char_count(self, text):
95
+ return len(text)
96
+
97
+ def remove_spaces(self, text):
98
+ return text.replace(' ', '')
99
+
100
+ def snake(self, text):
101
+ return text.lower().replace(' ', '_')
102
+
103
+ def camel(self, text):
104
+ words = text.split()
105
+
106
+ return words[0].lower() + ''.join(
107
+ word.capitalize()
108
+ for word in words[1:]
109
+ )
110
+
111
+ def caesar(self, text, shift):
112
+ result = ''
113
+
114
+ for char in text:
115
+ if char.isalpha():
116
+
117
+ start = ord('A') if char.isupper() else ord('a')
118
+
119
+ shifted = (
120
+ (ord(char) - start + shift) % 26
121
+ ) + start
122
+
123
+ result += chr(shifted)
124
+
125
+ else:
126
+ result += char
127
+
128
+ return result
129
+
130
+ def remove_punctuation(self, text):
131
+ result = ''
132
+
133
+ for char in text:
134
+ if char not in string.punctuation:
135
+ result += char
136
+
137
+ return result
cozy_kit/timer.py ADDED
@@ -0,0 +1,58 @@
1
+ import time
2
+
3
+
4
+ class Timer:
5
+ def countdown(self, count, time_type, show):
6
+ if time_type == 'min':
7
+ count *= 60
8
+
9
+ elif time_type == 'hour':
10
+ count *= 3600
11
+
12
+ for i in range(count, 0, -1):
13
+ mins, secs = divmod(i, 60)
14
+
15
+ show(f"{mins:02}:{secs:02}")
16
+
17
+ time.sleep(1)
18
+
19
+ show("⏰ Time's up!")
20
+
21
+ def pomodoro(self, work_time, break_time, long_break_time, show):
22
+ """ Enter work, break, and long break as mins.
23
+ and show is how you're gonna show it.
24
+ Example:
25
+ speak
26
+ print
27
+ label.config"""
28
+ reps = 0
29
+ work_time *= 60
30
+ break_time *= 60
31
+ long_break_time *= 60
32
+ running = True
33
+ while running:
34
+ reps += 1
35
+ if reps % 8 == 0:
36
+ show("⏰ Long Break Time")
37
+ for i in range(long_break_time, 0, -1):
38
+ mins, secs = divmod(i, 60)
39
+
40
+ show(f"{mins:02}:{secs:02}")
41
+
42
+ time.sleep(1)
43
+ elif reps % 2 == 0:
44
+ show("☕ Short Break Time")
45
+ for i in range(break_time, 0, -1):
46
+ mins, secs = divmod(i, 60)
47
+
48
+ show(f"{mins:02}:{secs:02}")
49
+
50
+ time.sleep(1)
51
+ else:
52
+ show("💻 Work Time")
53
+ for i in range(work_time, 0, -1):
54
+ mins, secs = divmod(i, 60)
55
+
56
+ show(f"{mins:02}:{secs:02}")
57
+
58
+ time.sleep(1)
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: cozy-kit
3
+ Version: 0.2.3
4
+ Summary: The basic library for coding
5
+ Author: youssefahmed2017
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+
10
+ # cozy-kit
11
+
12
+ ## A cozy Python package with greetings, bedtime stories, quotes, and friendly messages.
13
+
14
+ #### Created by Youssef.
15
+
16
+ ---
17
+
18
+ # Requirements
19
+ - #### + Python 3.11
20
+
21
+ ---
22
+
23
+ # Installation
24
+
25
+ #### Install the package:
26
+
27
+ ```bash
28
+ pip install yoyo-bgw
29
+ ```
30
+ ---
31
+ #### Update the package:
32
+ ```bash
33
+ pip install --upgrade yoyo-bgw
34
+ ```
35
+ ---
36
+
37
+ ## What is this package?
38
+
39
+ ### yoyo-bgw is a friendly Python package that provides:
40
+
41
+ #### Welcome messages
42
+ #### Goodbye messages
43
+ #### Morning greetings
44
+ #### Bedtime stories
45
+ #### Motivational quotes
46
+ #### JSON-powered random content...
47
+
48
+ #### The package is designed to be simple, cozy, and beginner-friendly.
49
+
50
+ # Using the package and its classes
51
+
52
+ ---
53
+ ## How to use this package:
54
+ ### Import it:
55
+
56
+ ```python
57
+ from cozy_kit import Yoyo
58
+ ```
59
+ ---
60
+ ### Then create the object:
61
+
62
+ ```python
63
+ from cozy_kit import Yoyo
64
+
65
+ example_name = Yoyo(
66
+ name='Example',
67
+ age=12,
68
+ height=12,
69
+ weight=13,
70
+ eye_color='blue',
71
+ hair_color='black',
72
+ gender='male',
73
+ nickname='Example'
74
+ )
75
+ ```
76
+ ---
77
+
78
+ ### Functions
79
+
80
+ - `welcome()` welcomes you
81
+ - `good_morning()` gives you a morning quote
82
+ - `good_afternoon()` gives you an afternoon quote
83
+ - `good_evening()` gives you an evening quote
84
+ - `good_night()` tells you a bedtime story
85
+ - `auto_greet()` calls the specific function depending on the time and season
86
+ - `bye()` tells you goodbye
87
+ ---
88
+
89
+ ## Example Usage:
90
+
91
+ ```python
92
+ from cozy_kit import Yoyo
93
+
94
+ person = Yoyo(
95
+ name="Youssef",
96
+ nickname="Yoyo"
97
+ )
98
+
99
+ print(person.welcome())
100
+ ```
101
+ ---
102
+
103
+ ## Example Output:
104
+ ```text
105
+ Welcome Youssef!
106
+ Or welcome Yoyo!
107
+ ```
108
+ ---
109
+
110
+ ## How to use the Timer class
111
+ ### Import it:
112
+
113
+ ```python
114
+ from cozy_kit import Timer
115
+ ```
116
+ ---
117
+
118
+ ### Then create the object:
119
+
120
+ ```python
121
+ from cozy_kit import Timer
122
+
123
+ timer = Timer() # No parameters required currently
124
+ ```
125
+ ---
126
+
127
+ ### Functions:
128
+
129
+ - `countdown(count, time_type, show)`
130
+ #### Enter the count amount,
131
+ #### then if it is min/hour/sec.
132
+ #### The `show` parameter allows custom output systems such as:
133
+ - print
134
+ - pyttsx3 speech
135
+ - Tkinter labels
136
+ - custom logging functions
137
+
138
+ ---
139
+
140
+ ## Example Usage:
141
+
142
+ ```python
143
+ from cozy_kit import Timer
144
+
145
+ timer = Timer()
146
+ timer.countdown(10, 'sec', print)
147
+ timer.pomodoro(work_time=25, break_time=5, long_break_time=25, show=print)
148
+ ```
149
+ ---
150
+
151
+ ## Example Output:
152
+ ```text
153
+ 00:10
154
+ 00:09
155
+ 00:08
156
+ ...
157
+ Time's Up!
158
+
159
+ 💻 Work Time
160
+ 25:00
161
+ ...
162
+ 00:01
163
+
164
+ ☕ Short Break Time
165
+ 05:00
166
+ ...
167
+ 00:01
168
+
169
+ ⏰ Long Break Time
170
+ 25:00
171
+ ```
172
+ ---
173
+
174
+ # How to use the TextStudio class
175
+ ## Import it:
176
+
177
+ ```python
178
+ from cozy_kit import TextStudio
179
+ ```
180
+ ---
181
+
182
+ ## Then create the object:
183
+
184
+ ```python
185
+ from cozy_kit import TextStudio
186
+
187
+ text_editor = TextStudio(
188
+ text='Blah-blAh-TExt'
189
+ )
190
+ ```
191
+ ---
192
+ ## Functions:
193
+
194
+ - `to_morse()`
195
+ - `to_upper()`
196
+ - `to_title()`
197
+ - `to_lower()`
198
+ - `space_out_letters()`
199
+ - `replace_with_spaces()`
200
+ - `caeser()`
201
+ - `reverse()`
202
+ - `word_count()`
203
+ - `char_count()`
204
+ - `remove_spaces()`
205
+ - `snake()`
206
+ - `camel()`
207
+ - `caeser()`
208
+ - `remove_panctuations()`
209
+ ---
210
+ ## Example Usage:
211
+
212
+ ```python
213
+ from cozy_kit import TextStudio
214
+
215
+ text_editor = TextStudio(
216
+ text="Blah-blAh-TExt"
217
+ )
218
+ print(text_editor.to_lower())
219
+ print(text_editor.to_upper())
220
+ print(text_editor.to_title())
221
+ print(text_editor.replace_with_spaces(replacement='-')) # Replacement is the letter you're gonna replace with spaces.
222
+ print(text_editor.space_out_letters())
223
+ ```
224
+ ---
225
+
226
+ ## Example Output:
227
+ ```text
228
+ blah-blah-text
229
+ BLAH-BLAH-TEXT
230
+ Blah-Blah-Text
231
+ Blah blAh TExt
232
+ B l a h b l A h T E x t
233
+ ```
@@ -0,0 +1,8 @@
1
+ cozy_kit/__init__.py,sha256=YMd3ERJqjr5c9QJQEAfOfBMeB-guzifwMIMCBAUx1-E,85
2
+ cozy_kit/core.py,sha256=iqWvTbNBhrLh2-WqyCobdqunqAIr127SPEWQtpSm0QA,6053
3
+ cozy_kit/text_studio.py,sha256=nbUpeeio4mAD9JFuVURSox-2m3x5oPRqyBXFfehPtgo,3130
4
+ cozy_kit/timer.py,sha256=nYhkq-Jr4cHDk8QksXNPjPrKoSoNY-hSEVFkfmegaZc,1627
5
+ cozy_kit-0.2.3.dist-info/METADATA,sha256=N3p2-IUIozkiYJZgFBTbEtJtZ9gAllQCNEduud_lMoc,3821
6
+ cozy_kit-0.2.3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
7
+ cozy_kit-0.2.3.dist-info/top_level.txt,sha256=ghn_2gp4fZMNrI-meNhrpJbM5PXTZJMROgbw0lWv7eI,9
8
+ cozy_kit-0.2.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ cozy_kit