Skip to content

Commit 3f99821

Browse files
committed
Fixup linting changes with shorter line length requirement
1 parent a1019e6 commit 3f99821

29 files changed

+458
-351
lines changed

pystac/asset.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,31 @@ class Asset:
1414
can be downloaded or streamed.
1515
1616
Args:
17-
href (str): Link to the asset object. Relative and absolute links are both allowed.
17+
href (str): Link to the asset object. Relative and absolute links are both
18+
allowed.
1819
title (str): Optional displayed title for clients and users.
19-
description (str): A description of the Asset providing additional details, such as
20-
how it was processed or created. CommonMark 0.29 syntax MAY be used for rich
21-
text representation.
20+
description (str): A description of the Asset providing additional details,
21+
such as how it was processed or created. CommonMark 0.29 syntax MAY be used
22+
for rich text representation.
2223
media_type (str): Optional description of the media type. Registered Media Types
2324
are preferred. See :class:`~pystac.MediaType` for common media types.
24-
roles ([str]): Optional, Semantic roles (i.e. thumbnail, overview, data, metadata)
25-
of the asset.
26-
properties (dict): Optional, additional properties for this asset. This is used by
27-
extensions as a way to serialize and deserialize properties on asset
25+
roles ([str]): Optional, Semantic roles (i.e. thumbnail, overview,
26+
data, metadata) of the asset.
27+
properties (dict): Optional, additional properties for this asset. This is used
28+
by extensions as a way to serialize and deserialize properties on asset
2829
object JSON.
2930
3031
Attributes:
31-
href (str): Link to the asset object. Relative and absolute links are both allowed.
32+
href (str): Link to the asset object. Relative and absolute links are both
33+
allowed.
3234
title (str): Optional displayed title for clients and users.
33-
description (str): A description of the Asset providing additional details, such as
34-
how it was processed or created. CommonMark 0.29 syntax MAY be used for rich
35-
text representation.
35+
description (str): A description of the Asset providing additional details,
36+
such as how it was processed or created. CommonMark 0.29 syntax MAY be
37+
used for rich text representation.
3638
media_type (str): Optional description of the media type. Registered Media Types
3739
are preferred. See :class:`~pystac.MediaType` for common media types.
38-
properties (dict): Optional, additional properties for this asset. This is used by
39-
extensions as a way to serialize and deserialize properties on asset
40+
properties (dict): Optional, additional properties for this asset. This is used
41+
by extensions as a way to serialize and deserialize properties on asset
4042
object JSON.
4143
owner: The Item or Collection this asset belongs to, or None if it has no owner.
4244
"""

pystac/cache.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class ResolvedObjectCache:
5555
to the cached STACObject.
5656
hrefs_to_objects (Dict[str, STACObject]): STAC Object HREFs matched to
5757
their cached object.
58-
ids_to_collections (Dict[str, Collection]): Map of collection IDs to collections.
58+
ids_to_collections (Dict[str, Collection]): Map of collection IDs
59+
to collections.
5960
"""
6061

