Skip to content

Commit

Permalink
Delint.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjkw31 committed Aug 6, 2024
1 parent 2b7edf5 commit 1f3e0fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions softpack_core/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ def spec(self) -> Box:
return info

def metadata(self) -> Box:
"""Returns the metadata for an Environment.
Should contain keys:
- tags: list[string]
- hidden: boolean
- force_hidden: boolean
"""
meta = Box()
if Artifacts.meta_file in self.obj:
meta = Box.from_yaml(self.obj[Artifacts.meta_file].data)
Expand Down
11 changes: 10 additions & 1 deletion softpack_core/schemas/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,16 @@ def add_tag(

@classmethod
def read_metadata(cls, path: str, name: str) -> Box:
"""This method returns the metadata for an environment with the given
path and name.
"""
return artifacts.get(path, name).metadata()

@classmethod
def store_metadata(cls, environment_path: str, metadata: Box):
"""This method writes the given metadata to the repo for the environment
path given.
"""
tree_oid = artifacts.create_file(
environment_path,
artifacts.meta_file,
Expand All @@ -627,7 +633,10 @@ def store_metadata(cls, environment_path: str, metadata: Box):
artifacts.commit_and_push(tree_oid, "update metadata")

@classmethod
def set_hidden(cls, name: str, path: str, hidden: bool) -> HiddenResponse: # type: ignore
def set_hidden(
cls, name: str, path: str, hidden: bool
) -> HiddenResponse: # type: ignore
"""This method sets the hidden status for the given environment."""
environment_path = Path(path, name)
response: Optional[Error] = cls.check_env_exists(environment_path)
if response is not None:
Expand Down

0 comments on commit 1f3e0fd

Please sign in to comment.