-
Notifications
You must be signed in to change notification settings - Fork 132
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
Replace flake8 and pylint with ruff #416
Changes from all commits
ba360aa
c14d1a6
e9a1886
8982df6
b4983d5
e1f4d9b
98b8299
1a5dbfe
1b2474a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,41 +34,48 @@ | |
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import h3\n", | ||
"\n", | ||
"import geopandas\n", | ||
"import geodatasets\n", | ||
"import contextily as cx\n", | ||
"import geodatasets\n", | ||
"import geopandas\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"import h3\n", | ||
"\n", | ||
"\n", | ||
"def plot_df(df, column=None, ax=None):\n", | ||
" 'Plot based on the `geometry` column of a GeoPandas dataframe'\n", | ||
" \"Plot based on the `geometry` column of a GeoPandas dataframe\"\n", | ||
" df = df.copy()\n", | ||
" df = df.to_crs(epsg=3857) # web mercator\n", | ||
" df = df.to_crs(epsg=3857) # web mercator\n", | ||
"\n", | ||
" if ax is None:\n", | ||
" fig, ax = plt.subplots(figsize=(8,8))\n", | ||
" fig, ax = plt.subplots(figsize=(8, 8))\n", | ||
" ax.get_xaxis().set_visible(False)\n", | ||
" ax.get_yaxis().set_visible(False)\n", | ||
" \n", | ||
"\n", | ||
" df.plot(\n", | ||
" ax=ax,\n", | ||
" alpha=0.5, edgecolor='k',\n", | ||
" column=column, categorical=True,\n", | ||
" legend=True, legend_kwds={'loc': 'upper left'}, \n", | ||
" alpha=0.5,\n", | ||
" edgecolor='k',\n", | ||
" column=column,\n", | ||
" categorical=True,\n", | ||
" legend=True,\n", | ||
" legend_kwds={'loc': 'upper left'},\n", | ||
" )\n", | ||
" cx.add_basemap(ax, crs=df.crs, source=cx.providers.CartoDB.Positron)\n", | ||
"\n", | ||
"\n", | ||
"def plot_shape(shape, ax=None):\n", | ||
" df = geopandas.GeoDataFrame({'geometry': [shape]}, crs='EPSG:4326')\n", | ||
" plot_df(df, ax=ax)\n", | ||
"\n", | ||
"\n", | ||
"def plot_cells(cells, ax=None):\n", | ||
" shape = h3.cells_to_h3shape(cells)\n", | ||
" plot_shape(shape, ax=ax)\n", | ||
"\n", | ||
"\n", | ||
"def plot_shape_and_cells(shape, res=9):\n", | ||
" fig, axs = plt.subplots(1,2, figsize=(10,5), sharex=True, sharey=True)\n", | ||
" fig, axs = plt.subplots(1, 2, figsize=(10, 5), sharex=True, sharey=True)\n", | ||
" plot_shape(shape, ax=axs[0])\n", | ||
" plot_cells(h3.h3shape_to_cells(shape, res), ax=axs[1])\n", | ||
" fig.tight_layout()" | ||
|
@@ -92,11 +99,7 @@ | |
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"outer = [\n", | ||
" (37.804, -122.412),\n", | ||
" (37.778, -122.507),\n", | ||
" (37.733, -122.501)\n", | ||
"]\n", | ||
"outer = [(37.804, -122.412), (37.778, -122.507), (37.733, -122.501)]\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worse. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way a lot of these auto formatters work is that you can add a trailing comma to the last element to force it to have one element per line. |
||
"\n", | ||
"poly = h3.LatLngPoly(outer)\n", | ||
"print(poly)\n", | ||
|
@@ -263,6 +266,7 @@ | |
" def __geo_interface__(self):\n", | ||
" return self.d\n", | ||
"\n", | ||
"\n", | ||
"geo = MockGeo(d)\n", | ||
"h3.geo_to_h3shape(geo)" | ||
] | ||
|
@@ -429,7 +433,13 @@ | |
"poly1 = h3.LatLngPoly([(37.804, -122.412), (37.778, -122.507), (37.733, -122.501)])\n", | ||
"poly2 = h3.LatLngPoly(\n", | ||
" [(37.803, -122.408), (37.736, -122.491), (37.738, -122.380), (37.787, -122.39)],\n", | ||
" [(37.760, -122.441), (37.772, -122.427), (37.773, -122.404), (37.758, -122.401), (37.745, -122.428)]\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was about to complain about this, but its inconsistent with what I just said above. 😬 |
||
" [\n", | ||
" (37.760, -122.441),\n", | ||
" (37.772, -122.427),\n", | ||
" (37.773, -122.404),\n", | ||
" (37.758, -122.401),\n", | ||
" (37.745, -122.428),\n", | ||
" ],\n", | ||
")\n", | ||
"mpoly = h3.LatLngMultiPoly(poly1, poly2)\n", | ||
"\n", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
# flake8: noqa | ||
|
||
from .api.basic_str import * | ||
from ._version import __version__ | ||
|
||
from ._cy import ( | ||
UnknownH3ErrorCode, | ||
H3BaseException, | ||
|
||
H3GridNavigationError, | ||
H3MemoryError, | ||
H3ValueError, | ||
|
||
H3FailedError, | ||
H3DomainError, | ||
H3LatLngDomainError, | ||
H3ResDomainError, | ||
H3CellInvalidError, | ||
H3DirEdgeInvalidError, | ||
H3UndirEdgeInvalidError, | ||
H3VertexInvalidError, | ||
H3PentagonError, | ||
H3DomainError, | ||
H3DuplicateInputError, | ||
H3NotNeighborsError, | ||
H3ResMismatchError, | ||
H3FailedError, | ||
H3GridNavigationError, | ||
H3LatLngDomainError, | ||
H3MemoryAllocError, | ||
H3MemoryBoundsError, | ||
H3MemoryError, | ||
H3NotNeighborsError, | ||
H3OptionInvalidError, | ||
H3PentagonError, | ||
H3ResDomainError, | ||
H3ResMismatchError, | ||
H3UndirEdgeInvalidError, | ||
H3ValueError, | ||
H3VertexInvalidError, | ||
UnknownH3ErrorCode, | ||
) | ||
from ._version import __version__ | ||
from .api.basic_str import * # noqa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙄