mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
Linter, deprecated type()
Summary: Run linter after recent changes. Fix long comment in knn.h which clang-format has reflowed badly. Add crude test that code doesn't call deprecated `.type()` or `.data()`. Reviewed By: nikhilaravi Differential Revision: D20692935 fbshipit-source-id: 28ce0308adae79a870cb41a810b7cf8744f41ab8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3061c5b663
commit
37c5c8e0b6
@@ -22,6 +22,27 @@ class TestBuild(unittest.TestCase):
|
||||
for k, v in counter.items():
|
||||
self.assertEqual(v, 1, f"Too many files with stem {k}.")
|
||||
|
||||
def test_deprecated_usage(self):
|
||||
# Check certain expressions do not occur in the csrc code
|
||||
test_dir = Path(__file__).resolve().parent
|
||||
source_dir = test_dir.parent / "pytorch3d" / "csrc"
|
||||
|
||||
files = sorted(source_dir.glob("**/*.*"))
|
||||
self.assertGreater(len(files), 4)
|
||||
|
||||
patterns = [".type()", ".data()"]
|
||||
|
||||
for file in files:
|
||||
with open(file) as f:
|
||||
text = f.read()
|
||||
for pattern in patterns:
|
||||
found = pattern in text
|
||||
msg = (
|
||||
f"{pattern} found in {file.name}"
|
||||
+ ", this has been deprecated."
|
||||
)
|
||||
self.assertFalse(found, msg)
|
||||
|
||||
def test_copyright(self):
|
||||
test_dir = Path(__file__).resolve().parent
|
||||
root_dir = test_dir.parent
|
||||
|
||||
Reference in New Issue
Block a user