Skip to content

Commit

Permalink
Adding Vars trick
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinMendelGleason committed Sep 2, 2022
1 parent 31261fd commit ac2224f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion terminusdb_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .client import Patch, Client # noqa
from .woqldataframe import woqlDataframe as WOQLDataFrame # noqa
from .woqlquery import WOQLQuery # noqa
from .woqlquery import WOQLQuery, Var, Vars # noqa
from .woqlschema import * # noqa
# Backwards compatibility
WOQLClient = Client # noqa
Expand Down
4 changes: 2 additions & 2 deletions terminusdb_client/query_syntax/query_syntax.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from ..woqlquery import WOQLQuery, Var, Doc # noqa
from ..woqlquery import WOQLQuery, Var, Vars, Doc # noqa
import re
import sys

__BARRED = ['re', 'vars']
__ALLOWED = ['__and__', '__or__', '__add__']
__module = sys.modules[__name__]
__exported = ['Var', 'Doc']
__exported = ['Var', 'Vars', 'Doc']


def __create_a_function(attribute):
Expand Down
2 changes: 1 addition & 1 deletion terminusdb_client/woqlquery/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .woql_query import WOQLQuery, Var, Doc # noqa
from .woql_query import WOQLQuery, Var, Vars, Doc # noqa
6 changes: 6 additions & 0 deletions terminusdb_client/woqlquery/woql_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ def __str__(self):
return self.name


class Vars:
def __init__(self, *args):
for arg in args:
setattr(self, arg, Var(arg))


class Doc:
def __init__(self, dictionary):
self.dictionary = dictionary
Expand Down

0 comments on commit ac2224f

Please sign in to comment.