orgmunge 0.2.2__tar.gz → 0.2.3__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: orgmunge
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Programmatically modify Orgmode documents
5
5
  License: MIT
6
6
  Author: durableOne
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "orgmunge"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "Programmatically modify Orgmode documents"
5
5
  authors = ["durableOne <era31asj@gmail.com>"]
6
6
  license = "MIT"
@@ -510,6 +510,17 @@ class Clocking:
510
510
  def duration(self, _):
511
511
  raise TypeError("Can't set the duration for a clocking object! Set the start and/or end time instead.")
512
512
 
513
+ @property
514
+ def duration_seconds(self):
515
+ if self.end_time is None:
516
+ return (dt.now() - self.start_time).seconds
517
+ else:
518
+ return (self.end_time - self.start_time).seconds
519
+
520
+ @duration_seconds.setter
521
+ def duration_seconds(self, _):
522
+ raise TypeError("Can't set the duration for a clocking object! Set the start and/or end time instead.")
523
+
513
524
  def __repr__(self):
514
525
  if self.end_time is None:
515
526
  return f'[{self.start_time.strftime(ORG_TIME_FORMAT)}]'
@@ -521,7 +532,10 @@ class Clocking:
521
532
  return False
522
533
  else:
523
534
  return str(self) == str(other)
524
- class Heading():
535
+
536
+ def __lt__(self, other):
537
+ return
538
+ class Heading:
525
539
  def __init__(self, headline: Headline, contents: Tuple[Scheduling, List[Drawer], str]):
526
540
  self._headline = headline
527
541
  self._scheduling, self._drawers, self.body = contents
@@ -804,6 +818,13 @@ class Heading():
804
818
  for child in children:
805
819
  child.demote_tree()
806
820
 
821
+ def get_path(self):
822
+ "Returns the full path of the current heading as a list of headings"
823
+ if self.parent.title == 'ROOT':
824
+ return [self]
825
+ else:
826
+ return self.parent.get_path() + [self]
827
+
807
828
  def __repr__(self):
808
829
  scheduling = str(self.scheduling) + "\n" if self.scheduling else ""
809
830
  drawers = "".join(d.__str__() for d in self.drawers) if self.drawers else ""