mayutils 1.2.4__tar.gz → 1.2.5__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.
Files changed (63) hide show
  1. {mayutils-1.2.4 → mayutils-1.2.5}/PKG-INFO +1 -1
  2. {mayutils-1.2.4 → mayutils-1.2.5}/pyproject.toml +1 -1
  3. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/datetime.py +127 -111
  4. {mayutils-1.2.4 → mayutils-1.2.5}/LICENSE +0 -0
  5. {mayutils-1.2.4 → mayutils-1.2.5}/README.md +0 -0
  6. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/__init__.py +0 -0
  7. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/core/__init__.py +0 -0
  8. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/core/constants.py +0 -0
  9. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/__init__.py +0 -0
  10. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/analysis/__init__.py +0 -0
  11. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/cache/.gitkeep +0 -0
  12. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/live.py +0 -0
  13. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/local.py +0 -0
  14. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/queries/.gitkeep +0 -0
  15. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/queries/__init__.py +0 -0
  16. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/queries/examples/.gitkeep +0 -0
  17. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/data/read.py +0 -0
  18. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/__init__.py +0 -0
  19. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/benchmarking.py +0 -0
  20. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/databases.py +0 -0
  21. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/filesystem.py +0 -0
  22. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/logging.py +0 -0
  23. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/memoisation.py +0 -0
  24. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/oauth.py +0 -0
  25. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/environment/webdrivers.py +0 -0
  26. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/export/__init__.py +0 -0
  27. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/export/images.py +0 -0
  28. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/export/pdf.py +0 -0
  29. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/export/slides.py +0 -0
  30. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/interfaces/__init__.py +0 -0
  31. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/interfaces/google.py +0 -0
  32. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/interfaces/microsoft.py +0 -0
  33. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/interfaces/streamlit.py +0 -0
  34. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/mathematics/__init__.py +0 -0
  35. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/mathematics/numba.py +0 -0
  36. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/mathematics/numpy.py +0 -0
  37. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/__init__.py +0 -0
  38. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/classes.py +0 -0
  39. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/colours.py +0 -0
  40. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/dataframes.py +0 -0
  41. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/decorators.py +0 -0
  42. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/dictionaries.py +0 -0
  43. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/functions.py +0 -0
  44. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/hashing.py +0 -0
  45. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/numbers.py +0 -0
  46. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/strings.py +0 -0
  47. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/objects/types.py +0 -0
  48. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/scripts/__init__.py +0 -0
  49. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/scripts/clear_cache.py +0 -0
  50. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/scripts/versioning.py +0 -0
  51. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/testing/__init__.py +0 -0
  52. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/__init__.py +0 -0
  53. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/console.py +0 -0
  54. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/__init__.py +0 -0
  55. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/combine.py +0 -0
  56. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/matplotlib/__init__.py +0 -0
  57. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/matplotlib/template.py +0 -0
  58. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/plotly/__init__.py +0 -0
  59. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/plotly/charts.py +0 -0
  60. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/plotly/templates.py +0 -0
  61. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/plotly/traces.py +0 -0
  62. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/graphs/plotly/utilities.py +0 -0
  63. {mayutils-1.2.4 → mayutils-1.2.5}/src/mayutils/visualisation/notebook.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mayutils
3
- Version: 1.2.4
3
+ Version: 1.2.5
4
4
  Summary: Utilities for Python from Mayuran Visakan
5
5
  Author: Mayuran Visakan
6
6
  Author-email: Mayuran Visakan <mayuran.k.v@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mayutils"
3
- version = "1.2.4"
3
+ version = "1.2.5"
4
4
  description = "Utilities for Python from Mayuran Visakan"
