clox 0.7__py3-none-any.whl → 0.8__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.

Potentially problematic release.


This version of clox might be problematic. Click here for more details.

clox/functions.py CHANGED
@@ -13,9 +13,10 @@ from art import tprint
13
13
  from .jcalendar import TextCalendar as JalaliCalendar
14
14
  from .params import HORIZONTAL_TIME_24H_FORMATS, VERTICAL_TIME_24H_FORMATS
15
15
  from .params import HORIZONTAL_TIME_12H_FORMATS, VERTICAL_TIME_12H_FORMATS
16
- from .params import TIMEZONES_LIST, CLOX_VERSION, DATE_FORMAT
16
+ from .params import CLOX_VERSION, DATE_FORMAT
17
+ from .params import TIMEZONES_LIST, COUNTRIES_LIST
17
18
  from .params import ADDITIONAL_INFO, EXIT_MESSAGE
18
- from .params import FACES_MAP, FACES_LIST, CALENDAR_LIST, DATE_SYSTEMS_LIST
19
+ from .params import FACES_MAP, FACES_LIST, CALENDARS_LIST, DATE_SYSTEMS_LIST
19
20
  from .params import HORIZONTAL_FACES_LIST_EXAMPLE, VERTICAL_FACES_LIST_EXAMPLE
20
21
  from .params import CLOX_OVERVIEW, CLOX_REPO
21
22
 
@@ -77,18 +78,45 @@ def show_faces_list(vertical=False):
77
78
  print('=' * 80)
78
79
 
79
80
 
80
- def show_timezones_list():
81
+ def show_timezones_list(country=None):
81
82
  """
82
83
  Show timezones list.
83
84
 
85
+ :param country: country iso3166 code
86
+ :type country: str
84
87
  :return: None
85
88
  """
86
- print("Timezones list:\n")
87
- for index, timezone in enumerate(TIMEZONES_LIST, 1):
89
+ timezones_list = TIMEZONES_LIST
90
+ country_name = "All"
91
+ if country is not None:
92
+ timezones_list = list(map(lambda x: x.upper(), pytz.country_timezones(country)))
93
+ country_name = pytz.country_names[country]
94
+ try:
95
+ print("Timezones list ({country_name}):\n".format(country_name=country_name))
96
+ except Exception:
97
+ print("Timezones list ({country_name}):\n".format(country_name=country.upper()))
98
+ for index, timezone in enumerate(sorted(timezones_list), 1):
88
99
  print("{index}. {timezone}".format(index=index, timezone=timezone))
89
100
 
90
101
 
91
- def print_calendar(mode="month", timezone=None, v_shift=0, h_shift=0, date_system="gregorian"):
102
+ def show_countries_list():
103
+ """
104
+ Show countries list.
105
+
106
+ :return: None
107
+ """
108
+ print("Countries list:\n")
109
+ for index, country_code in enumerate(sorted(COUNTRIES_LIST), 1):
110
+ country_name = pytz.country_names[country_code]
111
+ try:
112
+ print("{index}. {country_code} - {country_name}".format(index=index,
113
+ country_code=country_code, country_name=country_name))
114
+ except Exception:
115
+ print("{index}. {country_code} - {country_name}".format(index=index,
116
+ country_code=country_code, country_name=country_code))
117
+
118
+
119
+ def print_calendar(mode="month", timezone=None, country=None, v_shift=0, h_shift=0, date_system="gregorian"):
92
120
  """
93
121
  Print calendar.
94
122
 
@@ -96,6 +124,8 @@ def print_calendar(mode="month", timezone=None, v_shift=0, h_shift=0, date_syste
96
124
  :type mode: str
97
125
  :param timezone: timezone
98
126
  :type timezone: str
127
+ :param country: country iso3166 code
128
+ :type country: str
99
129
  :param v_shift: vertical shift
100
130
  :type v_shift: int
101
131
  :param h_shift: horizontal shift
@@ -111,6 +141,8 @@ def print_calendar(mode="month", timezone=None, v_shift=0, h_shift=0, date_syste
111
141
  calendar_obj = JalaliCalendar()
112
142
  tz = None
113
143
  timezone_str = "Local"
144
+ if country is not None:
145
+ timezone = pytz.country_timezones(country)[0].upper()
114
146
  if timezone is not None:
115
147
  timezone_str = timezone
116
148
  tz = pytz.timezone(timezone)
@@ -131,6 +163,7 @@ def print_calendar(mode="month", timezone=None, v_shift=0, h_shift=0, date_syste
131
163
 
132
164
  def run_clock(
133
165
  timezone=None,
166
+ country=None,
134
167
  v_shift=0,
135
168
  h_shift=0,
136
169
  face=1,
@@ -145,6 +178,8 @@ def run_clock(
145
178
 
146
179
  :param timezone: timezone
147
180
  :type timezone: str
181
+ :param country: country iso3166 code
182
+ :type country: str
148
183
  :param v_shift: vertical shift
149
184
  :type v_shift: int
150
185
  :param h_shift: horizontal shift
@@ -174,6 +209,8 @@ def run_clock(
174
209
  time_formats = VERTICAL_TIME_12H_FORMATS if am_pm else VERTICAL_TIME_24H_FORMATS
175
210
  tz = None
176
211
  timezone_str = "Local"
212
+ if country is not None:
213
+ timezone = pytz.country_timezones(country)[0].upper()
177
214
  if timezone is not None:
178
215
  timezone_str = timezone
179
216
  tz = pytz.timezone(timezone)
@@ -207,7 +244,8 @@ def main():
207
244
  """
