Skip to content

Commit 1845604

Browse files
committed
refactor!: remove defs() from Client
1 parent d44351e commit 1845604

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

phable/client.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -223,38 +223,6 @@ def close(self) -> Grid:
223223

224224
return self.call("close")
225225

226-
def defs(self, filter: str | None = None, limit: int | None = None) -> Grid:
227-
"""Queries [def dicts](https://project-haystack.org/doc/docHaystack/Defs) from
228-
the current
229-
[namespace](https://project-haystack.org/doc/docHaystack/Namespaces).
230-
231-
Parameters:
232-
filter:
233-
An optional Project Haystack defined
234-
[filter](https://project-haystack.org/doc/docHaystack/Filters) for
235-
querying the server. If a filter is not specified, all defs are
236-
requested from the server.
237-
limit:
238-
An optional integer that specifies the maximum number of defs to return
239-
in the response.
240-
241-
Returns:
242-
A `Grid` with a `dict` representation of each `def`.
243-
"""
244-
data_row = {}
245-
246-
if filter is not None:
247-
data_row["filter"] = filter
248-
if limit is not None:
249-
data_row["limit"] = limit
250-
251-
if len(data_row) > 0:
252-
response = self.call("defs", Grid.to_grid(data_row))
253-
else:
254-
response = self.call("defs")
255-
256-
return response
257-
258226
def read(self, filter: str, checked: bool = True) -> Grid:
259227
"""Read from the database the first record which matches the
260228
[filter](https://project-haystack.org/doc/docHaystack/Filters).

tests/test_client.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -115,40 +115,6 @@ def test_about_op(client: Client):
115115
assert client.about()["vendorName"] == "SkyFoundry"
116116

117117

118-
def test_defs_with_no_opts(client: Client):
119-
data_rows = client.defs().rows
120-
121-
assert len(data_rows) > 0
122-
assert "def" in data_rows[0].keys()
123-
124-
125-
def test_defs_with_limit(client: Client):
126-
data_rows = client.defs(limit=1).rows
127-
128-
assert len(data_rows) == 1
129-
assert "def" in data_rows[0].keys()
130-
131-
132-
def test_defs_with_filter(client: Client):
133-
data_rows = client.defs("func").rows
134-
135-
assert len(data_rows) > 5
136-
assert "def" in data_rows[0].keys()
137-
138-
139-
def test_defs_with_limit_and_filter(client: Client):
140-
data_rows = client.defs("func", 1).rows
141-
142-
assert len(data_rows) == 1
143-
assert "def" in data_rows[0].keys()
144-
145-
146-
def test_defs_with_empty_grid_response(client: Client):
147-
data_rows = client.defs("point").rows
148-
149-
assert len(data_rows) == 0
150-
151-
152118
def test_read_site(client: Client):
153119
grid = client.read('site and dis=="Carytown"')
154120
assert grid.rows[0]["geoState"] == "VA"

0 commit comments

Comments
 (0)