[config_types.Path] Remove uses of Path.is_parent_of()

Removing these uses will help transition config_types.Path to
pathlib.Path.

Bug: 329113288
Change-Id: I4e5336a39acf06ae4ff598451412aeb2077abd0c
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/5467195
Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Yuanjun Huang <yuanjunh@google.com>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
diff --git a/README.recipes.md b/README.recipes.md
index 3d3c113..27abd5b 100644
--- a/README.recipes.md
+++ b/README.recipes.md
@@ -3071,7 +3071,7 @@
 Check whether child is contained within parent.
 
 *** note
-**DEPRECATED**: Just use `parent.is_parent_of(child)`.
+**DEPRECATED**: Just use `parent in child.parents`.
 ***
 
 &mdash; **def [isdir](/recipe_modules/path/api.py#932)(self, path):**
@@ -5740,7 +5740,7 @@
 [DEPS](/recipe_modules/path/examples/full.py#7): [json](#recipe_modules-json), [path](#recipe_modules-path), [platform](#recipe_modules-platform), [properties](#recipe_modules-properties), [step](#recipe_modules-step)
 
 
-&emsp; **@recipe_api.ignore_warnings('recipe_engine/CHECKOUT_DIR_DEPRECATED', 'recipe_engine/PATH_GETITEM_DEPRECATED')**<br>&mdash; **def [RunSteps](/recipe_modules/path/examples/full.py#18)(api):**
+&emsp; **@recipe_api.ignore_warnings('recipe_engine/CHECKOUT_DIR_DEPRECATED', 'recipe_engine/PATH_GETITEM_DEPRECATED', 'recipe_engine/PATH_IS_PARENT_OF_DEPRECATED')**<br>&mdash; **def [RunSteps](/recipe_modules/path/examples/full.py#18)(api):**
 ### *recipes* / [path:tests/cast\_to\_path](/recipe_modules/path/tests/cast_to_path.py)
 
 [DEPS](/recipe_modules/path/tests/cast_to_path.py#8): [path](#recipe_modules-path), [platform](#recipe_modules-platform)
diff --git a/recipe_modules/archive/api.py b/recipe_modules/archive/api.py
index 255bfd9..07aaeed 100644
--- a/recipe_modules/archive/api.py
+++ b/recipe_modules/archive/api.py
@@ -193,7 +193,7 @@
     Returns:
       `self` to allow chaining.
     """
-    assert self._root.is_parent_of(path), (
+    assert self._root in path.parents, (
       '%r is not a parent of %r' % (self._root, path))
     self._entries.append({
       'type': 'file',
@@ -210,7 +210,7 @@
     Returns:
       `self` to allow chaining.
     """
-    assert self._root.is_parent_of(path) or path == self._root, (
+    assert self._root in (path, *path.parents), (
       '%r is not a parent of %r' % (self._root, path))
     self._entries.append({
       'type': 'dir',
diff --git a/recipe_modules/cipd/api.py b/recipe_modules/cipd/api.py
index dc7a369..fd1972a 100644
--- a/recipe_modules/cipd/api.py
+++ b/recipe_modules/cipd/api.py
@@ -69,7 +69,7 @@
     the package root. Will raise ValueError if path is not inside the root."""
     if path == self.package_root:
       return '.'
-    if not self.package_root.is_parent_of(path):
+    if not self.package_root in path.parents:
       raise ValueError(
           'path %r is not the package root %r and not a child thereof' %
           (path, self.package_root))
diff --git a/recipe_modules/file/api.py b/recipe_modules/file/api.py
index b28fd1e..20003a4 100644
--- a/recipe_modules/file/api.py
+++ b/recipe_modules/file/api.py
@@ -49,7 +49,7 @@
           '%s is already linked to %s' %
           (linkname, self._reverse_map[linkname]))
 
-    assert self.root.is_parent_of(linkname), (
+    assert self.root in linkname.parents, (
         '%s is not within the root directory %s' % (linkname, self.root))
     self._link_map.setdefault(target, []).append(linkname)
     self._reverse_map[linkname] = target
diff --git a/recipe_modules/path/api.py b/recipe_modules/path/api.py
index a81a9c6..c58ca60 100644
--- a/recipe_modules/path/api.py
+++ b/recipe_modules/path/api.py
@@ -992,6 +992,6 @@
                    child: config_types.Path) -> bool:
     """Check whether child is contained within parent.
 
-    DEPRECATED: Just use `parent.is_parent_of(child)`.
+    DEPRECATED: Just use `parent in child.parents`.
     """
-    return parent.is_parent_of(child)
+    return parent in child.parents
diff --git a/recipe_modules/path/examples/full.py b/recipe_modules/path/examples/full.py
index 4c7c3dd..24aea89 100644
--- a/recipe_modules/path/examples/full.py
+++ b/recipe_modules/path/examples/full.py
@@ -16,7 +16,8 @@
 
 
 @recipe_api.ignore_warnings('recipe_engine/CHECKOUT_DIR_DEPRECATED',
-                            'recipe_engine/PATH_GETITEM_DEPRECATED')
+                            'recipe_engine/PATH_GETITEM_DEPRECATED',
+                            'recipe_engine/PATH_IS_PARENT_OF_DEPRECATED')
 def RunSteps(api):
   api.step('step1', ['/bin/echo', str(api.path.tmp_base_dir / 'foo')])