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

Add deserialization_fn parameter to serializable_field #44

Closed
wants to merge 35 commits into from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 3, 2023

Description

This PR adds a new deserialization_fn parameter to the serializable_field() function in the muutils.json_serialize.serializable_dataclass module. The deserialization_fn parameter allows for specifying a function that will be used to deserialize individual fields, taking the field value as an argument. This change improves the code clarity and aligns with typical usage patterns for deserialization functions.

Summary of Changes

  • Added deserialization_fn parameter to the SerializableField class in the muutils.json_serialize.serializable_dataclass module.
  • Updated the serializable_field() function to include the deserialization_fn parameter when creating SerializableField instances.
  • Modified the serializable_dataclass decorator function to handle the deserialization_fn parameter when creating or modifying SerializableField instances.

Fixes #40.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/add-deserialization-fn

To make tweaks to this pull request, leave a comment below or in the code.

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 3, 2023
@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Sep 14, 2023

GitHub actions yielded the following error.

The relevant lines from the logs are:

Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'tomllib'

This error occurred during the execution of the command make check-format.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Sep 14, 2023

GitHub actions yielded the following error.

The relevant lines from the logs are:

ERROR tests/unit/test_dictmagic.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_defaults.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_properties_nested.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_serializable_dataclass.py - NameError: name 'deserialization_fn' is not defined

These errors occurred during the execution of the make test command.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

3 similar comments
@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Sep 14, 2023

GitHub actions yielded the following error.

The relevant lines from the logs are:

ERROR tests/unit/test_dictmagic.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_defaults.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_properties_nested.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_serializable_dataclass.py - NameError: name 'deserialization_fn' is not defined

These errors occurred during the execution of the make test command.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Sep 14, 2023

GitHub actions yielded the following error.

The relevant lines from the logs are:

ERROR tests/unit/test_dictmagic.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_defaults.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_properties_nested.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_serializable_dataclass.py - NameError: name 'deserialization_fn' is not defined

These errors occurred during the execution of the make test command.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Sep 14, 2023

GitHub actions yielded the following error.

The relevant lines from the logs are:

ERROR tests/unit/test_dictmagic.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_defaults.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_properties_nested.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_serializable_dataclass.py - NameError: name 'deserialization_fn' is not defined

These errors occurred during the execution of the make test command.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Sep 14, 2023

GitHub actions yielded the following error.

The relevant lines from the logs are:

ERROR tests/unit/test_dictmagic.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_defaults.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_sdc_properties_nested.py - NameError: name 'deserialization_fn' is not defined
ERROR tests/unit/json_serialize/serializable_dataclass/test_serializable_dataclass.py - NameError: name 'deserialization_fn' is not defined

These errors occurred during the execution of the make test command.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@mivanit mivanit closed this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clearer alternative to loading_fn
1 participant