Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Python UFC SDK updates#29

Merged
schmit merged 2 commits intoallocation-revampfrom
allocation-revamp-additional-tests
Apr 12, 2024
Merged

Python UFC SDK updates#29
schmit merged 2 commits intoallocation-revampfrom
allocation-revamp-additional-tests

Conversation

@schmit
Copy link

@schmit schmit commented Apr 12, 2024


labels: mergeable

Fixes: #issue

Motivation and Context

Description

How has this been tested?

Copy link

@giorgiomartini0 giorgiomartini0 left a comment

Choose a reason for hiding this comment

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

Nothing blocking

default,
subject_attributes,
VariationType.NUMERIC,
# convert to float in case we get an int

Choose a reason for hiding this comment

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

👍 Took me a moment to understand – I first thought you were going to rescue a mismatch (getNumeric for an Integer flag) which I didn't like. But what you're doing is ensuring that 3.0 (a valid variation for a numeric flag) is indeed returned as a float and not as the integer 3.

Comment on lines +251 to +252
# we can convert int to float
return isinstance(value, float) or isinstance(value, int)

Choose a reason for hiding this comment

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

or isinstance(value, int) seems unnecessary? With this PR we always convert to float? Other than in one of the tests where I see that you explicitly rely on this behavior. In any case this is fine to keep - it's more that I want to check my understanding.

Copy link
Author

Choose a reason for hiding this comment

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

Without the or this check would fail for an integer value such as 1, which we can convert to a float

Choose a reason for hiding this comment

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

I get it now. The cast to float is done after validating the value type, so this is indeed necessary.

Comment on lines +45 to +47
if condition.value:
return subject_value is None
return subject_value is not None

Choose a reason for hiding this comment

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

supernit, optional: could write as return (subject_value is None) if condition.value else (subject_value is not None)

@schmit schmit merged commit 1b830d8 into allocation-revamp Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants