Skip to content

Commit

Permalink
Remove Python 2 compatibility with __div__ and __rdiv__.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 10, 2024
1 parent d5d4775 commit f84e1ee
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions path/__init__.py
Expand Up @@ -207,8 +207,8 @@ def __radd__(self, other):
return self._next_class(other.__add__(self))

# The / operator joins Paths.
def __div__(self, rel):
"""fp.__div__(rel) == fp / rel == fp.joinpath(rel)
def __truediv__(self, rel):
"""fp.__truediv__(rel) == fp / rel == fp.joinpath(rel)
Join two path components, adding a separator character if
needed.
Expand All @@ -217,12 +217,9 @@ def __div__(self, rel):
"""
return self._next_class(self.module.join(self, rel))

# Make the / operator work even when true division is enabled.
__truediv__ = __div__

# The / operator joins Paths the other way around
def __rdiv__(self, rel):
"""fp.__rdiv__(rel) == rel / fp
def __rtruediv__(self, rel):
"""fp.__rtruediv__(rel) == rel / fp
Join two path components, adding a separator character if
needed.
Expand All @@ -231,9 +228,6 @@ def __rdiv__(self, rel):
"""
return self._next_class(self.module.join(rel, self))

# Make the / operator work even when true division is enabled.
__rtruediv__ = __rdiv__

def __enter__(self):
self._old_dir = self.cwd()
os.chdir(self)
Expand Down

0 comments on commit f84e1ee

Please sign in to comment.