Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0E78D200CA5 for ; Fri, 26 May 2017 14:24:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0D668160BC8; Fri, 26 May 2017 12:24:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1413C160BF7 for ; Fri, 26 May 2017 14:24:15 +0200 (CEST) Received: (qmail 2852 invoked by uid 500); 26 May 2017 12:24:15 -0000 Mailing-List: contact commits-help@tinkerpop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.apache.org Delivered-To: mailing list commits@tinkerpop.apache.org Received: (qmail 2499 invoked by uid 99); 26 May 2017 12:24:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 May 2017 12:24:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 19096F0DBE; Fri, 26 May 2017 12:24:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: spmallette@apache.org To: commits@tinkerpop.apache.org Date: Fri, 26 May 2017 12:24:46 -0000 Message-Id: <03daf3de0d8d43dd9705002af9647e0d@git.apache.org> In-Reply-To: <405ef61ac45642868d30ecd8317fcee9@git.apache.org> References: <405ef61ac45642868d30ecd8317fcee9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [33/38] tinkerpop git commit: TINKERPOP-786 Made python DSL example like the java example archived-at: Fri, 26 May 2017 12:24:18 -0000 TINKERPOP-786 Made python DSL example like the java example Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/5e09caf1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/5e09caf1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/5e09caf1 Branch: refs/heads/tp32 Commit: 5e09caf175e8c89695718a4987bff8fd241f8147 Parents: a3d42d5 Author: Stephen Mallette Authored: Thu May 11 08:55:51 2017 -0400 Committer: Stephen Mallette Committed: Tue May 16 11:02:31 2017 -0400 ---------------------------------------------------------------------- gremlin-python/src/main/jython/tests/process/test_dsl.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5e09caf1/gremlin-python/src/main/jython/tests/process/test_dsl.py ---------------------------------------------------------------------- diff --git a/gremlin-python/src/main/jython/tests/process/test_dsl.py b/gremlin-python/src/main/jython/tests/process/test_dsl.py index 92196fe..04313ab 100644 --- a/gremlin-python/src/main/jython/tests/process/test_dsl.py +++ b/gremlin-python/src/main/jython/tests/process/test_dsl.py @@ -57,16 +57,21 @@ class SocialTraversalSource(GraphTraversalSource): super(SocialTraversalSource, self).__init__(*args, **kwargs) self.graph_traversal = SocialTraversal - def persons(self): + def persons(self, *args): traversal = self.get_graph_traversal() traversal.bytecode.add_step("V") traversal.bytecode.add_step("hasLabel", "person") + + if len(args) > 0: + traversal.bytecode.add_step("has", "name", P.within(args)) + return traversal def test_dsl(remote_connection): social = Graph().traversal(SocialTraversalSource).withRemote(remote_connection) - assert social.V().has("name", "marko").knows("josh").next() - assert social.V().has("name", "marko").youngestFriendsAge().next() == 27 + assert social.persons("marko").knows("josh").next() + assert social.persons("marko").youngestFriendsAge().next() == 27 assert social.persons().count().next() == 4 + assert social.persons("marko", "josh").count().next() == 2 assert social.persons().filter(___.createdAtLeast(2)).count().next() == 1