Skip to content

Commit

Permalink
fixed docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoScholtes committed Oct 4, 2018
1 parent dc550cc commit fb8f68a
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions pathpy/utils/default_containers.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
"""
Provides default containers for various classes
which are used to store nodes, edges and similar objects.
To make the various classes pickle-able the defaultdicts need to be publicly addressable
function names, this means that no lambda functions are allowed.
All pathpy classes which required a default value as a container, should use these here.
"""
# -*- coding: utf-8 -*-
# pathpy is an OpenSource python package for the analysis of time series data
# on networks using higher- and multi order graphical models.
Expand All @@ -30,22 +21,38 @@
#
# E-mail: scholtes@ifi.uzh.ch
# Web: http://www.ingoscholtes.net

"""
Provides default containers for various classes
which are used to store nodes, edges and similar objects.
To make the various classes pickle-able the defaultdicts need to be publicly addressable
function names, this means that no lambda functions are allowed.
All pathpy classes which required a default value as a container, should use these here.
"""

from collections import defaultdict
import numpy as np


def nested_zero_default():
"""returns a nested default dict (2 levels)
"""
Returns a nested default dict (2 levels)
with a numpy zero array of length 0 as default
"""
return defaultdict(zero_array_default)


def _zero_array():
"""returns a zero numpy array of length 2"""
"""
Returns a zero numpy array of length 2
"""
return np.array([0.0, 0.0])


def zero_array_default():
"""returns a default dict with numpy zero array af length 2 as default"""
"""
Returns a default dict with numpy zero array af length 2 as default
"""
return defaultdict(_zero_array)

0 comments on commit fb8f68a

Please sign in to comment.