mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	typing.NamedTuple.field_types removed in favor of __annotations__
Summary: typing.NamedTuple was simplified in 3.10 These two fields were the same in 3.8, so this should be a no-op #buildmore Reviewed By: bottler Differential Revision: D45373526 fbshipit-source-id: 2b26156f5f65b7be335133e9e705730f7254260d
This commit is contained in:
		
							parent
							
								
									092400f1e7
								
							
						
					
					
						commit
						23cd19fbc7
					
				@ -204,7 +204,7 @@ def _dataclass_list_from_dict_list(dlist, typeannot):
 | 
			
		||||
    # otherwise, we dispatch by the type of the provided annotation to convert to
 | 
			
		||||
    if issubclass(cls, tuple) and hasattr(cls, "_fields"):  # namedtuple
 | 
			
		||||
        # For namedtuple, call the function recursively on the lists of corresponding keys
 | 
			
		||||
        types = cls._field_types.values()
 | 
			
		||||
        types = cls.__annotations__.values()
 | 
			
		||||
        dlist_T = zip(*dlist)
 | 
			
		||||
        res_T = [
 | 
			
		||||
            _dataclass_list_from_dict_list(key_list, tp)
 | 
			
		||||
@ -270,7 +270,7 @@ def _dataclass_from_dict(d, typeannot):
 | 
			
		||||
 | 
			
		||||
    cls = get_origin(typeannot) or typeannot
 | 
			
		||||
    if issubclass(cls, tuple) and hasattr(cls, "_fields"):  # namedtuple
 | 
			
		||||
        types = cls._field_types.values()
 | 
			
		||||
        types = cls.__annotations__.values()
 | 
			
		||||
        return cls(*[_dataclass_from_dict(v, tp) for v, tp in zip(d, types)])
 | 
			
		||||
    elif issubclass(cls, (list, tuple)):
 | 
			
		||||
        types = get_args(typeannot)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user