Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve typing in expressions module. #851

Merged
merged 5 commits into from
Sep 17, 2020
Merged

Conversation

jpinner-lyft
Copy link
Contributor

No description provided.

@jpinner-lyft jpinner-lyft force-pushed the expression-typing branch 2 times, most recently from 100b155 to fc5a603 Compare September 17, 2020 02:31
from pynamodb.attributes import Attribute
from pynamodb.expressions.operand import Path
from pynamodb.expressions.util import substitute_names


def create_projection_expression(attributes_to_get, placeholders):
def create_projection_expression(attributes_to_get, placeholders: Dict[str, str]) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

attributes_to_get too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that comes from connection base where it's typed as Optional[Any] -- so far I've inferred its:
Union[List[Attribute], List[Path], List[str], Attribute, Path, str]
but I was going to punt on it for now

@@ -44,10 +44,6 @@ def __repr__(self):
values = [str(value) for value in self.values]
return self.format_string.format(*values, operator=self.operator)

def __nonzero__(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch

@jpinner-lyft jpinner-lyft merged commit d7e2f57 into master Sep 17, 2020
@jpinner-lyft jpinner-lyft deleted the expression-typing branch September 17, 2020 03:39
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.

None yet

2 participants