Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
gh-975: Fix gafferpy alpha 1
Browse files Browse the repository at this point in the history
  • Loading branch information
t92549 committed Mar 1, 2022
1 parent 2ec511c commit 2e8afc1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
22 changes: 21 additions & 1 deletion python-shell/src/gafferpy/gaffer_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ class GetTraits(Operation):
CLASS = 'uk.gov.gchq.gaffer.store.operation.GetTraits'

def __init__(self,
current_traits,
current_traits=True,
options=None):
super().__init__(
_class_name=self.CLASS, options=options)
Expand All @@ -696,6 +696,26 @@ def to_json(self):
operation['currentTraits'] = self.current_traits
return operation

class HasTrait(Operation):
CLASS = 'uk.gov.gchq.gaffer.store.operation.HasTrait'

def __init__(self,
trait,
current_traits=True,
options=None):
super().__init__(
_class_name=self.CLASS, options=options)

self.trait = trait
self.current_traits = current_traits

def to_json(self):
operation = super().to_json()

operation['trait'] = self.trait
operation['currentTraits'] = self.current_traits
return operation


class AddElements(Operation):
"""
Expand Down
1 change: 1 addition & 0 deletions python-shell/src/test/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def test_execute_get(self):
"uk.gov.gchq.gaffer.operation.impl.function.Filter",
"uk.gov.gchq.gaffer.operation.impl.function.Transform",
"uk.gov.gchq.gaffer.operation.impl.function.Aggregate",
"uk.gov.gchq.gaffer.store.operation.HasTrait",
"uk.gov.gchq.gaffer.store.operation.GetTraits",
"uk.gov.gchq.gaffer.mapstore.operation.CountAllElementsDefaultView",
"uk.gov.gchq.gaffer.operation.export.graph.ExportToOtherAuthorisedGraph",
Expand Down
1 change: 1 addition & 0 deletions python-shell/src/test/test_connector_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def test_execute_get(self):
"uk.gov.gchq.gaffer.operation.impl.function.Filter",
"uk.gov.gchq.gaffer.operation.impl.function.Transform",
"uk.gov.gchq.gaffer.operation.impl.function.Aggregate",
"uk.gov.gchq.gaffer.store.operation.HasTrait",
"uk.gov.gchq.gaffer.store.operation.GetTraits",
"uk.gov.gchq.gaffer.mapstore.operation.CountAllElementsDefaultView",
"uk.gov.gchq.gaffer.operation.export.graph.ExportToOtherAuthorisedGraph",
Expand Down
13 changes: 13 additions & 0 deletions python-shell/src/test/test_gaffer_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4996,6 +4996,19 @@ class GafferOperationsTest(unittest.TestCase):
operation=g.GetElements()
)
],
[
'''
{
"class" : "uk.gov.gchq.gaffer.store.operation.HasTrait",
"trait": "VISIBILITY",
"currentTraits" : true
}
''',
g.HasTrait(
trait="VISIBILITY",
current_traits=True
)
],
[
'''
{
Expand Down

0 comments on commit 2e8afc1

Please sign in to comment.