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

MAINT: Refactor to remove the _usefmtflag #802

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Conversation

tnatt
Copy link
Collaborator

@tnatt tnatt commented Sep 24, 2024

PR to refactor and remove the internal variable _usefmtflag by picking up this format information from the objdata.fmt instead

This _usefmtflag variable is used to indicate if a point/polygon has "xtgeo" in the format string (then no renaming of column names should occur on the dataframe). It was necessary to run the self._update_fmt_flag() in order to make sure the state of this variable was set correctly. This function is here removed.

@@ -86,9 +86,12 @@ def export_metadata_file(
def export_file(
obj: types.Inferrable,
filename: Path,
flag: str | None = None,
fmt: str = "",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Renamed to fmt to make it more clear what it is

@tnatt tnatt requested review from mferrera, slangeveld and jcrivenaes and removed request for mferrera September 24, 2024 14:35
@@ -942,7 +931,7 @@ def export(
outfile = Path(metadata["file"]["absolute_path"])
metafile = outfile.parent / f".{outfile.name}.yml"

export_file(obj, outfile, flag=self._usefmtflag)
export_file(obj, outfile, fmt=metadata["data"].get("format", ""))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

data.format in the metadata is populated by the objdata.fmt

Copy link
Collaborator

@mferrera mferrera left a comment

Choose a reason for hiding this comment

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

🎉 One less state mutation, nice!

@tnatt tnatt merged commit 8d293da into equinor:main Sep 25, 2024
13 checks passed
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.

2 participants