Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled the functionality of remove() #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ Functions offered:

Prints all the query IDs attached to every query.

* remove(q_ids: list):

Removes all the queries given in the list argument "q_ids". And re-renders the remaining queries.

## Usage

1. [Install](#installation) the package.
Expand Down
27 changes: 1 addition & 26 deletions tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,31 +177,6 @@ def test_unique(self):
# Add assertions to test the behavior of the owns function
self.assertEqual(self.builder.get_schema(), expected_output, message)


def test_remove(self):
self.builder.sub("name","attribute","string")
self.builder.regex("name","[ABC]*")
self.builder.sub("person","entity")
self.builder.owns("person","name")
qid=self.builder.unique("person","name")
self.builder.key("person","name")
self.builder.remove([qid])

expected_output = """define
name sub attribute,
value string,
regex "[ABC]*";
person sub entity,
owns name,
owns name @key;"""



message = "remove method failed"

# Add assertions to test the behavior of the owns function
self.assertEqual(self.builder.get_schema(), expected_output, message)


if __name__ == '__main__':
unittest.main()
unittest.main()
16 changes: 0 additions & 16 deletions typedbSchemaBuilder/Builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,22 +398,6 @@ def make_query(self, query: list):
query_type = query[0]
getattr(self, query_type)(*query[1:])

def remove(self, q_ids: list):
n = len(self._query_log)
self._schema = "define"
self._context = "?#"

old_query_log = deque()
old_query_log, self._query_log = self._query_log, old_query_log

self.init_types()
for i in range(0, n):
query = old_query_log[0]
old_query_log.popleft()
if query[-1] in q_ids:
continue
self.make_query(query)

def print_query_log(self):
for q in self._query_log:
print(q)