5
5
  authors = [
6
6
  { name = "Mayuran Visakan", email = "mayuran.k.v@gmail.com" }
@@ -1,3 +1,4 @@
1
+ from __future__ import annotations
1
2
  from contextlib import _GeneratorContextManager
2
3
  from sqlite3 import register_adapter
3
4
  from typing import Any, Optional, Self, Literal
@@ -96,6 +97,125 @@ class Timezone(BaseTimezone):
96
97
  UTC = Timezone(key="UTC")
97
98
 
98
99
 
100
+ class Date(BaseDate):
101
+ @classmethod
102
+ def from_base(
103
+ cls,
104
+ base: BaseDate,
105
+ ) -> Self:
106
+ return cls(
107
+ year=base.year,
108
+ month=base.month,
109
+ day=base.day,
110
+ )
111
+
112
+ @classmethod
113
+ def from_datetime(
114
+ cls,
115
+ date: _datetime.date,
116
+ ) -> Self:
117
+ return cls(
118
+ year=date.year,
119
+ month=date.month,
120
+ day=date.day,
121
+ )
122
+
123
+ @classmethod
124
+ def parse(
125
+ cls,
126
+ input,
127
+ ) -> Self:
128
+ output = parse(input=input)
129
+
130
+ if not isinstance(output, cls):
131
+ raise ValueError("Could not parse to date")
132
+
133
+ return output
134
+
135
+ def to_datetime(
136
+ self,
137
+ tz: str | Timezone = UTC,
138
+ ) -> DateTime:
139
+ return DateTime.create(
140
+ year=self.year,
141
+ month=self.month,
142
+ day=self.day,
143
+ hour=0,
144
+ minute=0,
145
+ second=0,
146
+ microsecond=0,
147
+ tz=tz,
148
+ )
149
+
150
+ def to_numpy(
151
+ self,
152
+ ) -> np.datetime64:
153
+ return np.datetime64(self)
154
+
155
+
156
+ class Time(BaseTime):
157
+ @classmethod
158
+ def from_base(
159
+ cls,
160
+ base: BaseTime,
161
+ ) -> Self:
162
+ return cls(
163
+ hour=base.hour,
164
+ minute=base.minute,
165
+ second=base.second,
166
+ microsecond=base.microsecond,
167
+ tzinfo=base.tzinfo,
168
+ )
169
+
170
+ @classmethod
171
+ def from_datetime(
172
+ cls,
173
+ time: _datetime.time,
174
+ tz: str | Timezone | FixedTimezone | _datetime.tzinfo | None = UTC,
175
+ ) -> Self:
176
+ return cls.instance(
177
+ t=time,
178
+ tz=tz,
179
+ )
180
+
181
+ @classmethod
182
+ def parse(
183
+ cls,
184
+ input,
185
+ ) -> Self:
186
+ output = parse(input=input)
187
+
188
+ if not isinstance(output, cls):
189
+ raise ValueError("Could not parse to time")
190
+
191
+ return output
192
+
193
+ def today(
194
+ self,
195
+ ) -> DateTime:
196
+ return DateTime.now(tz=self.tzinfo).at(
197
+ hour=self.hour,
198
+ minute=self.minute,
199
+ second=self.second,
200
+ microsecond=self.microsecond,
201
+ )
202
+
203
+ def on(
204
+ self,
205
+ date: Date,
206
+ ) -> DateTime:
207
+ return DateTime(
208
+ year=date.year,
209
+ month=date.month,
210
+ day=date.day,
211
+ hour=self.hour,
212
+ minute=self.minute,
213
+ second=self.second,
214
+ microsecond=self.microsecond,
215
+ tzinfo=self.tzinfo,
216
+ )
217
+
218
+
99
219
  class DateTime(BaseDateTime):
100
220
  @classmethod
101
221
  def from_base(
@@ -277,129 +397,25 @@ class DateTime(BaseDateTime):
277
397
  microsecond=self.microsecond,
278
398
  )
279
399
 
280
- def numpy(
281
- self,
282
- ) -> np.datetime64:
283
- return np.datetime64(self)
284
-
285
-
286
- class Date(BaseDate):
287
- @classmethod
288
- def from_base(
289
- cls,
290
- base: BaseDate,
291
- ) -> Self:
292
- return cls(
293
- year=base.year,
294
- month=base.month,
295
- day=base.day,
296
- )
297
-
298
- @classmethod
299
- def from_datetime(
300
- cls,
301
- date: _datetime.date,
302
- ) -> Self:
303
- return cls(
304
- year=date.year,
305
- month=date.month,
306
- day=date.day,
307
- )
308
-
309
- @classmethod
310
- def parse(
311
- cls,
312
- input,
313
- ) -> Self:
314
- output = parse(input=input)
315
-
316
- if not isinstance(output, cls):
317
- raise ValueError("Could not parse to date")
318
-
319
- return output
320
-
321
- def to_datetime(
322
- self,
323
- tz: str | Timezone = UTC,
324
- ) -> DateTime:
325
- return DateTime.create(
400
+ def date(self) -> Date:
401
+ return Date(
326
402
  year=self.year,
327
403
  month=self.month,
328
404
  day=self.day,
329
- hour=0,
330
- minute=0,
331
- second=0,
332
- microsecond=0,
333
- tz=tz,
334
- )
335
-
336
- def numpy(
337
- self,
338
- ) -> np.datetime64:
339
- return np.datetime64(self)
340
-
341
-
342
- class Time(BaseTime):
343
- @classmethod
344
- def from_base(
345
- cls,
346
- base: BaseTime,
347
- ) -> Self:
348
- return cls(
349
- hour=base.hour,
350
- minute=base.minute,
351
- second=base.second,
352
- microsecond=base.microsecond,
353
- tzinfo=base.tzinfo,
354
405
  )
355
406
 
356
- @classmethod
357
- def from_datetime(
358
- cls,
359
- time: _datetime.time,
360
- tz: str | Timezone | FixedTimezone | _datetime.tzinfo | None = UTC,
361
- ) -> Self:
362
- return cls.instance(
363
- t=time,
364
- tz=tz,
365
- )
366
-
367
- @classmethod
368
- def parse(
369
- cls,
370
- input,
371
- ) -> Self:
372
- output = parse(input=input)
373
-
374
- if not isinstance(output, cls):
375
- raise ValueError("Could not parse to time")
376
-
377
- return output
378
-
379
- def today(
380
- self,
381
- ) -> DateTime:
382
- return DateTime.now(tz=self.tzinfo).at(
407
+ def time(self) -> Time:
408
+ return Time(
383
409
  hour=self.hour,
384
410
  minute=self.minute,
385
411
  second=self.second,
386
412
  microsecond=self.microsecond,
387
413
  )
388
414
 
389
- def on(
415
+ def to_numpy(
390
416
  self,
391
- date: Date,
392
- ) -> DateTime:
393
- return DateTime(
394
- year=date.year,
395
- month=date.month,
396
- day=date.day,
397
- hour=self.hour,
398
- minute=self.minute,
399
- second=self.second,
400
- microsecond=self.microsecond,
401
- tzinfo=self.tzinfo,
402
- )
417
+ ) -> np.datetime64:
418
+ return np.datetime64(self)
403
419
 
404
420
 
405
421
  # TODO: NewInterval for working with pandas? nah add to pandas accessor? Or maybe to convert to pandas indexable thing
File without changes
File without changes