Skip to content

Commit c84d398

Browse files
author
Jon Duckworth
authored
Merge pull request #536 from l0b0/refactor/split-long-lines
refactor: Split long lines
2 parents 750f9a7 + c6250cb commit c84d398

File tree

6 files changed

+73
-58
lines changed

6 files changed

+73
-58
lines changed

pystac/catalog.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,29 @@ def __str__(self) -> str:
4646
local computer, so all links need to be relative.
4747
4848
See:
49-
:stac-spec:`The best practices documentation on self-contained catalogs <best-practices.md#self-contained-catalogs>`
50-
""" # noqa E501
49+
:stac-spec:`The best practices documentation on self-contained catalogs
50+
<best-practices.md#self-contained-catalogs>`
51+
"""
5152

5253
ABSOLUTE_PUBLISHED = "ABSOLUTE_PUBLISHED"
5354
"""
5455
Absolute Published Catalog is a catalog that uses absolute links for everything,
5556
both in the links objects and in the asset hrefs.
5657
5758
See:
58-
:stac-spec:`The best practices documentation on published catalogs <best-practices.md#published-catalogs>`
59-
""" # noqa E501
59+
:stac-spec:`The best practices documentation on published catalogs
60+
<best-practices.md#published-catalogs>`
61+
"""
6062

6163
RELATIVE_PUBLISHED = "RELATIVE_PUBLISHED"
6264
"""
63-
Relative Published Catalog is a catalog that uses relative links for everything,
64-
but includes an absolute self link at the root catalog, to identify its online location.
65+
Relative Published Catalog is a catalog that uses relative links for everything, but
66+
includes an absolute self link at the root catalog, to identify its online location.
6567
6668
See:
67-
:stac-spec:`The best practices documentation on published catalogs <best-practices.md#published-catalogs>`
68-
""" # noqa E501
69+
:stac-spec:`The best practices documentation on published catalogs
70+
<best-practices.md#published-catalogs>`
71+
"""
6972

