Replace Path.join() calls

Replace Path.join() calls, mostly in comments or docstrings,  with the
slash operator or Path.joinpath().

Bug: 329113288
Change-Id: I14e5ef696691da423700400fa93e35174197df09
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/5466720
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 fcf7035..3d3c113 100644
--- a/README.recipes.md
+++ b/README.recipes.md
@@ -285,14 +285,14 @@
 
     # Archive root/file and root/directory/**
     (api.archive.package(root).
-        with_file(root.join('file')).
-        with_dir(root.join('directory')).
+        with_file(root / 'file').
+        with_dir(root / 'directory').
         archive('archive step', output, 'tbz'))
 
     # Archive root/**
     zip_path = (
       api.archive.package(root).
-      archive('archive step', api.path.start_dir.join('output.zip'))
+      archive('archive step', api.path.start_dir / 'output.zip')
     )
 
 Args:
@@ -1397,7 +1397,7 @@
 
 Example:
 ```python
-with api.context(cwd=api.path.start_dir.join('subdir')):
+with api.context(cwd=api.path.start_dir / 'subdir'):
   # this step is run inside of the subdir directory.
   api.step("cat subdir/foo", ['cat', './foo'])
 ```
@@ -4339,17 +4339,17 @@
 # output path, cwd and cache directory.
 with api.context(
     # Change the cwd of the launched LUCI executable
-    cwd=api.path.start_dir.join('subdir'),
+    cwd=api.path.start_dir / 'subdir',
     # Change the cache_dir of the launched LUCI executable. Defaults to
     # api.path.cache_dir if unchanged.
-    luciexe=sections_pb2.LUCIExe(cache_dir=api.path.cache_dir.join('sub')),
+    luciexe=sections_pb2.LUCIExe(cache_dir=api.path.cache_dir / 'sub'),
   ):
   # Command executed:
   #   `/path/to/run_exe --output [CLEANUP]/build.json --foo bar baz`
   ret = api.sub_build("launch sub build",
                       [run_exe, '--foo', 'bar', 'baz'],
                       api.buildbucket.build,
-                      output_path=api.path.cleanup_dir.join('build.json'))
+                      output_path=api.path.cleanup_dir / 'build.json')
 sub_build = ret.step.sub_build  # access final build proto result
 ```
 
diff --git a/doc/walkthrough.md b/doc/walkthrough.md
index 1ebbacd..f76a0f8 100644
--- a/doc/walkthrough.md
+++ b/doc/walkthrough.md
@@ -692,7 +692,7 @@
 
   def greet(self, default_verb=None):
     self.m.step('Greet Admired Individual', [
-        self.m.path.start_dir.join(self.c.tool),
+        self.m.path.start_dir / self.c.tool,
         self.c.verb % self.c.TARGET])
 ```
 
@@ -836,15 +836,15 @@
 def RunSteps(api):
   step_result = api.step(
       'Determine blue moon',
-      [api.path.start_dir.join('is_blue_moon.sh')],
+      [api.path.start_dir / 'is_blue_moon.sh'],
       ok_ret='any')
 
   if step_result.retcode == 0:
     api.step('HARLEM SHAKE!',
-             [api.path.start_dir.join('do_the_harlem_shake.sh')])
+             [api.path.start_dir / 'do_the_harlem_shake.sh'])
   else:
     api.step('Boring',
-             [api.path.start_dir.join('its_a_small_world.sh')])
+             [api.path.start_dir / 'its_a_small_world.sh'])
 
 def GenTests(api):
   yield api.test(
@@ -897,14 +897,14 @@
 def RunSteps(api):
   step_result = api.step(
       'run tests',
-      [api.path.start_dir.join('do_test_things.sh'), api.json.output()])
+      [api.path.start_dir / 'do_test_things.sh', api.json.output()])
   num_passed = step_result.json.output['num_passed']
   if num_passed > 500:
-    api.step('victory', [api.path.start_dir.join('do_a_dance.sh')])
+    api.step('victory', [api.path.start_dir / 'do_a_dance.sh'])
   elif num_passed > 200:
-    api.step('not defeated', [api.path.start_dir.join('woohoo.sh')])
+    api.step('not defeated', [api.path.start_dir / 'woohoo.sh'])
   else:
