mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	lint fix: raise from None
Summary: New linter warning is complaining about `raise` inside `except`. Reviewed By: kjchalup Differential Revision: D37819264 fbshipit-source-id: 56ad5d0558ea39e1125f3c76b43b7376aea2bc7c
This commit is contained in:
		
							parent
							
								
									8ba9a694ee
								
							
						
					
					
						commit
						8e0c82b89a
					
				@ -276,7 +276,7 @@ def _read_binvox_header(f):  # pragma: no cover
 | 
			
		||||
    try:
 | 
			
		||||
        dims = [int(d) for d in dims[1:]]
 | 
			
		||||
    except ValueError:
 | 
			
		||||
        raise ValueError("Invalid header (line 2)")
 | 
			
		||||
        raise ValueError("Invalid header (line 2)") from None
 | 
			
		||||
    if len(dims) != 3 or dims[0] != dims[1] or dims[0] != dims[2]:
 | 
			
		||||
        raise ValueError("Invalid header (line 2)")
 | 
			
		||||
    size = dims[0]
 | 
			
		||||
@ -291,7 +291,7 @@ def _read_binvox_header(f):  # pragma: no cover
 | 
			
		||||
    try:
 | 
			
		||||
        translation = tuple(float(t) for t in translation[1:])
 | 
			
		||||
    except ValueError:
 | 
			
		||||
        raise ValueError("Invalid header (line 3)")
 | 
			
		||||
        raise ValueError("Invalid header (line 3)") from None
 | 
			
		||||
 | 
			
		||||
    # Fourth line of the header should be "scale [float]"
 | 
			
		||||
    line = f.readline().strip()
 | 
			
		||||
 | 
			
		||||
@ -107,7 +107,7 @@ class Autodecoder(Configurable, torch.nn.Module):
 | 
			
		||||
                    device=next(self.parameters()).device,
 | 
			
		||||
                )
 | 
			
		||||
            except StopIteration:
 | 
			
		||||
                raise ValueError("Not enough n_instances in the autodecoder")
 | 
			
		||||
                raise ValueError("Not enough n_instances in the autodecoder") from None
 | 
			
		||||
 | 
			
		||||
        # pyre-fixme[29]: `Union[torch.Tensor, torch.nn.Module]` is not a function.
 | 
			
		||||
        return self._autodecoder_codes(x)
 | 
			
		||||
 | 
			
		||||
@ -238,7 +238,7 @@ class Stats(object):
 | 
			
		||||
                            "could not extract prediction %s\
 | 
			
		||||
                                          from the prediction dictionary"
 | 
			
		||||
                            % stat
 | 
			
		||||
                        )
 | 
			
		||||
                        ) from None
 | 
			
		||||
                else:
 | 
			
		||||
                    val = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -85,7 +85,7 @@ def _read_faces_lump(
 | 
			
		||||
        if n_faces > 1 and "Wrong number of columns" in e.args[0]:
 | 
			
		||||
            file.seek(old_offset)
 | 
			
		||||
            return None
 | 
			
		||||
        raise ValueError("Not enough face data.")
 | 
			
		||||
        raise ValueError("Not enough face data.") from None
 | 
			
		||||
 | 
			
		||||
    if len(data) != n_faces:
 | 
			
		||||
        raise ValueError("Not enough face data.")
 | 
			
		||||
@ -247,11 +247,11 @@ def _load_off_stream(file) -> dict:
 | 
			
		||||
    try:
 | 
			
		||||
        n_verts = int(items[0])
 | 
			
		||||
    except ValueError:
 | 
			
		||||
        raise ValueError("Invalid counts line: %s" % header)
 | 
			
		||||
        raise ValueError("Invalid counts line: %s" % header) from None
 | 
			
		||||
    try:
 | 
			
		||||
        n_faces = int(items[1])
 | 
			
		||||
    except ValueError:
 | 
			
		||||
        raise ValueError("Invalid counts line: %s" % header)
 | 
			
		||||
        raise ValueError("Invalid counts line: %s" % header) from None
 | 
			
		||||
 | 
			
		||||
    if (len(items) > 3 and not items[3].startswith(b"#")) or n_verts < 0 or n_faces < 0:
 | 
			
		||||
        raise ValueError("Invalid counts line: %s" % header)
 | 
			
		||||
 | 
			
		||||
@ -236,7 +236,7 @@ class _PlyHeader:
 | 
			
		||||
            count = int(items[2])
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            msg = "Number of items for %s was not a number."
 | 
			
		||||
            raise ValueError(msg % items[1])
 | 
			
		||||
            raise ValueError(msg % items[1]) from None
 | 
			
		||||
        self.elements.append(_PlyElementType(items[1], count))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -409,12 +409,12 @@ def _parse_heterogeneous_property_ascii(datum, line_iter, property: _Property):
 | 
			
		||||
            else:
 | 
			
		||||
                datum.append(int(value))
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            raise ValueError("Bad numerical data.")
 | 
			
		||||
            raise ValueError("Bad numerical data.") from None
 | 
			
		||||
    else:
 | 
			
		||||
        try:
 | 
			
		||||
            length = int(value)
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            raise ValueError("A list length was not a number.")
 | 
			
		||||
            raise ValueError("A list length was not a number.") from None
 | 
			
		||||
        list_value = np.zeros(length, dtype=_PLY_TYPES[property.data_type].np_type)
 | 
			
		||||
        for i in range(length):
 | 
			
		||||
            inner_value = next(line_iter, None)
 | 
			
		||||
@ -423,7 +423,7 @@ def _parse_heterogeneous_property_ascii(datum, line_iter, property: _Property):
 | 
			
		||||
            try:
 | 
			
		||||
                list_value[i] = float(inner_value)
 | 
			
		||||
            except ValueError:
 | 
			
		||||
                raise ValueError("Bad numerical data.")
 | 
			
		||||
                raise ValueError("Bad numerical data.") from None
 | 
			
		||||
        datum.append(list_value)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -141,7 +141,7 @@ def iterative_closest_point(
 | 
			
		||||
                "(minibatch, dim, dim), T is a batch of dim-dimensional "
 | 
			
		||||
                "translations of shape (minibatch, dim) and s is a batch "
 | 
			
		||||
                "of scalars of shape (minibatch,)."
 | 
			
		||||
            )
 | 
			
		||||
            ) from None
 | 
			
		||||
        # apply the init transform to the input point cloud
 | 
			
		||||
        Xt = _apply_similarity_transform(Xt, R, T, s)
 | 
			
		||||
    else:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user