6162
def __init__(
@@ -79,8 +80,8 @@ def get_or_cache(self, obj: "STACObject_Type") -> "STACObject_Type":
7980
against the cache.
8081
8182
Returns:
82-
STACObject: Either the cached object that has the same cache key as the given
83-
object, or the given object.
83+
STACObject: Either the cached object that has the same cache key as the
84+
given object, or the given object.
8485
"""
8586
key, is_href = get_cache_key(obj)
8687
if is_href:
@@ -100,11 +101,12 @@ def get(self, obj: "STACObject_Type") -> Optional["STACObject_Type"]:
100101
"""Get the cached object that has the same cache key as the given object.
101102
102103
Args:
103-
obj (STACObject): The given object who's cache key will be checked against the cache.
104+
obj (STACObject): The given object who's cache key will be checked against
105+
the cache.
104106
105107
Returns:
106-
STACObject or None: Either the cached object that has the same cache key as the given
107-
object, or None
108+
STACObject or None: Either the cached object that has the same cache key as
109+
the given object, or None
108110
"""
109111
key, is_href = get_cache_key(obj)
110112
if is_href:
@@ -226,8 +228,9 @@ class CollectionCache:
226228
"""Cache of collections that can be used to avoid re-reading Collection
227229
JSON in :func:`pystac.serialization.merge_common_properties
228230
<pystac.serialization.common_properties.merge_common_properties>`.
229-
The CollectionCache will contain collections as either as dicts or PySTAC Collections,
230-
and will set Collection JSON that it reads in order to merge in common properties.
231+
The CollectionCache will contain collections as either as dicts or PySTAC
232+
Collections, and will set Collection JSON that it reads in order to merge
233+
in common properties.
231234
"""
232235

233236
def __init__(

pystac/catalog.py

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,19 @@ class Catalog(STACObject):
107107
representation.
108108
title (str or None): Optional short descriptive one-line title for the catalog.
109109
stac_extensions (List[str]): Optional list of extensions the Catalog implements.
110-
href (str or None): Optional HREF for this catalog, which be set as the catalog's
111-
self link's HREF.
110+
href (str or None): Optional HREF for this catalog, which be set as the
111+
catalog's self link's HREF.
112112
catalog_type (str or None): Optional catalog type for this catalog. Must
113113
be one of the values in :class`~pystac.CatalogType`.
114114
115115
Attributes:
116116
id (str): Identifier for the catalog.
117117
description (str): Detailed multi-line description to fully explain the catalog.
118118
title (str or None): Optional short descriptive one-line title for the catalog.
119-
stac_extensions (List[str] or None): Optional list of extensions the Catalog implements.
120-
extra_fields (dict or None): Extra fields that are part of the top-level JSON properties
121-
of the Catalog.
119+
stac_extensions (List[str] or None): Optional list of extensions the Catalog
120+
implements.
121+
extra_fields (dict or None): Extra fields that are part of the top-level JSON
122+
properties of the Catalog.
122123
links (List[Link]): A list of :class:`~pystac.Link` objects representing
123124
all links associated with this Catalog.
124125
catalog_type (str): The catalog type. Defaults to ABSOLUTE_PUBLISHED
@@ -133,7 +134,9 @@ class Catalog(STACObject):
133134
is read by a StacIO instance."""
134135

135136
DEFAULT_FILE_NAME = "catalog.json"
136-
"""Default file name that will be given to this STAC object in a canonical format."""
137+
"""Default file name that will be given to this STAC object in
138+
a canonical format.
139+
"""
137140

138141
def __init__(
139142
self,
@@ -195,8 +198,8 @@ def add_child(
195198
Args:
196199
child (Catalog or Collection): The child to add.
197200
title (str): Optional title to give to the :class:`~pystac.Link`
198-
strategy (HrefLayoutStrategy): The layout strategy to use for setting the self
199-
href of the child.
201+
strategy (HrefLayoutStrategy): The layout strategy to use for setting the
202+
self href of the child.
200203
"""
201204

202205
# Prevent typo confusion
@@ -277,8 +280,9 @@ def get_child(self, id: str, recursive: bool = False) -> Optional["Catalog"]:
277280
278281
Args:
279282
id (str): The ID of the child to find.
280-
recursive (bool): If True, search this catalog and all children for the item;
281-
otherwise, only search the children of this catalog. Defaults to False.
283+
recursive (bool): If True, search this catalog and all children for the
284+
item; otherwise, only search the children of this catalog. Defaults
285+
to False.
282286
283287
Return:
284288
Item or None: The item with the given ID, or None if not found.
@@ -345,8 +349,9 @@ def get_item(self, id: str, recursive: bool = False) -> Optional["Item_Type"]:
345349
346350
Args:
347351
id (str): The ID of the item to find.
348-
recursive (bool): If True, search this catalog and all children for the item;
349-
otherwise, only search the items of this catalog. Defaults to False.
352+
recursive (bool): If True, search this catalog and all children for the
353+
item; otherwise, only search the items of this catalog. Defaults
354+
to False.
350355
351356
Return:
352357
Item or None: The item with the given ID, or None if not found.
@@ -501,13 +506,15 @@ def normalize_and_save(
501506
in sequence.
502507
503508
Args:
504-
root_href (str): The absolute HREF that all links will be normalized against.
509+
root_href (str): The absolute HREF that all links will be normalized
510+
against.
505511
catalog_type (str): The catalog type that dictates the structure of
506512
the catalog to save. Use a member of :class:`~pystac.CatalogType`.
507-
Defaults to the root catalog.catalog_type or the current catalog catalog_type
508-
if there is no root catalog.
509-
strategy (HrefLayoutStrategy): The layout strategy to use in setting the HREFS
510-
for this catalog. Defaults to :class:`~pystac.layout.BestPracticesLayoutStrategy`
513+
Defaults to the root catalog.catalog_type or the current catalog
514+
catalog_type if there is no root catalog.
515+
strategy (HrefLayoutStrategy): The layout strategy to use in setting the
516+
HREFS for this catalog. Defaults to
517+
:class:`~pystac.layout.BestPracticesLayoutStrategy`
511518
"""
512519
self.normalize_hrefs(root_href, strategy=strategy)
513520
self.save(catalog_type)
@@ -587,7 +594,9 @@ def generate_subcatalogs(
587594
**kwargs: Any,
588595
) -> List["Catalog"]:
589596
"""Walks through the catalog and generates subcatalogs
590-
for items based on the template string. See :class:`~pystac.layout.LayoutTemplate`
597+
for items based on the template string.
598+
599+
See :class:`~pystac.layout.LayoutTemplate`
591600
for details on the construction of template strings. This template string
592601
will be applied to the items, and subcatalogs will be created that separate
593602
and organize the items based on template values.
@@ -673,11 +682,11 @@ def save(self, catalog_type: Optional[CatalogType] = None) -> None:
673682
Note:
674683
If the catalog type is ``CatalogType.ABSOLUTE_PUBLISHED``,
675684
all self links will be included, and hierarchical links be absolute URLs.
676-
If the catalog type is ``CatalogType.RELATIVE_PUBLISHED``, this catalog's self
677-
link will be included, but no child catalog will have self links, and
685+
If the catalog type is ``CatalogType.RELATIVE_PUBLISHED``, this catalog's
686+
self link will be included, but no child catalog will have self links, and
678687
hierarchical links will be relative URLs
679-
If the catalog type is ``CatalogType.SELF_CONTAINED``, no self links will be
680-
included and hierarchical links will be relative URLs.
688+
If the catalog type is ``CatalogType.SELF_CONTAINED``, no self links will
689+
be included and hierarchical links will be relative URLs.
681690
"""
682691
root = self.get_root()
683692
if root is None:
@@ -699,7 +708,8 @@ def save(self, catalog_type: Optional[CatalogType] = None) -> None:
699708
)
700709

701710
include_self_link = False
702-
# include a self link if this is the root catalog or if ABSOLUTE_PUBLISHED catalog
711+
# include a self link if this is the root catalog
712+
# or if ABSOLUTE_PUBLISHED catalog
703713
if root.catalog_type == CatalogType.ABSOLUTE_PUBLISHED:
704714
include_self_link = True
705715
elif root.catalog_type != CatalogType.SELF_CONTAINED:
@@ -716,9 +726,9 @@ def walk(
716726
) -> Iterable[Tuple["Catalog", Iterable["Catalog"], Iterable["Item_Type"]]]:
717727
"""Walks through children and items of catalogs.
718728
719-
For each catalog in the STAC's tree rooted at this catalog (including this catalog
720-
itself), it yields a 3-tuple (root, subcatalogs, items). The root in that
721-
3-tuple refers to the current catalog being walked, the subcatalogs are any
729+
For each catalog in the STAC's tree rooted at this catalog (including this
730+
catalog itself), it yields a 3-tuple (root, subcatalogs, items). The root in
731+
that 3-tuple refers to the current catalog being walked, the subcatalogs are any
722732
catalogs or collections for which the root is a parent, and items represents
723733
any items that have the root as a parent.
724734
@@ -764,9 +774,9 @@ def map_items(
764774
item_mapper function.
765775
766776
Args:
767-
item_mapper (Callable): A function that takes in an item, and returns either
768-
an item or list of items. The item that is passed into the item_mapper
769-
is a copy, so the method can mutate it safely.
777+
item_mapper (Callable): A function that takes in an item, and returns
778+
either an item or list of items. The item that is passed into the
779+
item_mapper is a copy, so the method can mutate it safely.
770780
771781
Returns:
772782
Catalog: A full copy of this catalog, with items manipulated according
@@ -810,10 +820,10 @@ def map_assets(
810820
through the asset_mapper function.
811821
812822
Args:
813-
asset_mapper (Callable): A function that takes in an key and an Asset, and returns
814-
either an Asset, a (key, Asset), or a dictionary of Assets with unique keys.
815-
The Asset that is passed into the item_mapper is a copy, so the method can
816-
mutate it safely.
823+
asset_mapper (Callable): A function that takes in an key and an Asset, and
824+
returns either an Asset, a (key, Asset), or a dictionary of Assets with
825+
unique keys. The Asset that is passed into the item_mapper is a copy,
826+
so the method can mutate it safely.
817827
818828
Returns:
819829
Catalog: A full copy of this catalog, with assets manipulated according

0 commit comments

Comments
 (0)