From 831705dba1a2536ecf3b874da3510bead62ff489 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Mon, 7 Dec 2020 18:03:58 -0800 Subject: Standard imports (#4401) * Standardize pytest imports * Standardize numpy/scipy imports * Document import style * Fix * More * Fix matplotlib imports * Revert changes to tests * Motivate import policy Co-authored-by: Ross Barnowski * Fix missed imports * Standard np.testing use Co-authored-by: Ross Barnowski --- CONTRIBUTING.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'CONTRIBUTING.rst') diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 31dbf844..70ed6d47 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -246,6 +246,22 @@ Guidelines import pandas as pd import networkx as nx + After importing `sp`` for ``scipy``:: + + import scipy as sp + + use the following imports:: + + import scipy.linalg # call as sp.linalg + import scipy.sparse # call as sp.sparse + import scipy.sparse.linalg # call as sp.sparse.linalg + import scipy.stats # call as sp.stats + import scipy.optimize # call as sp.optimize + + For example, many libraries have a ``linalg`` subpackage: ``nx.linalg``, + ``np.linalg``, ``sp.linalg``, ``sp.sparse.linalg``. The above import + pattern makes the origin of any particular instance of ``linalg`` explicit. + * Use the decorator ``not_implemented_for`` in ``networkx/utils/decorators.py`` to designate that a function doesn't accept 'directed', 'undirected', 'multigraph' or 'graph'. The first argument of the decorated function should -- cgit v1.2.1