clockwork 0.1.0__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clockwork
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Toolkit for time-related operations including scheduling, logging, date manipulation, and more.
5
5
  Home-page: https://github.com/zteinck/clockwork
6
6
  License: MIT
@@ -23,4 +23,20 @@ Project-URL: Repository, https://github.com/zteinck/clockwork
23
23
  Description-Content-Type: text/markdown
24
24
 
25
25
  # clockwork
26
- `clockwork` is a library that provides a multitude of time-related functionalities, facilitating tasks such as scheduling, logging, date manipulation, and more.
26
+
27
+ <div>
28
+
29
+ [![Package version](https://img.shields.io/pypi/v/clockwork?color=%2334D058&label=pypi)](https://pypi.org/project/clockwork/)
30
+ [![License](https://img.shields.io/github/license/zteinck/clockwork)](https://github.com/zteinck/clockwork/blob/master/LICENSE)
31
+
32
+ </div>
33
+
34
+
35
+ `clockwork` is a Python package that provides a multitude of time-related functionalities, facilitating tasks such as scheduling, logging, date manipulation, and more.
36
+
37
+
38
+ ## Installation
39
+ ```sh
40
+ pip install clockwork
41
+ ```
42
+
@@ -0,0 +1,17 @@
1
+ # clockwork
2
+
3
+ <div>
4
+
5
+ [![Package version](https://img.shields.io/pypi/v/clockwork?color=%2334D058&label=pypi)](https://pypi.org/project/clockwork/)
6
+ [![License](https://img.shields.io/github/license/zteinck/clockwork)](https://github.com/zteinck/clockwork/blob/master/LICENSE)
7
+
8
+ </div>
9
+
10
+
11
+ `clockwork` is a Python package that provides a multitude of time-related functionalities, facilitating tasks such as scheduling, logging, date manipulation, and more.
12
+
13
+
14
+ ## Installation
15
+ ```sh
16
+ pip install clockwork
17
+ ```
@@ -0,0 +1,4 @@
1
+ from .core import *
2
+
3
+ __version__ = '0.1.2'
4
+ __author__ = 'Zachary Einck <zacharyeinck@gmail.com>'
@@ -427,17 +427,20 @@ class DateBase(object):
427
427
  return wrapper
428
428
 
429
429
 
430
-
431
- #+---------------------------------------------------------------------------+
432
- # Class Methods
433
- #+---------------------------------------------------------------------------+
434
- # None
435
-
436
-
437
430
  #+---------------------------------------------------------------------------+
438
431
  # Properties
439
432
  #+---------------------------------------------------------------------------+
440
433
 
434
+ @property
435
+ def date(self):
436
+ ''' returns normalized instance '''
437
+ return self.normalize()
438
+
439
+ @property
440
+ def d(self):
441
+ ''' converts datetime.datetime to datetime.date '''
442
+ return self.datetime.date()
443
+
441
444
  @property
442
445
  def dt(self):
443
446
  ''' datetime alias '''
@@ -449,14 +452,14 @@ class DateBase(object):
449
452
  return pd.to_datetime(self.dt)
450
453
 
451
454
  @property
452
- def sql_server(self):
455
+ def ymd(self):
453
456
  ''' string in YYYY-MM-DD format '''
454
457
  return self.str('%Y-%m-%d')
455
458
 
456
459
  @property
457
- def sqlsvr(self):
458
- ''' sql_server alias '''
459
- return self.sql_server
460
+ def sql_server(self):
461
+ ''' ymd alias '''
462
+ return self.ymd
460
463
 
461
464
  @property
462
465
  def oracle(self):
@@ -564,7 +567,6 @@ class DateBase(object):
564
567
  return isinstance(Date(self.sqlsvr), MonthEnd)
565
568
 
566
569
 
567
-
568
570
  #+---------------------------------------------------------------------------+
569
571
  # Magic Methods
570
572
  #+---------------------------------------------------------------------------+
@@ -703,16 +705,16 @@ class MonthEnd(DateBase):
703
705
  super().__init__(dt.replace(day=n_days_in_month(dt.year, dt.month)))
704
706
 
705
707
  @property
706
- def label(self):
707
- return self.str('%Y%b')
708
+ def long(self):
709
+ return self.str('%Y-%m-%d')
708
710
 
709
711
  @property
710
- def short(self):
711
- return self.str('%b-%y')
712
+ def compact(self):
713
+ return self.str('%Y-%m')
712
714
 
713
715
  @property
714
- def mid(self):
715
- return self.str('%b%y')
716
+ def short(self):
717
+ return self.str('%b')
716
718
 
717
719
  @property
718
720
  def last_quarter_end(self):
@@ -740,24 +742,20 @@ class QuarterEnd(MonthEnd):
740
742
  self.qtr = qtr
741
743
 
742
744
  @property
743
- def label(self):
745
+ def long(self):
744
746
  return f'{self.year}Q{self.qtr}'
745
747
 
746
748
  @property
747
- def strqtr(self):
748
- return self.label
749
-
750
- @property
751
- def quarter(self):
752
- return self.qtr
749
+ def compact(self):
750
+ return f'{self.qtr}Q' + self.str('%y')
753
751
 
754
752
  @property
755
753
  def short(self):
756
754
  return f'Q{self.qtr}'
757
755
 
758
756
  @property
759
- def mid(self):
760
- return f'{self.qtr}Q{str(self.year)[2:]}'
757
+ def quarter(self):
758
+ return self.qtr
761
759
 
762
760
  def to_month_end(self):
763
761
  return MonthEnd(self.dt)
@@ -769,12 +767,4 @@ class QuarterEnd(MonthEnd):
769
767
  if delta == 0: return self
770
768
  dt = self.shift(months=delta * 3).dt
771
769
  qtr = ((self.qtr - 1 + delta) % 4) + 1
772
- return QuarterEnd(dt, qtr)
773
-
774
-
775
-
776
-
777
-
778
-
779
- if __name__ == '__main__':
780
- pass
770
+ return QuarterEnd(dt, qtr)
@@ -1,14 +1,14 @@
1
- from clockwork import Date, elapsed_time
2
- from iterlab import to_iter
3
- from pathpilot import Folder
4
- from clockwork.chronicle import Logger
5
- from contextlib import redirect_stdout
6
- from schedule import Scheduler, CancelJob
7
1
  import datetime
8
2
  import time
9
3
  import uuid
10
4
  import os
5
+ from contextlib import redirect_stdout
6
+ from schedule import Scheduler, CancelJob
7
+ from iterlab import to_iter
8
+ from pathpilot import Folder
11
9
 
10
+ from .core import Date, elapsed_time
11
+ from .chronicle import Logger
12
12
 
13
13
 
14
14
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "clockwork"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "Toolkit for time-related operations including scheduling, logging, date manipulation, and more."
5
5
  authors = ["Zachary Einck <zacharyeinck@gmail.com>"]
6
6
  license = "MIT"
clockwork-0.1.0/README.md DELETED
@@ -1,2 +0,0 @@
1
- # clockwork
2
- `clockwork` is a library that provides a multitude of time-related functionalities, facilitating tasks such as scheduling, logging, date manipulation, and more.
@@ -1,4 +0,0 @@
1
- from .clockwork import *
2
-
3
- __version__ = '0.1.0'
4
- __author__ = 'Zachary Einck <zacharyeinck@gmail.com>'
File without changes