7073
@classmethod
7174
def determine_type(cls, stac_json: Dict[str, Any]) -> Optional["CatalogType"]:
@@ -564,11 +567,13 @@ def normalize_hrefs(
564567
Args:
565568
root_href : The absolute HREF that all links will be normalized against.
566569
strategy : The layout strategy to use in setting the HREFS
567-
for this catalog. Defaults to :class:`~pystac.layout.BestPracticesLayoutStrategy`
570+
for this catalog. Defaults to
571+
:class:`~pystac.layout.BestPracticesLayoutStrategy`
568572
569573
See:
570-
:stac-spec:`STAC best practices document <best-practices.md#catalog-layout>` for the canonical layout of a STAC.
571-
""" # noqa E501
574+
:stac-spec:`STAC best practices document <best-practices.md#catalog-layout>`
575+
for the canonical layout of a STAC.
576+
"""
572577
if strategy is None:
573578
_strategy: HrefLayoutStrategy = BestPracticesLayoutStrategy()
574579
else:

pystac/extensions/eo.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ def apply(
6565
of accepted common names <eo#common-band-names>`.
6666
description : Description to fully explain the band.
6767
center_wavelength : The center wavelength of the band, in micrometers (μm).
68-
full_width_half_max : Full width at half maximum (FWHM). The width of the band,
69-
as measured at half the maximum transmission, in micrometers (μm).
68+
full_width_half_max : Full width at half maximum (FWHM). The width of the
69+
band, as measured at half the maximum transmission, in micrometers (μm).
7070
solar_illumination: The solar illumination of the band,
7171
as measured at half the maximum transmission, in W/m2/micrometers.
72-
""" # noqa
72+
"""
7373
self.name = name
7474
self.common_name = common_name
7575
self.description = description
@@ -97,11 +97,11 @@ def create(
9797
accepted common names <eo#common-band-names>`.
9898
description : Description to fully explain the band.
9999
center_wavelength : The center wavelength of the band, in micrometers (μm).
100-
full_width_half_max : Full width at half maximum (FWHM). The width of the band,
101-
as measured at half the maximum transmission, in micrometers (μm).
100+
full_width_half_max : Full width at half maximum (FWHM). The width of the
101+
band, as measured at half the maximum transmission, in micrometers (μm).
102102
solar_illumination: The solar illumination of the band,
103103
as measured at half the maximum transmission, in W/m2/micrometers.
104-
""" # noqa
104+
"""
105105
b = cls({})
106106
b.apply(
107107
name=name,
@@ -134,7 +134,7 @@ def common_name(self) -> Optional[str]:
134134
135135
Returns:
136136
Optional[str]
137-
""" # noqa
137+
"""
138138
return self.properties.get("common_name")
139139

140140
@common_name.setter
@@ -233,7 +233,7 @@ def band_range(common_name: str) -> Optional[Tuple[float, float]]:
233233
Returns:
234234
Tuple[float, float] or None: The band range for this name as (min, max), or
235235
None if this is not a recognized common name.
236-
""" # noqa E501
236+
"""
237237
name_to_range = {
238238
"coastal": (0.40, 0.45),
239239
"blue": (0.45, 0.50),
@@ -264,9 +264,9 @@ def band_description(common_name: str) -> Optional[str]:
264264
accepted common names <eo#common-band-names>`.
265265
266266
Returns:
267-
str or None: If a recognized common name, returns a description including the
268-
band range. Otherwise returns None.
269-
""" # noqa E501
267+
str or None: If a recognized common name, returns a description including
268+
the band range. Otherwise returns None.
269+
"""
270270
r = Band.band_range(common_name)
271271
if r is not None:
272272
return "Common name: {}, Range: {} to {}".format(common_name, r[0], r[1])

pystac/extensions/projection.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,14 @@ def transform(self) -> Optional[List[float]]:
220220
"""Get or sets the the affine transformation coefficients for the default grid.
221221
222222
The transform is a linear mapping from pixel coordinate space (Pixel, Line) to
223-
projection coordinate space (Xp, Yp). It is a 3x3 matrix stored as a flat array of 9
224-
elements in row major order. Since the last row is always 0,0,1 it can be omitted, in
225-
which case only 6 elements are recorded. This mapping can be obtained from
226-
GDAL `GetGeoTransform <https://gdal.org/api/gdaldataset_cpp.html#_CPPv4N11GDALDataset15GetGeoTransformEPd>`_
227-
or the
228-
Rasterio `Transform <https://rasterio.readthedocs.io/en/stable/api/rasterio.io.html#rasterio.io.BufferedDatasetWriter.transform>`_.
229-
""" # noqa: E501
223+
projection coordinate space (Xp, Yp). It is a 3x3 matrix stored as a flat array
224+
of 9 elements in row major order. Since the last row is always 0,0,1 it can be
225+
omitted, in which case only 6 elements are recorded. This mapping can be
226+
obtained from GDAL `GetGeoTransform <https://gdal.org/api/gdaldataset_cpp.html\
227+
#_CPPv4N11GDALDataset15GetGeoTransformEPd>`_
228+
or the Rasterio `Transform <https://rasterio.readthedocs.io/en/stable/api\
229+
/rasterio.io.html#rasterio.io.BufferedDatasetWriter.transform>`_.
230+
"""
230231
return self._get_property(TRANSFORM_PROP, List[float])
231232

232233
@transform.setter

pystac/extensions/raster.py

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def apply(
7575
mean : Mean value of all the pixels in the band.
7676
stddev : Standard Deviation value of all the pixels in the band.
7777
valid_percent : Percentage of valid (not nodata) pixel.
78-
""" # noqa
78+
"""
7979
self.minimum = minimum
8080
self.maximum = maximum
8181
self.mean = mean
@@ -100,7 +100,7 @@ def create(
100100
mean : Mean value of all the pixels in the band.
101101
stddev : Standard Deviation value of all the pixels in the band.
102102
valid_percent : Percentage of valid (not nodata) pixel.
103-
""" # noqa
103+
"""
104104
b = cls({})
105105
b.apply(
106106
minimum=minimum,
@@ -236,7 +236,7 @@ def apply(
236236
Also the mean value of the last bucket.
237237
buckets : Array of integer indicating the number
238238
of pixels included in the bucket.
239-
""" # noqa
239+
"""
240240
self.count = count
241241
self.min = min
242242
self.max = max
@@ -261,7 +261,7 @@ def create(
261261
Also the mean value of the last bucket.
262262
buckets : Array of integer indicating the number
263263
of pixels included in the bucket.
264-
""" # noqa
264+
"""
265265
b = cls({})
266266
b.apply(
267267
count=count,
@@ -370,22 +370,26 @@ def apply(
370370
371371
Args:
372372
nodata : Pixel values used to identify pixels that are nodata in the assets.
373-
sampling : One of area or point. Indicates whether a pixel value should be assumed
374-
to represent a sampling over the region of the pixel or a point sample at the center of the pixel.
373+
sampling : One of area or point. Indicates whether a pixel value should be
374+
assumed to represent a sampling over the region of the pixel or a point
375+
sample at the center of the pixel.
375376
data_type :The data type of the band.
376-
One of the data types as described in <https://github.com/stac-extensions/raster/#data-types>.
377+
One of the data types as described in
378+
<https://github.com/stac-extensions/raster/#data-types>.
377379
bits_per_sample : The actual number of bits used for this band.
378-
Normally only present when the number of bits is non-standard for the datatype,
379-
such as when a 1 bit TIFF is represented as byte
380-
spatial_resolution : Average spatial resolution (in meters) of the pixels in the band.
380+
Normally only present when the number of bits is non-standard for the
381+
datatype, such as when a 1 bit TIFF is represented as byte
382+
spatial_resolution : Average spatial resolution (in meters) of the pixels in
383+
the band.
381384
statistics: Statistics of all the pixels in the band
382385
unit: unit denomination of the pixel value
383386
scale: multiplicator factor of the pixel value to transform into the value
384387
(i.e. translate digital number to reflectance).
385-
offset: number to be added to the pixel value (after scaling) to transform into the value
386-
(i.e. translate digital number to reflectance).
387-
histogram: Histogram distribution information of the pixels values in the band
388-
""" # noqa
388+
offset: number to be added to the pixel value (after scaling) to transform
389+
into the value (i.e. translate digital number to reflectance).
390+
histogram: Histogram distribution information of the pixels values in the
391+
band
392+
"""
389393
self.nodata = nodata
390394
self.sampling = sampling
391395
self.data_type = data_type
@@ -416,22 +420,26 @@ def create(
416420
417421
Args:
418422
nodata : Pixel values used to identify pixels that are nodata in the assets.
419-
sampling : One of area or point. Indicates whether a pixel value should be assumed
420-
to represent a sampling over the region of the pixel or a point sample at the center of the pixel.
423+
sampling : One of area or point. Indicates whether a pixel value should be
424+
assumed to represent a sampling over the region of the pixel or a point
425+
sample at the center of the pixel.
421426
data_type :The data type of the band.
422-
One of the data types as described in <https://github.com/stac-extensions/raster/#data-types>.
427+
One of the data types as described in
428+
<https://github.com/stac-extensions/raster/#data-types>.
423429
bits_per_sample : The actual number of bits used for this band.
424-
Normally only present when the number of bits is non-standard for the datatype,
425-
such as when a 1 bit TIFF is represented as byte
426-
spatial_resolution : Average spatial resolution (in meters) of the pixels in the band.
430+
Normally only present when the number of bits is non-standard for the
431+
datatype, such as when a 1 bit TIFF is represented as byte
432+
spatial_resolution : Average spatial resolution (in meters) of the pixels in
433+
the band.
427434
statistics: Statistics of all the pixels in the band
428435
unit: unit denomination of the pixel value
429436
scale: multiplicator factor of the pixel value to transform into the value
430437
(i.e. translate digital number to reflectance).
431-
offset: number to be added to the pixel value (after scaling) to transform into the value
432-
(i.e. translate digital number to reflectance).
433-
histogram: Histogram distribution information of the pixels values in the band
434-
""" # noqa
438+
offset: number to be added to the pixel value (after scaling) to transform
439+
into the value (i.e. translate digital number to reflectance).
440+
histogram: Histogram distribution information of the pixels values in the
441+
band
442+
"""
435443
b = cls({})
436444
b.apply(
437445
nodata=nodata,
@@ -471,7 +479,7 @@ def sampling(self) -> Optional[Sampling]:
471479
472480
Returns:
473481
Optional[Sampling]
474-
""" # noqa
482+
"""
475483
return self.properties.get("sampling")
476484

477485
@sampling.setter

pystac/serialization/migrate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _get_removed_extension_migrations() -> Dict[
9999
]
100100
],
101101
],
102-
]: # noqa
102+
]:
103103
"""Handles removed extensions.
104104
105105
This does not handle renamed extension or extensions that were absorbed

tests/utils/test_cases.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
ARBITRARY_EXTENT = Extent(
7373
spatial=SpatialExtent.from_coordinates(ARBITRARY_GEOM["coordinates"]),
7474
temporal=TemporalExtent.from_now(),
75-
) # noqa: E126
75+
)
7676

7777

7878
class ExampleInfo:
@@ -206,8 +206,9 @@ def test_case_3() -> Catalog:
206206
def test_case_4() -> Catalog:
207207
"""Test case that is based on a local copy of the Tier 1 dataset from
208208
DrivenData's OpenCities AI Challenge.
209-
See: https://www.drivendata.org/competitions/60/building-segmentation-disaster-resilience
210-
""" # noqa
209+
See: https://www.drivendata.org/competitions/60/building-segmentation-disaster\
210+
-resilience
211+
"""
211212
return Catalog.from_file(
212213
TestCases.get_path("data-files/catalogs/test-case-4/catalog.json")
213214
)

0 commit comments

Comments
 (0)