Skip to content

Commit 065198f

Browse files
emmas-yotiecharrod
authored andcommitted
SDK-722: Rename methods from wanted_attribute_builder to conform to PEP8
1 parent eba814c commit 065198f

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

yoti_python_sdk/dynamic_sharing_service/policy/dynamic_policy_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def with_wanted_attribute(self, wanted_attribute):
3939
"""
4040

4141
def with_wanted_attribute_by_name(self, wanted_name):
42-
attribute = WantedAttributeBuilder().withName(wanted_name).build()
42+
attribute = WantedAttributeBuilder().with_name(wanted_name).build()
4343
return self.with_wanted_attribute(attribute)
4444

4545
def with_family_name(self):
@@ -57,8 +57,8 @@ def with_date_of_birth(self):
5757
def with_age_derived_attribute(self, derivation):
5858
attribute = (
5959
WantedAttributeBuilder()
60-
.withName(config.ATTRIBUTE_DATE_OF_BIRTH)
61-
.withDerivation(derivation)
60+
.with_name(config.ATTRIBUTE_DATE_OF_BIRTH)
61+
.with_derivation(derivation)
6262
.build()
6363
)
6464
return self.with_wanted_attribute(attribute)

yoti_python_sdk/dynamic_sharing_service/policy/wanted_attribute_builder.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,22 @@ class WantedAttributeBuilder(object):
1010
def __init__(self):
1111
self.__attribute = {}
1212

13-
"""
14-
@param name Sets name
15-
"""
16-
17-
def withName(self, name):
13+
def with_name(self, name):
14+
"""
15+
:param name: Sets name
16+
"""
1817
self.__attribute["name"] = name
1918
return self
2019

21-
"""
22-
@param derivation Sets derivation
23-
"""
24-
25-
def withDerivation(self, derivation):
20+
def with_derivation(self, derivation):
21+
"""
22+
:param derivation: Sets derivation
23+
"""
2624
self.__attribute["derivation"] = derivation
2725
return self
2826

29-
"""
30-
@return The wanted attribute object
31-
"""
32-
3327
def build(self):
28+
"""
29+
:return: The wanted attribute object
30+
"""
3431
return self.__attribute.copy()

yoti_python_sdk/tests/dynamic_sharing_service/policy/test_dynamic_policy_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def test_an_attribute_can_only_exist_once():
1212
NAME = "Test name"
1313

14-
wanted_attribute = WantedAttributeBuilder().withName(NAME).build()
14+
wanted_attribute = WantedAttributeBuilder().with_name(NAME).build()
1515

1616
policy = (
1717
DynamicPolicyBuilder()

yoti_python_sdk/tests/dynamic_sharing_service/policy/test_wanted_attribute_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_build():
99

1010
builder = WantedAttributeBuilder()
1111

12-
attribute = builder.withName(NAME).withDerivation(DERIVATION).build()
12+
attribute = builder.with_name(NAME).with_derivation(DERIVATION).build()
1313

1414
assert attribute["name"] == NAME
1515
assert attribute["derivation"] == DERIVATION

0 commit comments

Comments
 (0)