Skip to content

fix: Use data.get() for smooth key retrieval#27

Open
phorward wants to merge 1 commit into
mainfrom
fix-import_export-data-key
Open

fix: Use data.get() for smooth key retrieval#27
phorward wants to merge 1 commit into
mainfrom
fix-import_export-data-key

Conversation

@phorward

@phorward phorward commented Jul 1, 2026

Copy link
Copy Markdown
Member

This sometimes causes exceptions when parsing using-skels where a key wasn't provided.

This sometimes causes exceptions when parsing using-skels where a key wasn't provided.
@phorward phorward added the bug Something isn't working label Jul 1, 2026
@phorward phorward requested a review from ArneGudermann July 1, 2026 17:38
@phorward phorward added the Priority: Low This issue can be considered with enough idle time. label Jul 3, 2026
def _extractor_for_simple_bones(key, conversion_function=str, **kwargs):
def extractor_for_simple_bones(data):
yield key, conversion_function(data[key])
yield key, conversion_function(data.get(key, ""))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
yield key, conversion_function(data.get(key, ""))
yield key, conversion_function(data.get(key, None))

Why not None ?

@sveneberth sveneberth Jul 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ArneGudermann If you want None, you can omit the second paramter complety, because it's the default. ;)

Suggested change
yield key, conversion_function(data.get(key, ""))
yield key, conversion_function(data.get(key))

But I think an empty string is more robust for data processing (csv export)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Priority: Low This issue can be considered with enough idle time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants