diff options
| author | 2022-11-28 09:13:43 +0800 | |
|---|---|---|
| committer | 2022-11-28 09:13:43 +0800 | |
| commit | d67b70bdbb3277babd130dd4914f16de8ba8a9b5 (patch) | |
| tree | c1af2fdd12454f97344343276bcdec270d53703c | |
| parent | Docstring update (diff) | |
Docstring phrasing update
Co-authored-by: Mark <[email protected]>
| -rw-r--r-- | snekbox/nsjail.py | 4 | ||||
| -rw-r--r-- | snekbox/snekio.py | 4 | ||||
| -rw-r--r-- | tests/api/test_eval.py | 6 | ||||
| -rw-r--r-- | tests/test_libmount.py | 2 | 
4 files changed, 8 insertions, 8 deletions
| diff --git a/snekbox/nsjail.py b/snekbox/nsjail.py index 4a0f45c..fcdd259 100644 --- a/snekbox/nsjail.py +++ b/snekbox/nsjail.py @@ -28,7 +28,7 @@ LOG_PATTERN = re.compile(  def iter_lstrip(iterable: Iterable[_T]) -> Generator[_T, None, None]: -    """Removes leading falsy objects from an iterable.""" +    """Remove leading falsy objects from an iterable."""      it = iter(iterable)      for item in it:          if item: @@ -64,7 +64,7 @@ class NsJail:              max_output_size: Maximum size of the output in bytes.              read_chunk_size: Size of the read buffer in bytes.              memfs_instance_size: Size of the tmpfs instance in bytes. -            files_limit: Maximum number of files to parse for attach. +            files_limit: Maximum number of files to parse for attachments.              files_timeout: Maximum time in seconds to wait for files to be written / read.              files_pattern: Pattern to match files to attach.          """ diff --git a/snekbox/snekio.py b/snekbox/snekio.py index fd48585..5023a69 100644 --- a/snekbox/snekio.py +++ b/snekbox/snekio.py @@ -12,7 +12,7 @@ T = TypeVar("T", str, bytes)  def safe_path(path: str) -> str:      """ -    Returns the `path` str if there are no security issues. +    Return `path` if there are no security issues.      Raises:          IllegalPathError: Raised on any path rule violation. @@ -81,7 +81,7 @@ class FileAttachment(Generic[T]):          return self.content.encode("utf-8")      def save_to(self, directory: Path | str) -> None: -        """Save the attachment to a path directory.""" +        """Write the attachment to a file in `directory`."""          file = Path(directory, self.path)          # Create directories if they don't exist          file.parent.mkdir(parents=True, exist_ok=True) diff --git a/tests/api/test_eval.py b/tests/api/test_eval.py index 65cd9a4..c103880 100644 --- a/tests/api/test_eval.py +++ b/tests/api/test_eval.py @@ -41,7 +41,7 @@ class TestEvalResource(SnekAPITestCase):                  self.assertEqual(expected_json, result.json)      def test_files_path(self): -        """Normal paths, should work with 200.""" +        """Normal paths should work with 200."""          test_paths = [              "file.txt",              "./file.jpg", @@ -59,7 +59,7 @@ class TestEvalResource(SnekAPITestCase):                  self.assertEqual(0, result.json["returncode"])      def test_files_illegal_path_traversal(self): -        """Traversal beyond root, should be denied with 400 error.""" +        """Traversal beyond root should be denied with 400 error."""          test_paths = [              "../secrets",              "../../dir", @@ -78,7 +78,7 @@ class TestEvalResource(SnekAPITestCase):                  self.assertEqual(expected, result.json)      def test_files_illegal_path_absolute(self): -        """Absolute file paths, should be denied with 400 error.""" +        """Absolute file paths should be denied with 400 error."""          test_paths = [              "/etc/vars/secrets",              "/absolute", diff --git a/tests/test_libmount.py b/tests/test_libmount.py index 8e56970..a9a5e5b 100644 --- a/tests/test_libmount.py +++ b/tests/test_libmount.py @@ -15,7 +15,7 @@ class LibMountTests(TestCase):      @contextmanager      def get_mount(self): -        """Yields a valid mount point, unmounts after context.""" +        """Yield a valid mount point and unmount after context."""          path = self.temp_dir / str(uuid4())          path.mkdir()          try: | 
