Skip to content

Commit

Permalink
fix: add source data as generic source value
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshujain committed Jul 11, 2022
1 parent 3a31a78 commit 8d2334a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion py_patterns/adapters/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ def get_value(self, target_field, source_data):
self.target = target_field

lookup_keys = []
converted_value = None
if not self.source:
lookup_keys.append(target_field)
elif self.source == "*":
converted_value = dict(source_data)
else:
lookup_keys = self.source.split(".")
converted_value = self.lookup_data(lookup_keys, source_data)
if lookup_keys:
converted_value = self.lookup_data(lookup_keys, source_data)

# validate data type for converted value if given
if (
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "py-patterns-util"
version = "0.1.0"
version = "0.1.1"
description = "A util library for common patterns in python."
authors = ["Priyanshu Jain <[email protected]>"]
packages = [
Expand Down

0 comments on commit 8d2334a

Please sign in to comment.