> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove-Redundant-Path-Exists

#### Sourcery rule id: `remove-redundant-path-exists`

#### Description

Remove unnecessary `path.exists()` check.


#### Before

```python
from pathlib import Path

p = Path("/home/user/mydir")
if p.exists() and p.is_dir():
  do_sth()
```

#### After

```python
from pathlib import Path

p = Path("/home/user/mydir")
if p.is_dir():
  do_sth()
```



#### Explanation

The following functions already contain a check whether a path exists:
* `pathlib.Path.is_dir()`
* `pathlib.Path.is_file()`
* `pathlib.Path.is_symlink()`
There's no need to explicitly call `pathlib.Path.exists()` before.