208
245
  parser = argparse.ArgumentParser()
209
246
  parser.epilog = ADDITIONAL_INFO
210
- parser.add_argument('--timezone', help='timezone', type=str, choices=TIMEZONES_LIST)
247
+ parser.add_argument('--timezone', help='timezone', type=str.upper, choices=TIMEZONES_LIST)
248
+ parser.add_argument('--country', help='country (iso3166 code)', type=str.upper, choices=COUNTRIES_LIST)
211
249
  parser.add_argument('--v-shift', help='vertical shift', type=int, default=0)
212
250
  parser.add_argument('--h-shift', help='horizontal shift', type=int, default=0)
213
251
  parser.add_argument('--version', help='version', nargs="?", const=1)
@@ -215,13 +253,19 @@ def main():
215
253
  parser.add_argument('--face', help='face', type=int, choices=FACES_LIST, default=1)
216
254
  parser.add_argument('--faces-list', help='faces list', nargs="?", const=1)
217
255
  parser.add_argument('--timezones-list', help='timezones list', nargs="?", const=1)
256
+ parser.add_argument('--countries-list', help='countries list', nargs="?", const=1)
218
257
  parser.add_argument('--no-blink', help='disable blinking mode', nargs="?", const=1)
219
258
  parser.add_argument('--vertical', help='vertical mode', nargs="?", const=1)
220
259
  parser.add_argument('--hide-date', help='hide date', nargs="?", const=1)
221
260
  parser.add_argument('--hide-timezone', help='hide timezone', nargs="?", const=1)
222
261
  parser.add_argument('--am-pm', help='AM/PM mode', nargs="?", const=1)
223
- parser.add_argument('--calendar', help='calendar mode', type=str, choices=CALENDAR_LIST)
224
- parser.add_argument('--date-system', help='date system', type=str, choices=DATE_SYSTEMS_LIST, default="gregorian")
262
+ parser.add_argument('--calendar', help='calendar mode', type=str.lower, choices=CALENDARS_LIST)
263
+ parser.add_argument(
264
+ '--date-system',
265
+ help='date system',
266
+ type=str.lower,
267
+ choices=DATE_SYSTEMS_LIST,
268
+ default="gregorian")
225
269
  args = parser.parse_args()
226
270
  if args.version:
227
271
  print(CLOX_VERSION)
@@ -230,11 +274,14 @@ def main():
230
274
  elif args.faces_list:
231
275
  show_faces_list(vertical=args.vertical)
232
276
  elif args.timezones_list:
233
- show_timezones_list()
277
+ show_timezones_list(args.country)
278
+ elif args.countries_list:
279
+ show_countries_list()
234
280
  elif args.calendar:
235
281
  print_calendar(
236
282
  mode=args.calendar,
237
283
  timezone=args.timezone,
284
+ country=args.country,
238
285
  h_shift=args.h_shift,
239
286
  v_shift=args.v_shift,
240
287
  date_system=args.date_system)
@@ -242,6 +289,7 @@ def main():
242
289
  try:
