Unverified Commit 922db308 authored by Aditya Oke's avatar Aditya Oke Committed by GitHub
Browse files

Update code to Python 3.7 compliance (#5125)

* Upgrade to py37

* Update
parent 5335006b
...@@ -338,10 +338,10 @@ class FlyingThings3D(FlowDataset): ...@@ -338,10 +338,10 @@ class FlyingThings3D(FlowDataset):
directions = ("into_future", "into_past") directions = ("into_future", "into_past")
for pass_name, camera, direction in itertools.product(passes, cameras, directions): for pass_name, camera, direction in itertools.product(passes, cameras, directions):
image_dirs = sorted(glob(str(root / pass_name / split / "*/*"))) image_dirs = sorted(glob(str(root / pass_name / split / "*/*")))
image_dirs = sorted([Path(image_dir) / camera for image_dir in image_dirs]) image_dirs = sorted(Path(image_dir) / camera for image_dir in image_dirs)
flow_dirs = sorted(glob(str(root / "optical_flow" / split / "*/*"))) flow_dirs = sorted(glob(str(root / "optical_flow" / split / "*/*")))
flow_dirs = sorted([Path(flow_dir) / direction / camera for flow_dir in flow_dirs]) flow_dirs = sorted(Path(flow_dir) / direction / camera for flow_dir in flow_dirs)
if not image_dirs or not flow_dirs: if not image_dirs or not flow_dirs:
raise FileNotFoundError( raise FileNotFoundError(
......
...@@ -51,7 +51,7 @@ class Food101(VisionDataset): ...@@ -51,7 +51,7 @@ class Food101(VisionDataset):
self._labels = [] self._labels = []
self._image_files = [] self._image_files = []
with open(self._meta_folder / f"{split}.json", "r") as f: with open(self._meta_folder / f"{split}.json") as f:
metadata = json.loads(f.read()) metadata = json.loads(f.read())
self.classes = sorted(metadata.keys()) self.classes = sorted(metadata.keys())
......
...@@ -71,7 +71,7 @@ def _validate_pts(pts_range: Tuple[int, int]) -> None: ...@@ -71,7 +71,7 @@ def _validate_pts(pts_range: Tuple[int, int]) -> None:
assert ( assert (
pts_range[0] <= pts_range[1] pts_range[0] <= pts_range[1]
), """Start pts should not be smaller than end pts, got ), """Start pts should not be smaller than end pts, got
start pts: {0:d} and end pts: {1:d}""".format( start pts: {:d} and end pts: {:d}""".format(
pts_range[0], pts_range[0],
pts_range[1], pts_range[1],
) )
......
...@@ -74,7 +74,7 @@ class BottleneckBlock(nn.Module): ...@@ -74,7 +74,7 @@ class BottleneckBlock(nn.Module):
"""Slightly modified BottleNeck block (extra relu and biases)""" """Slightly modified BottleNeck block (extra relu and biases)"""
def __init__(self, in_channels, out_channels, *, norm_layer, stride=1): def __init__(self, in_channels, out_channels, *, norm_layer, stride=1):
super(BottleneckBlock, self).__init__() super().__init__()
# See note in ResidualBlock for the reason behind bias=True # See note in ResidualBlock for the reason behind bias=True
self.convnormrelu1 = ConvNormActivation( self.convnormrelu1 = ConvNormActivation(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment