|
1 | 1 | --- |
2 | 2 | source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs |
| 3 | +assertion_line: 148 |
3 | 4 | --- |
4 | 5 | PTH100 [*] `os.path.abspath()` should be replaced by `Path.resolve()` |
5 | 6 | --> full_name.py:7:5 |
@@ -660,87 +661,6 @@ help: Replace with `Path.open()` |
660 | 661 | 50 | |
661 | 662 | 51 | # Cannot be upgraded `pathlib.Open` does not support fds |
662 | 663 |
|
663 | | -PTH123 [*] `open()` should be replaced by `Path.open()` |
664 | | - --> full_name.py:65:1 |
665 | | - | |
666 | | -63 | open(f()) |
667 | | -64 | |
668 | | -65 | open(b"foo") |
669 | | - | ^^^^ |
670 | | -66 | byte_str = b"bar" |
671 | | -67 | open(byte_str) |
672 | | - | |
673 | | -help: Replace with `Path.open()` |
674 | | -1 | import os |
675 | | -2 | import os.path |
676 | | -3 + import pathlib |
677 | | -4 | |
678 | | -5 | p = "/foo" |
679 | | -6 | q = "bar" |
680 | | --------------------------------------------------------------------------------- |
681 | | -63 | return 1 |
682 | | -64 | open(f()) |
683 | | -65 | |
684 | | - - open(b"foo") |
685 | | -66 + pathlib.Path(b"foo").open() |
686 | | -67 | byte_str = b"bar" |
687 | | -68 | open(byte_str) |
688 | | -69 | |
689 | | - |
690 | | -PTH123 [*] `open()` should be replaced by `Path.open()` |
691 | | - --> full_name.py:67:1 |
692 | | - | |
693 | | -65 | open(b"foo") |
694 | | -66 | byte_str = b"bar" |
695 | | -67 | open(byte_str) |
696 | | - | ^^^^ |
697 | | -68 | |
698 | | -69 | def bytes_str_func() -> bytes: |
699 | | - | |
700 | | -help: Replace with `Path.open()` |
701 | | -1 | import os |
702 | | -2 | import os.path |
703 | | -3 + import pathlib |
704 | | -4 | |
705 | | -5 | p = "/foo" |
706 | | -6 | q = "bar" |
707 | | --------------------------------------------------------------------------------- |
708 | | -65 | |
709 | | -66 | open(b"foo") |
710 | | -67 | byte_str = b"bar" |
711 | | - - open(byte_str) |
712 | | -68 + pathlib.Path(byte_str).open() |
713 | | -69 | |
714 | | -70 | def bytes_str_func() -> bytes: |
715 | | -71 | return b"foo" |
716 | | - |
717 | | -PTH123 [*] `open()` should be replaced by `Path.open()` |
718 | | - --> full_name.py:71:1 |
719 | | - | |
720 | | -69 | def bytes_str_func() -> bytes: |
721 | | -70 | return b"foo" |
722 | | -71 | open(bytes_str_func()) |
723 | | - | ^^^^ |
724 | | -72 | |
725 | | -73 | # https://github.com/astral-sh/ruff/issues/17693 |
726 | | - | |
727 | | -help: Replace with `Path.open()` |
728 | | -1 | import os |
729 | | -2 | import os.path |
730 | | -3 + import pathlib |
731 | | -4 | |
732 | | -5 | p = "/foo" |
733 | | -6 | q = "bar" |
734 | | --------------------------------------------------------------------------------- |
735 | | -69 | |
736 | | -70 | def bytes_str_func() -> bytes: |
737 | | -71 | return b"foo" |
738 | | - - open(bytes_str_func()) |
739 | | -72 + pathlib.Path(bytes_str_func()).open() |
740 | | -73 | |
741 | | -74 | # https://github.com/astral-sh/ruff/issues/17693 |
742 | | -75 | os.stat(1) |
743 | | - |
744 | 664 | PTH109 [*] `os.getcwd()` should be replaced by `Path.cwd()` |
745 | 665 | --> full_name.py:108:1 |
746 | 666 | | |
|
0 commit comments