Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #767

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
files: "libpysal\/"
files: "libpysal\/|docs\/"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.0"
rev: "v0.6.9"
hooks:
- id: ruff
- id: ruff-format
Expand Down
4 changes: 1 addition & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# libpysal documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 6 15:54:22 2018.
#
Expand All @@ -17,8 +15,8 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import sphinx_bootstrap_theme
import libpysal

import libpysal

# -- General configuration ------------------------------------------------

Expand Down
31 changes: 17 additions & 14 deletions docs/user-guide/data/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"metadata": {},
"outputs": [],
"source": [
"from libpysal.examples import get_path \n"
"from libpysal.examples import get_path"
]
},
{
Expand Down Expand Up @@ -72,6 +72,7 @@
"outputs": [],
"source": [
"import libpysal\n",
"\n",
"dbf = libpysal.io.open(get_path(\"mexicojoin.dbf\"))"
]
},
Expand Down Expand Up @@ -357,7 +358,7 @@
}
],
"source": [
"libpysal.examples.load_example('dataset42')"
"libpysal.examples.load_example(\"dataset42\")"
]
},
{
Expand Down Expand Up @@ -387,7 +388,7 @@
}
],
"source": [
"balt_url = libpysal.examples.get_url('Baltimore')\n",
"balt_url = libpysal.examples.get_url(\"Baltimore\")\n",
"balt_url"
]
},
Expand Down Expand Up @@ -421,7 +422,7 @@
}
],
"source": [
"libpysal.examples.explain('taz')"
"libpysal.examples.explain(\"taz\")"
]
},
{
Expand All @@ -430,7 +431,7 @@
"metadata": {},
"outputs": [],
"source": [
"taz = libpysal.examples.load_example('taz')"
"taz = libpysal.examples.load_example(\"taz\")"
]
},
{
Expand Down Expand Up @@ -485,7 +486,7 @@
}
],
"source": [
"libpysal.examples.explain('Baltimore')"
"libpysal.examples.explain(\"Baltimore\")"
]
},
{
Expand All @@ -502,7 +503,7 @@
}
],
"source": [
"balt = libpysal.examples.load_example('Baltimore')"
"balt = libpysal.examples.load_example(\"Baltimore\")"
]
},
{
Expand Down Expand Up @@ -673,7 +674,8 @@
],
"source": [
"from libpysal.examples import explain\n",
"explain('Tampa1')"
"\n",
"explain(\"Tampa1\")"
]
},
{
Expand All @@ -691,7 +693,8 @@
],
"source": [
"from libpysal.examples import load_example\n",
"tampa1 = load_example('Tampa1')"
"\n",
"tampa1 = load_example(\"Tampa1\")"
]
},
{
Expand Down Expand Up @@ -820,7 +823,7 @@
"metadata": {},
"outputs": [],
"source": [
"tampa_counties_shp = tampa1.load('tampa_counties.shp')"
"tampa_counties_shp = tampa1.load(\"tampa_counties.shp\")"
]
},
{
Expand Down Expand Up @@ -858,7 +861,7 @@
"metadata": {},
"outputs": [],
"source": [
"tampa_df = geopandas.read_file(tampa1.get_path('tampa_counties.shp'))"
"tampa_df = geopandas.read_file(tampa1.get_path(\"tampa_counties.shp\"))"
]
},
{
Expand Down Expand Up @@ -936,7 +939,7 @@
}
],
"source": [
"libpysal.examples.explain('Rio Grande do Sul')"
"libpysal.examples.explain(\"Rio Grande do Sul\")"
]
},
{
Expand All @@ -960,7 +963,7 @@
}
],
"source": [
"rio = libpysal.examples.load_example('Rio Grande do Sul')"
"rio = libpysal.examples.load_example(\"Rio Grande do Sul\")"
]
},
{
Expand Down Expand Up @@ -1051,7 +1054,7 @@
}
],
"source": [
"libpysal.examples.remote_datasets.datasets # a listing of all remotes"
"libpysal.examples.remote_datasets.datasets # a listing of all remotes"
]
},
{
Expand Down
51 changes: 28 additions & 23 deletions docs/user-guide/graph/matching-graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"sys.path.append(os.path.abspath('..'))\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import sys\n",
"\n",
"sys.path.append(os.path.abspath(\"..\"))\n",
"import geopandas\n",
"import pandas"
"import matplotlib.pyplot as plt\n",
"import numpy as np"
]
},
{
Expand All @@ -46,7 +46,7 @@
"metadata": {},
"outputs": [],
"source": [
"points = np.row_stack([(10.2, 5.1), (4.7, 2.2), (5.3, 5.7), (2.7, 5.3), (7,4)])\n",
"points = np.row_stack([(10.2, 5.1), (4.7, 2.2), (5.3, 5.7), (2.7, 5.3), (7, 4)])\n",
"gdf = geopandas.GeoDataFrame(geometry=geopandas.points_from_xy(*points.T))"
]
},
Expand Down Expand Up @@ -108,8 +108,8 @@
}
],
"source": [
"f, ax =plt.subplots(1,3)\n",
"for i,g in enumerate((g1, g2, g3)):\n",
"f, ax = plt.subplots(1, 3)\n",
"for i, g in enumerate((g1, g2, g3)):\n",
" g.plot(gdf, ax=ax[i])\n",
" ax[i].set_title(f\"k = {i+1}\")"
]
Expand All @@ -128,6 +128,7 @@
"outputs": [],
"source": [
"import geodatasets\n",
"\n",
"stores = geopandas.read_file(geodatasets.get_path(\"geoda liquor_stores\")).explode(\n",
" index_parts=False\n",
")"
Expand Down Expand Up @@ -261,8 +262,8 @@
}
],
"source": [
"f, ax =plt.subplots(1,3)\n",
"for i,g in enumerate((g1, g5, g10)):\n",
"f, ax = plt.subplots(1, 3)\n",
"for i, g in enumerate((g1, g5, g10)):\n",
" g.plot(stores, ax=ax[i], nodes=False)\n",
" ax[i].set_title(f\"k = {(1, 5, 10)[i]}\")"
]
Expand Down Expand Up @@ -293,8 +294,8 @@
"source": [
"sources = stores.sample(100)\n",
"sinks = stores[~stores.index.isin(sources.index)].sample(100)\n",
"ax = sources.plot(color='red')\n",
"sinks.plot(color='blue', ax=ax)\n",
"ax = sources.plot(color=\"red\")\n",
"sinks.plot(color=\"blue\", ax=ax)\n",
"plt.show()"
]
},
Expand All @@ -304,8 +305,9 @@
"metadata": {},
"outputs": [],
"source": [
"from libpysal.graph._matching import _spatial_matching\n",
"import shapely"
"import shapely\n",
"\n",
"from libpysal.graph._matching import _spatial_matching"
]
},
{
Expand Down Expand Up @@ -334,7 +336,9 @@
"metadata": {},
"outputs": [],
"source": [
"crosspattern_heads, crosspattern_tails, weights, mip = _spatial_matching(x=sink_coordinates, y = source_coordinates, n_matches=1, return_mip=True)"
"crosspattern_heads, crosspattern_tails, weights, mip = _spatial_matching(\n",
" x=sink_coordinates, y=source_coordinates, n_matches=1, return_mip=True\n",
")"
]
},
{
Expand Down Expand Up @@ -364,12 +368,13 @@
"outputs": [],
"source": [
"lines = shapely.linestrings(\n",
" list( \n",
" zip(\n",
" map(list, source_coordinates[crosspattern_heads]),\n",
" map(list, sink_coordinates[crosspattern_tails])\n",
" list(\n",
" zip(\n",
" map(list, source_coordinates[crosspattern_heads]),\n",
" map(list, sink_coordinates[crosspattern_tails]),\n",
" strict=False,\n",
" )\n",
" )\n",
")\n",
")"
]
},
Expand All @@ -390,9 +395,9 @@
}
],
"source": [
"ax = sources.plot(color='red')\n",
"sinks.plot(color='blue', ax=ax)\n",
"geopandas.GeoSeries(lines).plot(linewidth=1, color='k', ax=ax)\n",
"ax = sources.plot(color=\"red\")\n",
"sinks.plot(color=\"blue\", ax=ax)\n",
"geopandas.GeoSeries(lines).plot(linewidth=1, color=\"k\", ax=ax)\n",
"plt.show()"
]
}
Expand Down
22 changes: 10 additions & 12 deletions docs/user-guide/graph/w_g_migration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
"metadata": {},
"outputs": [],
"source": [
"from libpysal import weights\n",
"from libpysal import graph"
"from libpysal import graph, weights"
]
},
{
Expand Down Expand Up @@ -85,11 +84,10 @@
"source": [
"%matplotlib inline\n",
"\n",
"import seaborn as sns\n",
"import pandas as pd\n",
"import geopandas as gpd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"from libpysal import examples\n",
"\n",
"%load_ext watermark\n",
Expand Down Expand Up @@ -2710,7 +2708,7 @@
"metadata": {},
"outputs": [],
"source": [
"w_queen.transform = 'r'\n",
"w_queen.transform = \"r\"\n",
"wlag = lag_spatial(w_queen, y)"
]
},
Expand Down Expand Up @@ -3111,7 +3109,7 @@
"metadata": {},
"outputs": [],
"source": [
"ngdf = gdf.set_index('NAME')"
"ngdf = gdf.set_index(\"NAME\")"
]
},
{
Expand Down Expand Up @@ -3162,7 +3160,7 @@
}
],
"source": [
"g['Ashe']"
"g[\"Ashe\"]"
]
},
{
Expand Down Expand Up @@ -3742,9 +3740,9 @@
}
],
"source": [
"m = ngdf.loc[g['Ashe'].index].explore(color=\"#25b497\")\n",
"ngdf.loc[['Ashe']].explore(m=m, color=\"#fa94a5\")\n",
"g.explore(ngdf, m=m, focal='Ashe')"
"m = ngdf.loc[g[\"Ashe\"].index].explore(color=\"#25b497\")\n",
"ngdf.loc[[\"Ashe\"]].explore(m=m, color=\"#fa94a5\")\n",
"g.explore(ngdf, m=m, focal=\"Ashe\")"
]
},
{
Expand Down
Loading
Loading