Skip to content

Conversation

@Ashhm
Copy link
Contributor

@Ashhm Ashhm commented Jan 9, 2020

No description provided.

Bulakh Serhii added 4 commits January 8, 2020 17:36
Extend types.py
Add tests
Add cassette
Add method description
data: Union[PhotoInputData, SelfiePhotoInputData, SelfieVideoInputData],
group: int = None
):
if group is not None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this, does there any other way to not pass group if is None?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks ok. you can also add group key after initializing the required keys to avoid code duplication I guess

Copy link
Contributor Author

@Ashhm Ashhm Jan 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I will have to add group property for every instance?

)
)

def send_input(self, identity_id: str, inputs_data: InputsData) -> List[Dict[str, bool]]:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have class name and its structure like we have in js lib (SendInputRequest)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Rename InputsData class to SendInputRequest
group: int = None
):
if group is not None:
dict.__init__(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to use super() here and in the else branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to serialize this structure with json.dumps in the future so I inherited from dict. There are two different structures with the group and without and if group equals None it converts to null and it's not correct for our case, so I used super constructor to handle such case

encoder = MultipartEncoder(files)
endpoint = 'v2/identities/{identity_id}/send-input'
return self._call_http(
path=endpoint.format(identity_id=identity_id),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-string would look nicer here :) like this:

...
path=f'v2/identities/{identity_id}/send-input',
...

Copy link
Contributor Author

@Ashhm Ashhm Jan 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thanks, done

data: Union[PhotoInputData, SelfiePhotoInputData, SelfieVideoInputData],
group: int = None
):
if group is not None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks ok. you can also add group key after initializing the required keys to avoid code duplication I guess

@Ashhm Ashhm requested a review from vedi January 9, 2020 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants