Skip to content

Commit e23998a

Browse files
pre-commit-ci[bot]jGaboardimartinfleis
authored
[pre-commit.ci] pre-commit autoupdate (#767)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.6.9](astral-sh/ruff-pre-commit@v0.5.0...v0.6.9) * reup linting & formating * Update pyproject.toml --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: James Gaboardi <[email protected]> Co-authored-by: Martin Fleischmann <[email protected]>
1 parent 281ed1b commit e23998a

File tree

11 files changed

+259
-230
lines changed

11 files changed

+259
-230
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
files: "libpysal\/"
1+
files: "libpysal\/|docs\/"
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: "v0.5.0"
4+
rev: "v0.6.9"
55
hooks:
66
- id: ruff
77
- id: ruff-format

docs/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# libpysal documentation build configuration file, created by
42
# sphinx-quickstart on Wed Jun 6 15:54:22 2018.
53
#
@@ -17,8 +15,8 @@
1715
# documentation root, use os.path.abspath to make it absolute, like shown here.
1816
#
1917
import sphinx_bootstrap_theme
20-
import libpysal
2118

19+
import libpysal
2220

2321
# -- General configuration ------------------------------------------------
2422

docs/user-guide/data/examples.ipynb

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
38-
"from libpysal.examples import get_path \n"
38+
"from libpysal.examples import get_path"
3939
]
4040
},
4141
{
@@ -72,6 +72,7 @@
7272
"outputs": [],
7373
"source": [
7474
"import libpysal\n",
75+
"\n",
7576
"dbf = libpysal.io.open(get_path(\"mexicojoin.dbf\"))"
7677
]
7778
},
@@ -357,7 +358,7 @@
357358
}
358359
],
359360
"source": [
360-
"libpysal.examples.load_example('dataset42')"
361+
"libpysal.examples.load_example(\"dataset42\")"
361362
]
362363
},
363364
{
@@ -387,7 +388,7 @@
387388
}
388389
],
389390
"source": [
390-
"balt_url = libpysal.examples.get_url('Baltimore')\n",
391+
"balt_url = libpysal.examples.get_url(\"Baltimore\")\n",
391392
"balt_url"
392393
]
393394
},
@@ -421,7 +422,7 @@
421422
}
422423
],
423424
"source": [
424-
"libpysal.examples.explain('taz')"
425+
"libpysal.examples.explain(\"taz\")"
425426
]
426427
},
427428
{
@@ -430,7 +431,7 @@
430431
"metadata": {},
431432
"outputs": [],
432433
"source": [
433-
"taz = libpysal.examples.load_example('taz')"
434+
"taz = libpysal.examples.load_example(\"taz\")"
434435
]
435436
},
436437
{
@@ -485,7 +486,7 @@
485486
}
486487
],
487488
"source": [
488-
"libpysal.examples.explain('Baltimore')"
489+
"libpysal.examples.explain(\"Baltimore\")"
489490
]
490491
},
491492
{
@@ -502,7 +503,7 @@
502503
}
503504
],
504505
"source": [
505-
"balt = libpysal.examples.load_example('Baltimore')"
506+
"balt = libpysal.examples.load_example(\"Baltimore\")"
506507
]
507508
},
508509
{
@@ -673,7 +674,8 @@
673674
],
674675
"source": [
675676
"from libpysal.examples import explain\n",
676-
"explain('Tampa1')"
677+
"\n",
678+
"explain(\"Tampa1\")"
677679
]
678680
},
679681
{
@@ -691,7 +693,8 @@
691693
],
692694
"source": [
693695
"from libpysal.examples import load_example\n",
694-
"tampa1 = load_example('Tampa1')"
696+
"\n",
697+
"tampa1 = load_example(\"Tampa1\")"
695698
]
696699
},
697700
{
@@ -820,7 +823,7 @@
820823
"metadata": {},
821824
"outputs": [],
822825
"source": [
823-
"tampa_counties_shp = tampa1.load('tampa_counties.shp')"
826+
"tampa_counties_shp = tampa1.load(\"tampa_counties.shp\")"
824827
]
825828
},
826829
{
@@ -858,7 +861,7 @@
858861
"metadata": {},
859862
"outputs": [],
860863
"source": [
861-
"tampa_df = geopandas.read_file(tampa1.get_path('tampa_counties.shp'))"
864+
"tampa_df = geopandas.read_file(tampa1.get_path(\"tampa_counties.shp\"))"
862865
]
863866
},
864867
{
@@ -936,7 +939,7 @@
936939
}
937940
],
938941
"source": [
939-
"libpysal.examples.explain('Rio Grande do Sul')"
942+
"libpysal.examples.explain(\"Rio Grande do Sul\")"
940943
]
941944
},
942945
{
@@ -960,7 +963,7 @@
960963
}
961964
],
962965
"source": [
963-
"rio = libpysal.examples.load_example('Rio Grande do Sul')"
966+
"rio = libpysal.examples.load_example(\"Rio Grande do Sul\")"
964967
]
965968
},
966969
{
@@ -1051,7 +1054,7 @@
10511054
}
10521055
],
10531056
"source": [
1054-
"libpysal.examples.remote_datasets.datasets # a listing of all remotes"
1057+
"libpysal.examples.remote_datasets.datasets # a listing of all remotes"
10551058
]
10561059
},
10571060
{

docs/user-guide/graph/matching-graph.ipynb

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
25-
"import sys\n",
2625
"import os\n",
27-
"sys.path.append(os.path.abspath('..'))\n",
28-
"import numpy as np\n",
29-
"import matplotlib.pyplot as plt\n",
26+
"import sys\n",
27+
"\n",
28+
"sys.path.append(os.path.abspath(\"..\"))\n",
3029
"import geopandas\n",
31-
"import pandas"
30+
"import matplotlib.pyplot as plt\n",
31+
"import numpy as np"
3232
]
3333
},
3434
{
@@ -46,7 +46,7 @@
4646
"metadata": {},
4747
"outputs": [],
4848
"source": [
49-
"points = np.row_stack([(10.2, 5.1), (4.7, 2.2), (5.3, 5.7), (2.7, 5.3), (7,4)])\n",
49+
"points = np.row_stack([(10.2, 5.1), (4.7, 2.2), (5.3, 5.7), (2.7, 5.3), (7, 4)])\n",
5050
"gdf = geopandas.GeoDataFrame(geometry=geopandas.points_from_xy(*points.T))"
5151
]
5252
},
@@ -108,8 +108,8 @@
108108
}
109109
],
110110
"source": [
111-
"f, ax =plt.subplots(1,3)\n",
112-
"for i,g in enumerate((g1, g2, g3)):\n",
111+
"f, ax = plt.subplots(1, 3)\n",
112+
"for i, g in enumerate((g1, g2, g3)):\n",
113113
" g.plot(gdf, ax=ax[i])\n",
114114
" ax[i].set_title(f\"k = {i+1}\")"
115115
]
@@ -128,6 +128,7 @@
128128
"outputs": [],
129129
"source": [
130130
"import geodatasets\n",
131+
"\n",
131132
"stores = geopandas.read_file(geodatasets.get_path(\"geoda liquor_stores\")).explode(\n",
132133
" index_parts=False\n",
133134
")"
@@ -261,8 +262,8 @@
261262
}
262263
],
263264
"source": [
264-
"f, ax =plt.subplots(1,3)\n",
265-
"for i,g in enumerate((g1, g5, g10)):\n",
265+
"f, ax = plt.subplots(1, 3)\n",
266+
"for i, g in enumerate((g1, g5, g10)):\n",
266267
" g.plot(stores, ax=ax[i], nodes=False)\n",
267268
" ax[i].set_title(f\"k = {(1, 5, 10)[i]}\")"
268269
]
@@ -293,8 +294,8 @@
293294
"source": [
294295
"sources = stores.sample(100)\n",
295296
"sinks = stores[~stores.index.isin(sources.index)].sample(100)\n",
296-
"ax = sources.plot(color='red')\n",
297-
"sinks.plot(color='blue', ax=ax)\n",
297+
"ax = sources.plot(color=\"red\")\n",
298+
"sinks.plot(color=\"blue\", ax=ax)\n",
298299
"plt.show()"
299300
]
300301
},
@@ -304,8 +305,9 @@
304305
"metadata": {},
305306
"outputs": [],
306307
"source": [
307-
"from libpysal.graph._matching import _spatial_matching\n",
308-
"import shapely"
308+
"import shapely\n",
309+
"\n",
310+
"from libpysal.graph._matching import _spatial_matching"
309311
]
310312
},
311313
{
@@ -334,7 +336,9 @@
334336
"metadata": {},
335337
"outputs": [],
336338
"source": [
337-
"crosspattern_heads, crosspattern_tails, weights, mip = _spatial_matching(x=sink_coordinates, y = source_coordinates, n_matches=1, return_mip=True)"
339+
"crosspattern_heads, crosspattern_tails, weights, mip = _spatial_matching(\n",
340+
" x=sink_coordinates, y=source_coordinates, n_matches=1, return_mip=True\n",
341+
")"
338342
]
339343
},
340344
{
@@ -364,12 +368,13 @@
364368
"outputs": [],
365369
"source": [
366370
"lines = shapely.linestrings(\n",
367-
" list( \n",
368-
" zip(\n",
369-
" map(list, source_coordinates[crosspattern_heads]),\n",
370-
" map(list, sink_coordinates[crosspattern_tails])\n",
371+
" list(\n",
372+
" zip(\n",
373+
" map(list, source_coordinates[crosspattern_heads]),\n",
374+
" map(list, sink_coordinates[crosspattern_tails]),\n",
375+
" strict=False,\n",
376+
" )\n",
371377
" )\n",
372-
")\n",
373378
")"
374379
]
375380
},
@@ -390,9 +395,9 @@
390395
}
391396
],
392397
"source": [
393-
"ax = sources.plot(color='red')\n",
394-
"sinks.plot(color='blue', ax=ax)\n",
395-
"geopandas.GeoSeries(lines).plot(linewidth=1, color='k', ax=ax)\n",
398+
"ax = sources.plot(color=\"red\")\n",
399+
"sinks.plot(color=\"blue\", ax=ax)\n",
400+
"geopandas.GeoSeries(lines).plot(linewidth=1, color=\"k\", ax=ax)\n",
396401
"plt.show()"
397402
]
398403
}

