Skip to content

Commit

Permalink
deploy: 1fd53d7
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Jan 19, 2024
1 parent 0d80238 commit d4483b2
Showing 1 changed file with 157 additions and 2 deletions.
159 changes: 157 additions & 2 deletions layers.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h1 class="title">Module <code>geoengine.layers</code></h1>
from enum import auto
from io import StringIO
import os
from typing import Any, Dict, Generic, List, NewType, Optional, TypeVar, Union, cast
from typing import Any, Dict, Generic, List, Literal, NewType, Optional, TypeVar, Union, cast
from uuid import UUID
import json
from strenum import LowercaseStrEnum
Expand Down Expand Up @@ -428,6 +428,54 @@ <h1 class="title">Module <code>geoengine.layers</code></h1>

return [item for item in self.items if item.name == name]

def search(self, search_string: str, *,
search_type: Literal[&#39;fulltext&#39;, &#39;prefix&#39;] = &#39;fulltext&#39;,
offset: int = 0,
limit: int = 20,
timeout: int = 60) -&gt; List[Listing]:
&#39;&#39;&#39;Search for a string in the layer collection&#39;&#39;&#39;

session = get_session()

if search_type not in [
geoengine_openapi_client.SearchType.FULLTEXT,
geoengine_openapi_client.SearchType.PREFIX,
]:
raise ValueError(f&#39;Invalid search type {search_type}&#39;)

with geoengine_openapi_client.ApiClient(session.configuration) as api_client:
layers_api = geoengine_openapi_client.LayersApi(api_client)
layer_collection_response = layers_api.search_handler(
provider=str(self.provider_id),
collection=str(self.collection_id),
search_string=search_string,
search_type=geoengine_openapi_client.SearchType(search_type),
offset=offset,
limit=limit,
_request_timeout=timeout)

listings: List[Listing] = []
for item in layer_collection_response.items:
item = item.actual_instance
if isinstance(item, geoengine_openapi_client.LayerCollectionListingWithType):
listings.append(LayerCollectionListing(
listing_id=LayerCollectionId(item.id.collection_id),
provider_id=LayerProviderId(UUID(item.id.provider_id)),
name=item.name,
description=item.description,
))
elif isinstance(item, geoengine_openapi_client.LayerListingWithType):
listings.append(LayerListing(
listing_id=LayerId(item.id.layer_id),
provider_id=LayerProviderId(UUID(item.id.provider_id)),
name=item.name,
description=item.description,
))
else:
pass # ignore, should not happen

return listings


@dataclass(repr=False)
class Layer:
Expand Down Expand Up @@ -1423,7 +1471,55 @@ <h3>Methods</h3>
def get_items_by_name(self, name: str) -&gt; List[Listing]:
&#39;&#39;&#39;Get all children with the given name&#39;&#39;&#39;

return [item for item in self.items if item.name == name]</code></pre>
return [item for item in self.items if item.name == name]

def search(self, search_string: str, *,
search_type: Literal[&#39;fulltext&#39;, &#39;prefix&#39;] = &#39;fulltext&#39;,
offset: int = 0,
limit: int = 20,
timeout: int = 60) -&gt; List[Listing]:
&#39;&#39;&#39;Search for a string in the layer collection&#39;&#39;&#39;

session = get_session()

if search_type not in [
geoengine_openapi_client.SearchType.FULLTEXT,
geoengine_openapi_client.SearchType.PREFIX,
]:
raise ValueError(f&#39;Invalid search type {search_type}&#39;)

with geoengine_openapi_client.ApiClient(session.configuration) as api_client:
layers_api = geoengine_openapi_client.LayersApi(api_client)
layer_collection_response = layers_api.search_handler(
provider=str(self.provider_id),
collection=str(self.collection_id),
search_string=search_string,
search_type=geoengine_openapi_client.SearchType(search_type),
offset=offset,
limit=limit,
_request_timeout=timeout)

listings: List[Listing] = []
for item in layer_collection_response.items:
item = item.actual_instance
if isinstance(item, geoengine_openapi_client.LayerCollectionListingWithType):
listings.append(LayerCollectionListing(
listing_id=LayerCollectionId(item.id.collection_id),
provider_id=LayerProviderId(UUID(item.id.provider_id)),
name=item.name,
description=item.description,
))
elif isinstance(item, geoengine_openapi_client.LayerListingWithType):
listings.append(LayerListing(
listing_id=LayerId(item.id.layer_id),
provider_id=LayerProviderId(UUID(item.id.provider_id)),
name=item.name,
description=item.description,
))
else:
pass # ignore, should not happen

return listings</code></pre>
</details>
<h3>Class variables</h3>
<dl>
Expand Down Expand Up @@ -1723,6 +1819,64 @@ <h3>Methods</h3>
self.items.pop(index)</code></pre>
</details>
</dd>
<dt id="geoengine.layers.LayerCollection.search"><code class="name flex">
<span>def <span class="ident">search</span></span>(<span>self, search_string: str, *, search_type: "Literal['fulltext', 'prefix']" = 'fulltext', offset: int = 0, limit: int = 20, timeout: int = 60) ‑> List[<a title="geoengine.layers.Listing" href="#geoengine.layers.Listing">Listing</a>]</span>
</code></dt>
<dd>
<div class="desc"><p>Search for a string in the layer collection</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def search(self, search_string: str, *,
search_type: Literal[&#39;fulltext&#39;, &#39;prefix&#39;] = &#39;fulltext&#39;,
offset: int = 0,
limit: int = 20,
timeout: int = 60) -&gt; List[Listing]:
&#39;&#39;&#39;Search for a string in the layer collection&#39;&#39;&#39;

session = get_session()

if search_type not in [
geoengine_openapi_client.SearchType.FULLTEXT,
geoengine_openapi_client.SearchType.PREFIX,
]:
raise ValueError(f&#39;Invalid search type {search_type}&#39;)

with geoengine_openapi_client.ApiClient(session.configuration) as api_client:
layers_api = geoengine_openapi_client.LayersApi(api_client)
layer_collection_response = layers_api.search_handler(
provider=str(self.provider_id),
collection=str(self.collection_id),
search_string=search_string,
search_type=geoengine_openapi_client.SearchType(search_type),
offset=offset,
limit=limit,
_request_timeout=timeout)

listings: List[Listing] = []
for item in layer_collection_response.items:
item = item.actual_instance
if isinstance(item, geoengine_openapi_client.LayerCollectionListingWithType):
listings.append(LayerCollectionListing(
listing_id=LayerCollectionId(item.id.collection_id),
provider_id=LayerProviderId(UUID(item.id.provider_id)),
name=item.name,
description=item.description,
))
elif isinstance(item, geoengine_openapi_client.LayerListingWithType):
listings.append(LayerListing(
listing_id=LayerId(item.id.layer_id),
provider_id=LayerProviderId(UUID(item.id.provider_id)),
name=item.name,
description=item.description,
))
else:
pass # ignore, should not happen

return listings</code></pre>
</details>
</dd>
</dl>
</dd>
<dt id="geoengine.layers.LayerCollectionListing"><code class="flex name class">
Expand Down Expand Up @@ -2099,6 +2253,7 @@ <h4><code><a title="geoengine.layers.LayerCollection" href="#geoengine.layers.La
<li><code><a title="geoengine.layers.LayerCollection.reload" href="#geoengine.layers.LayerCollection.reload">reload</a></code></li>
<li><code><a title="geoengine.layers.LayerCollection.remove" href="#geoengine.layers.LayerCollection.remove">remove</a></code></li>
<li><code><a title="geoengine.layers.LayerCollection.remove_item" href="#geoengine.layers.LayerCollection.remove_item">remove_item</a></code></li>
<li><code><a title="geoengine.layers.LayerCollection.search" href="#geoengine.layers.LayerCollection.search">search</a></code></li>
</ul>
</li>
<li>
Expand Down

0 comments on commit d4483b2

Please sign in to comment.