Skip to content

Commit 6a5a659

Browse files
committed
Remove more unnecessary methods
1 parent 73f70b2 commit 6a5a659

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

singer/bookmarks.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
import json
2-
import sys
31
from typing import Any, Dict, Optional, Sequence, Union
42
from .logger import get_logger
53

64

75
LOGGER = get_logger()
86

97

10-
def write_state(state):
11-
json.dump(state.to_dict(), sys.stdout, indent=2)
12-
13-
148
class State:
159
def __init__(
1610
self, bookmarks: Optional[Dict] = None, currently_syncing: Optional[str] = None # pylint: disable=bad-continuation
@@ -28,11 +22,6 @@ def __eq__(self, other: Any) -> bool:
2822
def bookmarks(self) -> Dict:
2923
return self._bookmarks
3024

31-
@classmethod
32-
def load(cls, filename: str) -> "State":
33-
with open(filename) as fp: # pylint: disable=invalid-name
34-
return State.from_dict(json.load(fp))
35-
3625
@classmethod
3726
def from_dict(cls, data: Dict) -> "State":
3827
return State(
@@ -46,9 +35,6 @@ def to_dict(self) -> Dict:
4635
state["currently_syncing"] = self.get_currently_syncing()
4736
return state
4837

49-
def dump(self) -> None:
50-
json.dump(self.to_dict(), sys.stdout, indent=2)
51-
5238
def _ensure_bookmark_path(self, path: Sequence) -> None:
5339
submap = self.bookmarks
5440
for path_component in path:

tests/test_bookmarks.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,6 @@
11
from copy import copy
22
import unittest
3-
from singer.bookmarks import State, write_state
4-
5-
6-
class TestWriteState(unittest.TestCase):
7-
def test_write_empty_state(self):
8-
state = State()
9-
write_state(state)
10-
11-
def test_write_state_with_bookmarks(self):
12-
stream_id_1 = "customers"
13-
bookmark_key_1 = "datetime"
14-
bookmark_val_1 = 123456789
15-
offset_key = "key"
16-
offset_val = "fizzy water"
17-
18-
bookmarks = {
19-
stream_id_1: {
20-
bookmark_key_1: bookmark_val_1,
21-
"offset": {offset_key: offset_val},
22-
}
23-
}
24-
25-
state = State(bookmarks=bookmarks, currently_syncing="customers")
26-
write_state(state)
3+
from singer.bookmarks import State
274

285

296
class TestGetBookmark(unittest.TestCase):

0 commit comments

Comments
 (0)