splitlog 4.1.1__tar.gz → 4.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splitlog
3
- Version: 4.1.1
3
+ Version: 4.1.3
4
4
  Summary: Utility to split aggregated logs from Apache Hadoop Yarn applications into a folder hierarchy
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -26,7 +26,7 @@ dependencies = [
26
26
  "python-dateutil (>=2.9.0,<3.0.0)",
27
27
  "pytz (>=2025.2)",
28
28
  ]
29
- version = "4.1.1"
29
+ version = "4.1.3"
30
30
 
31
31
 
32
32
  [project.urls]
@@ -77,7 +77,7 @@ def _is_relative_to(path: Path, parent: Path) -> bool:
77
77
  return True
78
78
 
79
79
 
80
- class DefaultLocalFilesystemOutputFolder(OutputFolder, metaclass=abc.ABCMeta):
80
+ class DefaultLocalFilesystemOutputFolder(OutputFolder):
81
81
  """Encapsulates filesystem IO on output folders.
82
82
 
83
83
  This implementation is portable but unsafe to use when invoking splitlog with privileges.
@@ -114,11 +114,11 @@ class DefaultLocalFilesystemOutputFolder(OutputFolder, metaclass=abc.ABCMeta):
114
114
  os.mkdir(real_path, mode=self.DIR_MODE)
115
115
 
116
116
  def _check_paths(self, path: Path) -> Path:
117
- assert not path.is_absolute(), f"Path {path} must be relative"
117
+ if path.is_absolute():
118
+ raise ValueError(f"Path {path} must be relative")
118
119
  real_path = Path(os.path.normpath(self._path / path))
119
- assert _is_relative_to(
120
- real_path, self._path
121
- ), f"Path {path} outside {self._path}"
120
+ if not _is_relative_to(real_path, self._path):
121
+ raise ValueError(f"Path {path} outside {self._path}")
122
122
  return real_path
123
123
 
124
124
  def create(self, path: Path) -> BinWriter:
@@ -214,18 +214,18 @@ class LinuxLocalFilesystemOutputFolder(OutputFolder):
214
214
 
215
215
  def create(self, path: Path) -> BinWriter:
216
216
  real_path = self._ensure_path_under_root(path)
217
- return FileWrapper(open(path, "xb", opener=self._opener))
217
+ return FileWrapper(open(real_path, "xb", opener=self._opener))
218
218
 
219
219
  def _ensure_path_under_root(self, path: Path) -> Path:
220
- assert not path.is_absolute(), f"Path {path} must be relative"
220
+ if path.is_absolute():
221
+ raise ValueError(f"Path {path} must be relative")
221
222
 
222
223
  # remove all ".." and "." components
223
224
  real_path = Path(os.path.normpath(self._path / path))
224
225
 
225
- # assert resulting absolute path is still inside self._path
226
- assert _is_relative_to(
227
- real_path, self._path
228
- ), f"Path {path} outside {self._path}"
226
+ # ensure resulting absolute path is still inside self._path
227
+ if not _is_relative_to(real_path, self._path):
228
+ raise ValueError(f"Path {path} outside {self._path}")
229
229
  return real_path.relative_to(self._path)
230
230
 
231
231
  @staticmethod
File without changes
File without changes
File without changes
File without changes