Jelajahi Sumber

fix: pylint errors

Sam Jaffe 1 bulan lalu
induk
melakukan
06d3021450
3 mengubah file dengan 8 tambahan dan 7 penghapusan
  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 pydantic
 
 
-import cipy._logging
-
 from cipy.action import Call, Composite, NodeScript, Script
 from cipy.action import Call, Composite, NodeScript, Script
 from cipy.common import Context, Factory, Inputs, Outputs, Ref, Status
 from cipy.common import Context, Factory, Inputs, Outputs, Ref, Status
 from cipy.shell import Shell
 from cipy.shell import Shell
 from cipy.workflow import Job, Matrix, MatrixParams, Workflow
 from cipy.workflow import Job, Matrix, MatrixParams, Workflow
 
 
+from ._logging import CIFormatter
+
 _handler = logging.StreamHandler()
 _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",
 logging.basicConfig(datefmt="%Y-%m-%dT%H:%M:%S.%fZ",
                     handlers=[ _handler ],
                     handlers=[ _handler ],

+ 1 - 1
src/cipy/action.py

@@ -107,7 +107,7 @@ class Script(Action):
     @final
     @final
     @cipy.runner.ipc
     @cipy.runner.ipc
     def run(self, context: Context) -> Status:
     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:
         with tempfile.TemporaryFile(mode="w+", suffix=self.shell.extension()) as script:
             script.write(self.script)
             script.write(self.script)
             try:
             try:

+ 4 - 3
src/cipy/common.py

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