Sam Jaffe пре 1 месец
родитељ
комит
06d3021450
3 измењених фајлова са 8 додато и 7 уклоњено
  1. 3 3
      src/cipy/__init__.py
  2. 1 1
      src/cipy/action.py
  3. 4 3
      src/cipy/common.py

+ 3 - 3
src/cipy/__init__.py

@@ -8,15 +8,15 @@ import typing
 
 import pydantic
 
-import cipy._logging
-
 from cipy.action import Call, Composite, NodeScript, Script
 from cipy.common import Context, Factory, Inputs, Outputs, Ref, Status
 from cipy.shell import Shell
 from cipy.workflow import Job, Matrix, MatrixParams, Workflow
 
+from ._logging import CIFormatter
+
 _handler = logging.StreamHandler()
-_handler.setFormatter(cipy._logging.CIFormatter("%(asctime)s [%(name)s] %(message)s"))
+_handler.setFormatter(CIFormatter("%(asctime)s [%(name)s] %(message)s"))
 
 logging.basicConfig(datefmt="%Y-%m-%dT%H:%M:%S.%fZ",
                     handlers=[ _handler ],

+ 1 - 1
src/cipy/action.py

@@ -107,7 +107,7 @@ class Script(Action):
     @final
     @cipy.runner.ipc
     def run(self, context: Context) -> Status:
-        self.logger.info(f"Running %s script:\n%s", self.shell, self.script)
+        self.logger.info("Running %s script:\n%s", self.shell, self.script)
         with tempfile.TemporaryFile(mode="w+", suffix=self.shell.extension()) as script:
             script.write(self.script)
             try:

+ 4 - 3
src/cipy/common.py

@@ -85,6 +85,7 @@ class Context(SimpleNamespace):
     """Wrapper class for the context of the CI runtime"""
 
     def __call__(self, arg: Value | None) -> Scalar | None:
+        """Accessor for context state with a dot-separated path"""
         if arg is None:
             return None
 
@@ -94,13 +95,13 @@ class Context(SimpleNamespace):
         if not isinstance(arg, Ref):
             return arg
 
-        """Accessor for context state with a dot-separated path"""
         if arg.path[0] == "env":
             assert len(arg.path) == 2
             return os.environ.get(arg.path[1])
 
-        attr = lambda o, a: o[a] if isinstance(o, dict) else getattr(o, a)
-        return reduce(attr, arg.path, self)  # type: ignore[return-value]
+        return reduce(  # type: ignore[return-value]
+            lambda o, a: o[a] if isinstance(o, dict) else getattr(o, a), arg.path, self
+        )
 
     @overload
     def fabricate(