docs/user-guide/graph/w_g_migration.ipynb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
50-
"from libpysal import weights\n",
51-
"from libpysal import graph"
50+
"from libpysal import graph, weights"
5251
]
5352
},
5453
{
@@ -85,11 +84,10 @@
8584
"source": [
8685
"%matplotlib inline\n",
8786
"\n",
88-
"import seaborn as sns\n",
89-
"import pandas as pd\n",
9087
"import geopandas as gpd\n",
91-
"import numpy as np\n",
92-
"import matplotlib.pyplot as plt\n",
88+
"import pandas as pd\n",
89+
"import seaborn as sns\n",
90+
"\n",
9391
"from libpysal import examples\n",
9492
"\n",
9593
"%load_ext watermark\n",
@@ -2710,7 +2708,7 @@
27102708
"metadata": {},
27112709
"outputs": [],
27122710
"source": [
2713-
"w_queen.transform = 'r'\n",
2711+
"w_queen.transform = \"r\"\n",
27142712
"wlag = lag_spatial(w_queen, y)"
27152713
]
27162714
},
@@ -3111,7 +3109,7 @@
31113109
"metadata": {},
31123110
"outputs": [],
31133111
"source": [
3114-
"ngdf = gdf.set_index('NAME')"
3112+
"ngdf = gdf.set_index(\"NAME\")"
31153113
]
31163114
},
31173115
{
@@ -3162,7 +3160,7 @@
31623160
}
31633161
],
31643162
"source": [
3165-
"g['Ashe']"
3163+
"g[\"Ashe\"]"
31663164
]
31673165
},
31683166
{
@@ -3742,9 +3740,9 @@
37423740
}
37433741
],
37443742
"source": [
3745-
"m = ngdf.loc[g['Ashe'].index].explore(color=\"#25b497\")\n",
3746-
"ngdf.loc[['Ashe']].explore(m=m, color=\"#fa94a5\")\n",
3747-
"g.explore(ngdf, m=m, focal='Ashe')"
3743+
"m = ngdf.loc[g[\"Ashe\"].index].explore(color=\"#25b497\")\n",
3744+
"ngdf.loc[[\"Ashe\"]].explore(m=m, color=\"#fa94a5\")\n",
3745+
"g.explore(ngdf, m=m, focal=\"Ashe\")"
37483746
]
37493747
},
37503748
{

0 commit comments

Comments
 (0)