Skip to content

Commit

Permalink
Documentating and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-braun committed Jul 28, 2021
1 parent e510b41 commit 261b2e6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
8 changes: 4 additions & 4 deletions docs/sertit/ci.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ <h1 class="title">Module <code>sertit.ci</code></h1>
geom_1 (gpd.GeoDataFrame): Geometry 1
geom_2 (gpd.GeoDataFrame): Geometry 2
&#34;&#34;&#34;
if not isinstance(geom_1, gpd.GeoDataFrame):
if not isinstance(geom_1, (gpd.GeoDataFrame, gpd.GeoSeries)):
geom_1 = vectors.read(geom_1)
if not isinstance(geom_2, gpd.GeoDataFrame):
if not isinstance(geom_2, (gpd.GeoDataFrame, gpd.GeoSeries)):
geom_2 = vectors.read(geom_2)

assert len(geom_1) == len(geom_2)
Expand Down Expand Up @@ -720,9 +720,9 @@ <h2 id="args">Args</h2>
geom_1 (gpd.GeoDataFrame): Geometry 1
geom_2 (gpd.GeoDataFrame): Geometry 2
&#34;&#34;&#34;
if not isinstance(geom_1, gpd.GeoDataFrame):
if not isinstance(geom_1, (gpd.GeoDataFrame, gpd.GeoSeries)):
geom_1 = vectors.read(geom_1)
if not isinstance(geom_2, gpd.GeoDataFrame):
if not isinstance(geom_2, (gpd.GeoDataFrame, gpd.GeoSeries)):
geom_2 = vectors.read(geom_2)

assert len(geom_1) == len(geom_2)
Expand Down
2 changes: 1 addition & 1 deletion docs/sertit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h1 id="documentation">Documentation</h1>
.. include:: ../README.md
&#34;&#34;&#34;

__version__ = &#34;1.4.6&#34;</code></pre>
__version__ = &#34;1.4.7&#34;</code></pre>
</details>
</section>
<section>
Expand Down
26 changes: 22 additions & 4 deletions docs/sertit/vectors.html
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,15 @@ <h1 class="title">Module <code>sertit.vectors</code></h1>

# Load vector in cache if needed (geopandas do not use correctly S3 paths for now)
if isinstance(path, CloudPath):
path = AnyPath(path.fspath)
tmp_dir = tempfile.TemporaryDirectory()
if path.suffix == &#34;.shp&#34;:
# Download everything to disk
for shp_file in path.parent.glob(path.with_suffix(&#34;.*&#34;).name):
cached_path = shp_file.download_to(tmp_dir.name)
if cached_path.suffix == &#34;.shp&#34;:
path = cached_path
else:
path = AnyPath(path.fspath)

# Manage archive case
if path.suffix in [&#34;.tar&#34;, &#34;.zip&#34;]:
Expand Down Expand Up @@ -460,7 +468,8 @@ <h1 class="title">Module <code>sertit.vectors</code></h1>
# Workaround for archived KML -&gt; they may be empty
# Convert KML to GeoJSON
if vect.empty and shutil.which(&#34;ogr2ogr&#34;): # Needs ogr2ogr here
tmp_dir = tempfile.TemporaryDirectory()
if not tmp_dir:
tmp_dir = tempfile.TemporaryDirectory()
if path.suffix == &#34;.zip&#34;:
with zipfile.ZipFile(path, &#34;r&#34;) as zip_ds:
vect_path = zip_ds.extract(arch_vect_path, tmp_dir.name)
Expand Down Expand Up @@ -1022,7 +1031,15 @@ <h2 id="returns">Returns</h2>

# Load vector in cache if needed (geopandas do not use correctly S3 paths for now)
if isinstance(path, CloudPath):
path = AnyPath(path.fspath)
tmp_dir = tempfile.TemporaryDirectory()
if path.suffix == &#34;.shp&#34;:
# Download everything to disk
for shp_file in path.parent.glob(path.with_suffix(&#34;.*&#34;).name):
cached_path = shp_file.download_to(tmp_dir.name)
if cached_path.suffix == &#34;.shp&#34;:
path = cached_path
else:
path = AnyPath(path.fspath)

# Manage archive case
if path.suffix in [&#34;.tar&#34;, &#34;.zip&#34;]:
Expand Down Expand Up @@ -1082,7 +1099,8 @@ <h2 id="returns">Returns</h2>
# Workaround for archived KML -&gt; they may be empty
# Convert KML to GeoJSON
if vect.empty and shutil.which(&#34;ogr2ogr&#34;): # Needs ogr2ogr here
tmp_dir = tempfile.TemporaryDirectory()
if not tmp_dir:
tmp_dir = tempfile.TemporaryDirectory()
if path.suffix == &#34;.zip&#34;:
with zipfile.ZipFile(path, &#34;r&#34;) as zip_ds:
vect_path = zip_ds.extract(arch_vect_path, tmp_dir.name)
Expand Down

0 comments on commit 261b2e6

Please sign in to comment.