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

grass.temporal.stds_export: Use pathlib Path.read_text and Path.write_text #4293

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions python/grass/temporal/stds_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import shutil
import tarfile
import tempfile
from pathlib import Path

import grass.script as gs
from grass.exceptions import CalledModuleError
Expand Down Expand Up @@ -402,9 +403,7 @@ def export_stds(
# Write projection and metadata
proj = gs.read_command("g.proj", flags="j")

proj_file = open(proj_file_name, "w")
proj_file.write(proj)
proj_file.close()
Path(proj_file_name).write_text(proj)

init_file = open(init_file_name, "w")
# Create the init string
Expand All @@ -431,9 +430,7 @@ def export_stds(
init_file.close()

metadata = gs.read_command("t.info", type=type_, input=sp.get_id())
metadata_file = open(metadata_file_name, "w")
metadata_file.write(metadata)
metadata_file.close()
Path(metadata_file_name).write_text(metadata)

read_file = open(read_file_name, "w")
if type_ == "strds":
Expand Down
Loading