Skip to content

Commit

Permalink
format with isort and black
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlandry committed Mar 8, 2024
1 parent a5b24d5 commit 4a1c333
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
6 changes: 4 additions & 2 deletions benchmarks/hypernetx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
6 changes: 4 additions & 2 deletions benchmarks/networkx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"\n",
"import networkx as nx\n",
"import xgi\n",
"import time"
"\n",
"import xgi"
]
},
{
Expand Down
29 changes: 19 additions & 10 deletions docs/source/api/recipes/recipes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"outputs": [],
"source": [
"import networkx as nx\n",
"\n",
"import xgi"
]
},
Expand Down Expand Up @@ -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"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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))"
]
Expand All @@ -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))"
]
Expand Down
2 changes: 1 addition & 1 deletion xgi/core/diviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down
2 changes: 1 addition & 1 deletion xgi/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down

0 comments on commit 4a1c333

Please sign in to comment.