Skip to content

Commit

Permalink
chore: remove os.path with pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelThamm committed Dec 18, 2024
1 parent 15b88ab commit f8a3d53
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/cosl/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@

import hashlib
import logging
import os
import re
from abc import ABC, abstractmethod
from pathlib import Path
Expand Down Expand Up @@ -264,8 +263,8 @@ def _from_file( # noqa: C901
# Generate group name prefix
# - name, from juju topology
# - suffix, from the relative path of the rule file;
rel_path = os.path.relpath(os.path.dirname(file_path), root_path)
rel_path = "" if rel_path == "." else rel_path.replace(os.path.sep, "_")
rel_path = file_path.parent.relative_to(root_path)
rel_path = "" if rel_path == Path(".") else rel_path.as_posix().replace("/", "_")
group_name_parts = [self.topology.identifier] if self.topology else []
group_name_parts.append(rel_path)
group_name_prefix = "_".join(filter(None, group_name_parts))
Expand Down

0 comments on commit f8a3d53

Please sign in to comment.