Skip to content

Commit

Permalink
Deprecate content method
Browse files Browse the repository at this point in the history
  • Loading branch information
p1c2u committed Oct 13, 2023
1 parent 4ad93d1 commit e7e0dd5
Show file tree
Hide file tree
Showing 2 changed files with 441 additions and 308 deletions.
12 changes: 10 additions & 2 deletions pathable/paths.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pathable paths module"""
import warnings
from contextlib import contextmanager
from typing import Any
from typing import Hashable
Expand Down Expand Up @@ -208,11 +209,18 @@ def items(self: TAccessorPath) -> Iterator[Tuple[Any, TAccessorPath]]:
for key in self.accessor.keys(self.parts):
yield key, self._make_child_relpath(key)

def content(self) -> Any:
"""Return content of the path."""
def contents(self) -> Any:
"""Return contents of the path."""
with self.open() as d:
return d

def content(self) -> Any:
warnings.warn(
"content parameter is deprecated. Use contents instead.",
DeprecationWarning,
)
return self.contents()

def get(self, key: Hashable, default: Any = None) -> Any:
"""Return the child path for key if key is in the path, else default."""
if key in self:
Expand Down
Loading

0 comments on commit e7e0dd5

Please sign in to comment.