mayutils 1.2.3__tar.gz → 1.2.4__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.
- {mayutils-1.2.3 → mayutils-1.2.4}/PKG-INFO +1 -1
- {mayutils-1.2.3 → mayutils-1.2.4}/pyproject.toml +1 -1
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/datetime.py +125 -74
- {mayutils-1.2.3 → mayutils-1.2.4}/LICENSE +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/README.md +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/core/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/core/constants.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/analysis/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/cache/.gitkeep +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/live.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/local.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/queries/.gitkeep +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/queries/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/queries/examples/.gitkeep +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/data/read.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/benchmarking.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/databases.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/filesystem.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/logging.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/memoisation.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/oauth.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/environment/webdrivers.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/export/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/export/images.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/export/pdf.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/export/slides.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/interfaces/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/interfaces/google.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/interfaces/microsoft.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/interfaces/streamlit.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/mathematics/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/mathematics/numba.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/mathematics/numpy.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/classes.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/colours.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/dataframes.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/decorators.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/dictionaries.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/functions.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/hashing.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/numbers.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/strings.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/objects/types.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/scripts/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/scripts/clear_cache.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/scripts/versioning.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/testing/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/console.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/combine.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/matplotlib/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/matplotlib/template.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/plotly/__init__.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/plotly/charts.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/plotly/templates.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/plotly/traces.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/graphs/plotly/utilities.py +0 -0
- {mayutils-1.2.3 → mayutils-1.2.4}/src/mayutils/visualisation/notebook.py +0 -0
|
@@ -2,6 +2,7 @@ from contextlib import _GeneratorContextManager
|
|
|
2
2
|
from sqlite3 import register_adapter
|
|
3
3
|
from typing import Any, Optional, Self, Literal
|
|
4
4
|
import datetime as _datetime
|
|
5
|
+
import numpy as np
|
|
5
6
|
from pendulum import (
|
|
6
7
|
DateTime as BaseDateTime,
|
|
7
8
|
Date as BaseDate,
|
|
@@ -95,80 +96,6 @@ class Timezone(BaseTimezone):
|
|
|
95
96
|
UTC = Timezone(key="UTC")
|
|
96
97
|
|
|
97
98
|
|
|
98
|
-
class Date(BaseDate):
|
|
99
|
-
@classmethod
|
|
100
|
-
def from_base(
|
|
101
|
-
cls,
|
|
102
|
-
base: BaseDate,
|
|
103
|
-
) -> Self:
|
|
104
|
-
return cls(
|
|
105
|
-
year=base.year,
|
|
106
|
-
month=base.month,
|
|
107
|
-
day=base.day,
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
@classmethod
|
|
111
|
-
def from_datetime(
|
|
112
|
-
cls,
|
|
113
|
-
date: _datetime.date,
|
|
114
|
-
) -> Self:
|
|
115
|
-
return cls(
|
|
116
|
-
year=date.year,
|
|
117
|
-
month=date.month,
|
|
118
|
-
day=date.day,
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
@classmethod
|
|
122
|
-
def parse(
|
|
123
|
-
cls,
|
|
124
|
-
input,
|
|
125
|
-
) -> Self:
|
|
126
|
-
output = parse(input=input)
|
|
127
|
-
|
|
128
|
-
if not isinstance(output, cls):
|
|
129
|
-
raise ValueError("Could not parse to date")
|
|
130
|
-
|
|
131
|
-
return output
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class Time(BaseTime):
|
|
135
|
-
@classmethod
|
|
136
|
-
def from_base(
|
|
137
|
-
cls,
|
|
138
|
-
base: BaseTime,
|
|
139
|
-
) -> Self:
|
|
140
|
-
return cls(
|
|
141
|
-
hour=base.hour,
|
|
142
|
-
minute=base.minute,
|
|
143
|
-
second=base.second,
|
|
144
|
-
microsecond=base.microsecond,
|
|
145
|
-
tzinfo=base.tzinfo,
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
@classmethod
|
|
149
|
-
def from_datetime(
|
|
150
|
-
cls,
|
|
151
|
-
time: _datetime.time,
|
|
152
|
-
tz: str | Timezone | FixedTimezone | _datetime.tzinfo | None = UTC,
|
|
153
|
-
) -> Self:
|
|
154
|
-
return cls.instance(
|
|
155
|
-
t=time,
|
|
156
|
-
tz=tz,
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
@classmethod
|
|
160
|
-
def parse(
|
|
161
|
-
cls,
|
|
162
|
-
input,
|
|
163
|
-
) -> Self:
|
|
164
|
-
output = parse(input=input)
|
|
165
|
-
|
|
166
|
-
if not isinstance(output, cls):
|
|
167
|
-
raise ValueError("Could not parse to time")
|
|
168
|
-
|
|
169
|
-
return output
|
|
170
|
-
|
|
171
|
-
|
|
172
99
|
class DateTime(BaseDateTime):
|
|
173
100
|
@classmethod
|
|
174
101
|
def from_base(
|
|
@@ -350,6 +277,130 @@ class DateTime(BaseDateTime):
|
|
|
350
277
|
microsecond=self.microsecond,
|
|
351
278
|
)
|
|
352
279
|
|
|
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(
|
|
326
|
+
year=self.year,
|
|
327
|
+
month=self.month,
|
|
328
|
+
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
|
+
)
|
|
355
|
+
|
|
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(
|
|
383
|
+
hour=self.hour,
|
|
384
|
+
minute=self.minute,
|
|
385
|
+
second=self.second,
|
|
386
|
+
microsecond=self.microsecond,
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
def on(
|
|
390
|
+
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
|
+
)
|
|
403
|
+
|
|
353
404
|
|
|
354
405
|
# TODO: NewInterval for working with pandas? nah add to pandas accessor? Or maybe to convert to pandas indexable thing
|
|
355
406
|
class Interval(BaseInterval):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|