From 4a1c333ba8d4ae041926c0cd3f3d83116013b436 Mon Sep 17 00:00:00 2001 From: Nicholas Landry Date: Fri, 8 Mar 2024 18:54:26 -0500 Subject: [PATCH] format with isort and black --- benchmarks/hypernetx.ipynb | 6 ++++-- benchmarks/networkx.ipynb | 6 ++++-- docs/source/api/recipes/recipes.ipynb | 29 ++++++++++++++++++--------- xgi/core/diviews.py | 2 +- xgi/core/views.py | 2 +- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/benchmarks/hypernetx.ipynb b/benchmarks/hypernetx.ipynb index 7184625fa..3611394c2 100644 --- a/benchmarks/hypernetx.ipynb +++ b/benchmarks/hypernetx.ipynb @@ -15,10 +15,12 @@ "metadata": {}, "outputs": [], "source": [ + "import time\n", + "\n", "import hypernetx as hnx\n", - "import xgi\n", "import pandas as pd\n", - "import time" + "\n", + "import xgi" ] }, { diff --git a/benchmarks/networkx.ipynb b/benchmarks/networkx.ipynb index 3005c741d..1c5c7441c 100644 --- a/benchmarks/networkx.ipynb +++ b/benchmarks/networkx.ipynb @@ -15,9 +15,11 @@ "metadata": {}, "outputs": [], "source": [ + "import time\n", + "\n", "import networkx as nx\n", - "import xgi\n", - "import time" + "\n", + "import xgi" ] }, { diff --git a/docs/source/api/recipes/recipes.ipynb b/docs/source/api/recipes/recipes.ipynb index 1e67e5466..b128510d6 100644 --- a/docs/source/api/recipes/recipes.ipynb +++ b/docs/source/api/recipes/recipes.ipynb @@ -15,6 +15,7 @@ "outputs": [], "source": [ "import networkx as nx\n", + "\n", "import xgi" ] }, @@ -52,10 +53,11 @@ "metadata": {}, "outputs": [], "source": [ - "import xgi\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "from numpy.linalg import eigh" + "from numpy.linalg import eigh\n", + "\n", + "import xgi" ] }, { @@ -112,9 +114,10 @@ "metadata": {}, "outputs": [], "source": [ - "import xgi\n", "from itertools import permutations\n", "\n", + "import xgi\n", + "\n", "\n", "def adjacency_tensor(H, order):\n", " N = H.num_nodes\n", @@ -411,10 +414,11 @@ } ], "source": [ - "import xgi\n", "import pandas as pd\n", "import seaborn as sns\n", "\n", + "import xgi\n", + "\n", "H = xgi.load_xgi_data(\"diseasome\")\n", "H.merge_duplicate_edges(rename=\"tuple\", multiplicity=\"weight\")\n", "\n", @@ -456,11 +460,11 @@ } ], "source": [ - "import xgi\n", "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "import seaborn as sns\n", "\n", + "import xgi\n", "\n", "H = xgi.load_xgi_data(\"diseasome\")\n", "df1 = H.nodes.degree.ashist(bin_edges=True)\n", @@ -554,9 +558,10 @@ } ], "source": [ - "import xgi\n", "import matplotlib.pyplot as plt\n", "\n", + "import xgi\n", + "\n", "H = xgi.random_hypergraph(N=10, ps=[0.2, 0.05, 0.05], seed=1)\n", "\n", "_, ax = plt.subplots(figsize=(4, 4), subplot_kw={\"projection\": \"3d\"})\n", @@ -731,7 +736,7 @@ "H = xgi.load_xgi_data(\"email-enron\")\n", "print(H.num_nodes)\n", "\n", - "# Get all of the dates \n", + "# Get all of the dates\n", "nodes = H.nodes.filterby(\"degree\", [3, 20], mode=outsiderange)\n", "print(len(nodes))" ] @@ -758,16 +763,20 @@ } ], "source": [ - "import xgi\n", "import datetime\n", + "\n", + "import xgi\n", + "\n", "date1 = datetime.datetime(2000, 1, 1)\n", "date2 = datetime.datetime(2001, 1, 1)\n", - "datecompare = lambda date, arg: arg[0] <= datetime.datetime.fromisoformat(date) <= arg[1]\n", + "datecompare = (\n", + " lambda date, arg: arg[0] <= datetime.datetime.fromisoformat(date) <= arg[1]\n", + ")\n", "\n", "H = xgi.load_xgi_data(\"email-enron\")\n", "print(H.num_edges)\n", "\n", - "# Get all of the dates \n", + "# Get all of the dates\n", "e = H.edges.filterby_attr(\"timestamp\", [date1, date2], mode=datecompare)\n", "print(len(e))" ] diff --git a/xgi/core/diviews.py b/xgi/core/diviews.py index 5ca57e0f5..7a4ca6c95 100644 --- a/xgi/core/diviews.py +++ b/xgi/core/diviews.py @@ -201,7 +201,7 @@ def filterby(self, stat, val, mode="eq"): * 'geq': Return IDs whose value is greater than or equal to `val`. * 'between': In this mode, `val` must be a tuple `(val1, val2)`. Return IDs whose value `v` satisfies `val1 <= v <= val2`. - * function, must be able to call `mode(attribute, val)` and have it map to a bool. + * function, must be able to call `mode(statistic, val)` and have it map to a bool. See Also -------- diff --git a/xgi/core/views.py b/xgi/core/views.py index a802c25ef..6c61c8951 100644 --- a/xgi/core/views.py +++ b/xgi/core/views.py @@ -194,7 +194,7 @@ def filterby(self, stat, val, mode="eq"): * 'geq': Return IDs whose value is greater than or equal to `val`. * 'between': In this mode, `val` must be a tuple `(val1, val2)`. Return IDs whose value `v` satisfies `val1 <= v <= val2`. - * function, must be able to call `mode(attribute, val)` and have it map to a bool. + * function, must be able to call `mode(statistic, val)` and have it map to a bool. See Also --------