-    api.step('deads!', [api.path.start_dir.join('you_r_deads.sh')])
+    api.step('deads!', [api.path.start_dir / 'you_r_deads.sh'])
 
 def GenTests(api):
   yield api.test(
diff --git a/recipe_engine/recipe_api.py b/recipe_engine/recipe_api.py
index f6214da..4f93758 100644
--- a/recipe_engine/recipe_api.py
+++ b/recipe_engine/recipe_api.py
@@ -602,7 +602,7 @@
       path: path relative to module's resources/ directory.
     """
     # TODO(vadimsh): Verify that file exists. Including a case like:
-    #  module.resource('dir').join('subdir', 'file.py')
+    #  module.resource('dir') / 'subdir' / 'file.py'
     return self._resource_directory.joinpath(*path)
 
   def repo_resource(self, *path):
@@ -649,7 +649,7 @@
       path: path relative to module's resources/ directory.
     """
     # TODO(vadimsh): Verify that file exists. Including a case like:
-    #  module.resource('dir').join('subdir', 'file.py')
+    #  module.resource('dir') / 'subdir' / 'file.py'
     return self._resource_path.joinpath(*path)
 
   def repo_resource(self, *path):
diff --git a/recipe_modules/archive/api.py b/recipe_modules/archive/api.py
index 0a801d6..255bfd9 100644
--- a/recipe_modules/archive/api.py
+++ b/recipe_modules/archive/api.py
@@ -20,14 +20,14 @@
 
         # Archive root/file and root/directory/**
         (api.archive.package(root).
-            with_file(root.join('file')).
-            with_dir(root.join('directory')).
+            with_file(root / 'file').
+            with_dir(root / 'directory').
             archive('archive step', output, 'tbz'))
 
         # Archive root/**
         zip_path = (
           api.archive.package(root).
-          archive('archive step', api.path.start_dir.join('output.zip'))
+          archive('archive step', api.path.start_dir / 'output.zip')
         )
 
     Args:
diff --git a/recipe_modules/context/api.py b/recipe_modules/context/api.py
index d0a1007..1ffbce0 100644
--- a/recipe_modules/context/api.py
+++ b/recipe_modules/context/api.py
@@ -20,7 +20,7 @@
 
 Example:
 ```python
-with api.context(cwd=api.path.start_dir.join('subdir')):
+with api.context(cwd=api.path.start_dir / 'subdir'):
   # this step is run inside of the subdir directory.
   api.step("cat subdir/foo", ['cat', './foo'])
 ```
diff --git a/recipe_modules/step/api.py b/recipe_modules/step/api.py
index ee8119a..21246e9 100644
--- a/recipe_modules/step/api.py
+++ b/recipe_modules/step/api.py
@@ -523,17 +523,17 @@
     # output path, cwd and cache directory.
     with api.context(
         # Change the cwd of the launched LUCI executable
-        cwd=api.path.start_dir.join('subdir'),
+        cwd=api.path.start_dir / 'subdir',
         # Change the cache_dir of the launched LUCI executable. Defaults to
         # api.path.cache_dir if unchanged.
-        luciexe=sections_pb2.LUCIExe(cache_dir=api.path.cache_dir.join('sub')),
+        luciexe=sections_pb2.LUCIExe(cache_dir=api.path.cache_dir / 'sub'),
       ):
       # Command executed:
       #   `/path/to/run_exe --output [CLEANUP]/build.json --foo bar baz`
       ret = api.sub_build("launch sub build",
                           [run_exe, '--foo', 'bar', 'baz'],
                           api.buildbucket.build,
-                          output_path=api.path.cleanup_dir.join('build.json'))
+                          output_path=api.path.cleanup_dir / 'build.json')
     sub_build = ret.step.sub_build  # access final build proto result
     ```
 
diff --git a/unittests/config_types_test.py b/unittests/config_types_test.py
index e24e07f..42f86e1 100755
--- a/unittests/config_types_test.py
+++ b/unittests/config_types_test.py
@@ -114,10 +114,10 @@
     with self.assertRaisesRegex(ValueError, 'going above the base'):
       print(repr(p / 'something' / '..///./..'))
 
-  def test_path_join(self):
-    """Tests for Path.join()."""
+  def test_path_joinpath(self):
+    """Tests for Path.joinpath()."""
     base_path = Path(ResolvedBasePath('[START_DIR]'))
-    reference_path = base_path.join('foo').join('bar')
+    reference_path = base_path.joinpath('foo').joinpath('bar')
     self.assertEqual(base_path / 'foo' / 'bar', reference_path)
 
   def test_is_parent_of(self):