From 9df8b0781eec971dcdeaaf983cb3c876b61d3c47 Mon Sep 17 00:00:00 2001 From: Sridhar Ramesh Date: Mon, 29 Jan 2018 13:44:16 -0800 Subject: [PATCH] Some convenient utility functions added to helpers.py, which I had reason to make use of previously --- camera/camera.py | 5 ----- helpers.py | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/camera/camera.py b/camera/camera.py index f5a6f09a..15ff6400 100644 --- a/camera/camera.py +++ b/camera/camera.py @@ -438,11 +438,6 @@ class MappingCamera(Camera): excluded_mobjects = None, ) -# TODO: Put this in different utility/helpers file? Convenient for me (Sridhar); I like it. -class DictAsObject(object): - def __init__(self, dict): - self.__dict__ = dict - # Note: This allows layering of multiple cameras onto the same portion of the pixel array, # the later cameras overwriting the former # diff --git a/helpers.py b/helpers.py index 85ad584e..58cfc7c8 100644 --- a/helpers.py +++ b/helpers.py @@ -629,6 +629,12 @@ def angle_of_vector(vector): return 0 return np.angle(complex(*vector[:2])) +def concatenate_lists(*list_of_lists): + return [item for l in list_of_lists for item in l] - +# Occasionally convenient in order to write dict.x instead of more laborious +# (and less in keeping with all other attr accesses) dict["x"] +class DictAsObject(object): + def __init__(self, dict): + self.__dict__ = dict