Skip to content

Commit 32068d8

Browse files
committed
clean up
1 parent 3ae5a32 commit 32068d8

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

deep_code/utils/dataset_stac_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,13 @@ def build_dataset_stac_collection(self) -> Collection:
519519
collection.extra_fields["themes"] = [theme_obj]
520520

521521
for theme in self.osc_themes:
522-
formated_theme = self.format_string(theme)
522+
formatted_theme = self.format_string(theme)
523523
collection.add_link(
524524
Link(
525525
rel="related",
526526
target=f"../../themes/{theme}/catalog.json",
527527
media_type="application/json",
528-
title=f"Theme: {formated_theme}",
528+
title=f"Theme: {formatted_theme}",
529529
)
530530
)
531531

deep_code/utils/github_automation.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def clone_sync_repository(self):
4949
"""Clone the forked repository locally if it doesn't exist, or pull updates if it does."""
5050
logging.info("Checking local repository...")
5151
if not os.path.exists(self.local_clone_dir):
52-
# Directory doesn't exist, clone the repository
5352
logging.info("Cloning forked repository...")
5453
try:
5554
subprocess.run(
@@ -60,7 +59,6 @@ def clone_sync_repository(self):
6059
except subprocess.CalledProcessError as e:
6160
raise RuntimeError(f"Failed to clone repository: {e}")
6261
else:
63-
# Directory exists, pull the latest changes
6462
logging.info("Local repository already exists. Pulling latest changes...")
6563
try:
6664
os.chdir(self.local_clone_dir)
@@ -81,26 +79,20 @@ def create_branch(self, branch_name: str):
8179
def add_file(self, file_path: str, content):
8280
"""Add a new file to the local repository."""
8381
logging.info(f"Adding new file: {file_path}...")
84-
os.chdir(self.local_clone_dir) # Ensure we are in the Git repository
82+
os.chdir(self.local_clone_dir)
8583
full_path = Path(self.local_clone_dir) / file_path
8684
full_path.parent.mkdir(parents=True, exist_ok=True)
87-
8885
# Ensure content is serializable
8986
if hasattr(content, "to_dict"):
9087
content = content.to_dict()
9188
if not isinstance(content, (dict, list, str, int, float, bool, type(None))):
9289
raise TypeError(f"Cannot serialize content of type {type(content)}")
93-
94-
# Serialize to JSON
9590
try:
9691
json_content = json.dumps(content, indent=2, default=serialize)
9792
except TypeError as e:
9893
raise RuntimeError(f"JSON serialization failed: {e}")
99-
10094
with open(full_path, "w") as f:
10195
f.write(json_content)
102-
103-
# Git add the file
10496
try:
10597
subprocess.run(["git", "add", str(full_path)], check=True)
10698
except subprocess.CalledProcessError as e:

deep_code/utils/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def serialize(obj):
88
TypeError: If the object cannot be serialized.
99
"""
1010
if isinstance(obj, set):
11-
return list(obj) # Convert sets to lists
11+
return list(obj)
1212
if hasattr(obj, "__dict__"):
13-
return obj.__dict__ # Convert objects with attributes to dicts
13+
return obj.__dict__
1414
raise TypeError(f"Object of type {type(obj).__name__} is not JSON serializable")

deep_code/utils/ogc_record_generator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ def build_record_properties(
6161

6262
if themes_list:
6363
theme_obj = self.build_theme(themes_list)
64-
properties.update(
65-
{"themes": [theme_obj]}
66-
)
64+
properties.update({"themes": [theme_obj]})
6765

6866
properties.setdefault("type", "workflow")
6967
properties.setdefault("osc_project", "deep-earth-system-data-lab")

0 commit comments

Comments
 (0)