243
290
  run_clock(
244
291
  timezone=args.timezone,
292
+ country=args.country,
245
293
  h_shift=args.h_shift,
246
294
  v_shift=args.v_shift,
247
295
  face=args.face,
clox/params.py CHANGED
@@ -2,7 +2,7 @@
2
2
  """clox params."""
3
3
  import pytz
4
4
 
5
- CLOX_VERSION = "0.7"
5
+ CLOX_VERSION = "0.8"
6
6
 
7
7
  CLOX_OVERVIEW = '''
8
8
  Clox is a terminal-based clock application designed for terminal enthusiasts who appreciate simplicity,
@@ -24,7 +24,8 @@ HORIZONTAL_TIME_12H_FORMATS = ['%I:%M %p', '%I:%M %p.']
24
24
  VERTICAL_TIME_12H_FORMATS = ['%I\n%M\n%p', '%I\n%M\n%p.']
25
25
  DATE_FORMAT = "%A, %B %d, %Y"
26
26
 
27
- TIMEZONES_LIST = pytz.all_timezones
27
+ TIMEZONES_LIST = list(map(lambda x: x.upper(), pytz.all_timezones))
28
+ COUNTRIES_LIST = list(map(lambda x: x.upper(), pytz.country_timezones.keys()))
28
29
 
29
30
 
30
31
  FACES_MAP = {
@@ -57,6 +58,6 @@ FACES_MAP = {
57
58
 
58
59
  FACES_LIST = [-1] + sorted(FACES_MAP)
59
60
 
60
- CALENDAR_LIST = ["month", "year"]
61
+ CALENDARS_LIST = ["month", "year"]
61
62
 
62
63
  DATE_SYSTEMS_LIST = ["gregorian", "jalali"]
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: clox
3
- Version: 0.7
3
+ Version: 0.8
4
4
  Summary: A Geeky Clock for Terminal Enthusiasts
5
5
  Home-page: https://github.com/sepandhaghighi/clox
6
- Download-URL: https://github.com/sepandhaghighi/clox/tarball/v0.7
6
+ Download-URL: https://github.com/sepandhaghighi/clox/tarball/v0.8
7
7
  Author: Sepand Haghighi
8
8
  Author-email: me@sepand.tech
9
9
  License: MIT
@@ -104,13 +104,13 @@ Clox is a terminal-based clock application designed for terminal enthusiasts who
104
104
  ## Installation
105
105
 
106
106
  ### Source Code
107
- - Download [Version 0.7](https://github.com/sepandhaghighi/clox/archive/v0.7.zip) or [Latest Source](https://github.com/sepandhaghighi/clox/archive/dev.zip)
107
+ - Download [Version 0.8](https://github.com/sepandhaghighi/clox/archive/v0.8.zip) or [Latest Source](https://github.com/sepandhaghighi/clox/archive/dev.zip)
108
108
  - `pip install .`
109
109
 
110
110
  ### PyPI
111
111
 
112
112
  - Check [Python Packaging User Guide](https://packaging.python.org/installing/)
113
- - `pip install clox==0.7`
113
+ - `pip install clox==0.8`
114
114
 
115
115
 
116
116
  ## Usage
@@ -143,16 +143,30 @@ clox
143
143
  clox --face=3
144
144
  ```
145
145
  * Use `--face=-1` for random mode
146
- * [Faces List](https://github.com/sepandhaghighi/clox/blob/main/FACES.md)
147
- * `clox --faces-list`
146
+ * [Faces List](https://github.com/sepandhaghighi/clox/blob/main/FACES.md): `clox --faces-list`
147
+
148
148
 
149
149
  ### Timezone
150
150
 
151
151
  ```console
152
152
  clox --timezone="Etc/GMT+7"
153
153
  ```
154
- * [Timezones List](https://github.com/sepandhaghighi/clox/blob/main/TIMEZONES.md)
155
- * `clox --timezones-list`
154
+ * [Timezones List](https://github.com/sepandhaghighi/clox/blob/main/TIMEZONES.md): `clox --timezones-list`
155
+
156
+
157
+ ### Country
158
+
159
+ The `--country` argument allows you to specify a country using its **ISO 3166** code format
160
+
161
+ ℹ️ When the `--country` argument is provided, the `--timezone` argument will be ignored
162
+
163
+ ℹ️ If the specified country has multiple timezones, the first timezone will be selected automatically
164
+
165
+ ```console
166
+ clox --country="DE"
167
+ ```
168
+ * [Countries List](https://github.com/sepandhaghighi/clox/blob/main/COUNTRIES.md): `clox --countries-list`
169
+
156
170
 
157
171
  ### Vertical/Horizontal Shift
158
172
 
@@ -278,6 +292,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
278
292
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
279
293
 
280
294
  ## [Unreleased]
295
+ ## [0.8] - 2025-03-16
296
+ ### Added
297
+ - `--country` argument
298
+ - `--countries-list` argument
299
+ - `COUNTRIES.md`
300
+ ### Changed
301
+ - Input case sensitivity bug fixed
302
+ - Test system modified
303
+ - `README.md` updated
281
304
  ## [0.7] - 2025-03-06
282
305
  ### Added
283
306
  - Jalali calendar
@@ -322,7 +345,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
322
345
  - `TIMEZONES.md`
323
346
  - `FACES.md`
324
347
 
325
- [Unreleased]: https://github.com/sepandhaghighi/clox/compare/v0.7...dev
348
+ [Unreleased]: https://github.com/sepandhaghighi/clox/compare/v0.8...dev
349
+ [0.8]: https://github.com/sepandhaghighi/clox/compare/v0.7...v0.8
326
350
  [0.7]: https://github.com/sepandhaghighi/clox/compare/v0.6...v0.7
327
351
  [0.6]: https://github.com/sepandhaghighi/clox/compare/v0.5...v0.6
328
352
  [0.5]: https://github.com/sepandhaghighi/clox/compare/v0.4...v0.5
@@ -0,0 +1,12 @@
1
+ clox/__init__.py,sha256=gErclFSjUDschQpngWqOBGkBKt1jwd-Ww8B9iJmlU5s,108
2
+ clox/__main__.py,sha256=9oJYc1WXu4ZMrjKny_2-4Cgu46-VWHuE9xOqD1iJY0E,109
3
+ clox/functions.py,sha256=rHrWxzW0NxARlaKaUlO-TXEPyhEG1MQ0jctDxBe192I,10008
4
+ clox/jcalendar.py,sha256=yAzuyXq6h8D5aJG_He_WuPR8Xy411W_l7pl8mtPJa5U,12296
5
+ clox/params.py,sha256=8rlLAfUv3nHNVh5cSsH_1O1aNQoDAgmyKxiTkqV8f54,1654
6
+ clox-0.8.dist-info/AUTHORS.md,sha256=lmtnd18MnfgB57jdvfJbC0JHN3iARf2Ov4pY5kPGJC8,242
7
+ clox-0.8.dist-info/LICENSE,sha256=WoAsqqZ_lNVBGdyxjwh7YnVNXKfOB-qYVrRhrn-e-_4,1072
8
+ clox-0.8.dist-info/METADATA,sha256=-c6IkxbwAxVIm0VY_MU9GICTe9v6xrtErvXEMHOr0iw,9509
9
+ clox-0.8.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
10
+ clox-0.8.dist-info/entry_points.txt,sha256=sP4Rmoe-DxYGjlF_Tld6nghbt_u-fK8h9ZUQFmO8TJs,45
11
+ clox-0.8.dist-info/top_level.txt,sha256=5DxGH-4VNfYkM8vbfngObh6-jpFEoSW4M90EvDGfhSw,5
12
+ clox-0.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
clox-0.7.dist-info/RECORD DELETED
@@ -1,12 +0,0 @@
1
- clox/__init__.py,sha256=gErclFSjUDschQpngWqOBGkBKt1jwd-Ww8B9iJmlU5s,108
2
- clox/__main__.py,sha256=9oJYc1WXu4ZMrjKny_2-4Cgu46-VWHuE9xOqD1iJY0E,109
3
- clox/functions.py,sha256=hOXLuSMljzOMaHXJtiyxGas6XkFE9lQ51TMSC56Yq2M,8049
4
- clox/jcalendar.py,sha256=yAzuyXq6h8D5aJG_He_WuPR8Xy411W_l7pl8mtPJa5U,12296
5
- clox/params.py,sha256=Zd4AO6ufxpJFnXnwW3_xwzusyU4WIKS-JS29CVh2KZo,1542
6
- clox-0.7.dist-info/AUTHORS.md,sha256=lmtnd18MnfgB57jdvfJbC0JHN3iARf2Ov4pY5kPGJC8,242
7
- clox-0.7.dist-info/LICENSE,sha256=WoAsqqZ_lNVBGdyxjwh7YnVNXKfOB-qYVrRhrn-e-_4,1072
8
- clox-0.7.dist-info/METADATA,sha256=yUonus_iE_mfLDldjTFwOSt19Fkk6Mseu6YMy9blUwk,8799
9
- clox-0.7.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
10
- clox-0.7.dist-info/entry_points.txt,sha256=sP4Rmoe-DxYGjlF_Tld6nghbt_u-fK8h9ZUQFmO8TJs,45
11
- clox-0.7.dist-info/top_level.txt,sha256=5DxGH-4VNfYkM8vbfngObh6-jpFEoSW4M90EvDGfhSw,5
12
- clox-0.7.dist-info/RECORD,,
File without changes
File without changes
File without changes