Skip to content

Commit c03de1f

Browse files
authored
python: Fix typos and formatting of docstring parameters (OSGeo#4907)
* python: Fix typos and formatting of docstring parameters * Fix typo
1 parent 5bb9b2b commit c03de1f

18 files changed

+45
-75
lines changed

python/grass/imaging/images2gif.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ def getGraphicsControlExt(self, duration=0.1, dispose=2):
229229
230230
* 0 - No disposal specified.
231231
* 1 - Do not dispose. The graphic is to be left in place.
232-
* 2 - Restore to background color. The area used by the graphic
232+
* 2 - Restore to background color. The area used by the graphic
233233
must be restored to the background color.
234-
* 3 - Restore to previous. The decoder is required to restore the
234+
* 3 - Restore to previous. The decoder is required to restore the
235235
area overwritten by the graphic with what was there prior to
236236
rendering the graphic.
237237
* 4-7 -To be defined.
@@ -253,7 +253,6 @@ def handleSubRectangles(self, images, subRectangles):
253253
"""Handle the sub-rectangle stuff. If the rectangles are given by the
254254
user, the values are checked. Otherwise the subrectangles are
255255
calculated automatically.
256-
257256
"""
258257

259258
if isinstance(subRectangles, (tuple, list)):
@@ -400,9 +399,7 @@ def writeGifToFile(self, fp, images, durations, loops, xys, disposes):
400399
Requires different handling of palette for PIL and Pillow:
401400
based on https://github.com/rec/echomesh/blob/master/
402401
code/python/external/images2gif.py
403-
404402
"""
405-
406403
# Obtain palette for all images and count each occurrence
407404
palettes, occur = ([], [])
408405
for im in images:
@@ -538,7 +535,7 @@ def writeGifVisvis(
538535
integer types, and between 0 and 1 for float types.
539536
:param duration: scalar or list of scalars The duration for all frames, or
540537
(if a list) for each frame.
541-
:param repeat: bool or integer The amount of loops. If True, loops infinitetely.
538+
:param repeat: bool or integer The amount of loops. If True, loops infinitely.
542539
:param bool dither: whether to apply dithering
543540
:param int nq: If nonzero, applies the NeuQuant quantization algorithm to
544541
create the color palette. This algorithm is superior, but

python/grass/jupyter/utils.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,13 @@ def estimate_resolution(
309309
) -> float:
310310
"""Estimates resolution of reprojected raster.
311311
312-
:param str raster: name of raster
313-
:param str mapset: mapset of raster
314-
:param str location: name of source location
315-
:param str dbase: path to source database
312+
:param raster: name of raster
313+
:param mapset: mapset of raster
314+
:param location: name of source location
315+
:param dbase: path to source database
316316
:param dict env: target environment
317317
318-
:return float estimate: estimated resolution of raster in destination
319-
environment
318+
:return estimate: estimated resolution of raster in destination environment
320319
"""
321320
output = gs.read_command(
322321
"r.proj",

python/grass/pygrass/modules/grid/grid.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ def copy_groups(groups, gisrc_src, gisrc_dst, region=None):
163163
:param gisrc_dst: path of the GISRC file where the groups will be created
164164
:type gisrc_dst: str
165165
:param region: a region like object or a dictionary with the region
166-
parameters that will be used to crop the rasters of the
167-
groups
166+
parameters that will be used to crop the rasters of the groups
168167
:type region: Region object or dictionary
169168
:returns: None
170169
@@ -204,8 +203,7 @@ def set_region(region, gisrc_src, gisrc_dst, env):
204203
"""Set a region into two different mapsets.
205204
206205
:param region: a region like object or a dictionary with the region
207-
parameters that will be used to crop the rasters of the
208-
groups
206+
parameters that will be used to crop the rasters of the groups
209207
:type region: Region object or dictionary
210208
:param gisrc_src: path of the GISRC file from where we want to copy the groups
211209
:type gisrc_src: str
@@ -238,8 +236,7 @@ def copy_rasters(rasters, gisrc_src, gisrc_dst, region=None):
238236
:param gisrc_dst: path of the GISRC file where the groups will be created
239237
:type gisrc_dst: str
240238
:param region: a region like object or a dictionary with the region
241-
parameters that will be used to crop the rasters of the
242-
groups
239+
parameters that will be used to crop the rasters of the groups
243240
:type region: Region object or dictionary
244241
:returns: None
245242
"""
@@ -401,7 +398,7 @@ class GridModule:
401398
:param overlap: overlap between tiles, in pixel.
402399
:type overlap: int
403400
:param processes: number of threads, default value is equal to the number
404-
of processor available.
401+
of processors available.
405402
:param split: if True use r.tile to split all the inputs.
406403
:type split: bool
407404
:param mapset_prefix: if specified created mapsets start with this prefix

python/grass/pygrass/vector/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def write(self, geo_obj, cat=None, attrs=None):
127127
:param geo_obj: a geometry grass object define in
128128
grass.pygrass.vector.geometry
129129
:type geo_obj: geometry GRASS object
130-
:param attrs: a list with the values that will be insert in the
130+
:param attrs: a list with the values that will be inserted in the
131131
attribute table.
132132
:type attrs: list
133133
:param cat: The category of the geometry feature, otherwise the

python/grass/pygrass/vector/abstract.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,11 @@ def open(
337337
:param tab_name: define the name of the table that will be generate
338338
:type tab_name: str
339339
:param tab_cols: define the name and type of the columns of the
340-
attribute table of the vecto map
340+
attribute table of the vector map
341341
:type tab_cols: list of pairs
342-
:param link_name: define the name of the link connection with the
343-
database
342+
:param link_name: define the name of the link connection with the database
344343
:type link_name: str
345-
:param link_key: define the nema of the column that will be use as
344+
:param link_key: define the name of the column that will be use as
346345
vector category
347346
:type link_key: str
348347
:param link_db: define the database connection parameters

python/grass/pygrass/vector/geometry.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,7 @@ def buffer(
591591
:type angle: num
592592
:param round_: to make corners round
593593
:type round_: bool
594-
:param tol: fix the maximum distance between theoretical arc and
595-
output segments
594+
:param tol: fix the maximum distance between theoretical arc and output segments
596595
:type tol: float
597596
:returns: the buffer as Area object
598597
@@ -1048,11 +1047,9 @@ def reverse(self):
10481047
def segment(self, start, end):
10491048
"""Create line segment. using the ``Vect_line_segment`` C function.
10501049
1051-
:param start: distance from the beginning of the line where
1052-
the segment start
1050+
:param start: distance from the beginning of the line where the segment starts
10531051
:type start: float
1054-
:param end: distance from the beginning of the line where
1055-
the segment end
1052+
:param end: distance from the beginning of the line where the segment ends
10561053
:type end: float
10571054
10581055
::
@@ -1155,8 +1152,7 @@ def buffer(
11551152
:type angle: num
11561153
:param round_: to make corners round
11571154
:type round_: bool
1158-
:param tol: fix the maximum distance between theoretical arc and
1159-
output segments
1155+
:param tol: fix the maximum distance between theoretical arc and output segments
11601156
:type tol: float
11611157
:returns: the buffer as Area object
11621158
@@ -1717,8 +1713,7 @@ def buffer(
17171713
:type angle: num
17181714
:param round_: to make corners round
17191715
:type round_: bool
1720-
:param tol: fix the maximum distance between theoretical arc and
1721-
output segments
1716+
:param tol: fix the maximum distance between theoretical arc and output segments
17221717
:type tol: float
17231718
:returns: the buffer as line, centroid, isles object tuple
17241719

python/grass/pygrass/vector/table.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,8 +1121,7 @@ def drop(self, cursor=None, force=False):
11211121
:param cursor: the cursor to connect, if None it use the cursor
11221122
of connection table object
11231123
:type cursor: Cursor object
1124-
:param force: True to remove the table, by default False to print
1125-
advice
1124+
:param force: True to remove the table, by default False to print advice
11261125
:type force: bool
11271126
"""
11281127

@@ -1161,8 +1160,7 @@ def execute(self, sql_code=None, cursor=None, many=False, values=None):
11611160
"""Execute SQL code from a given string or build with filters and
11621161
return a cursor object.
11631162
1164-
:param sql_code: the SQL code to execute, if not pass it use filters
1165-
variable
1163+
:param sql_code: the SQL code to execute, if not pass it use filters variable
11661164
:type sql_code: str
11671165
:param cursor: the cursor to connect, if None it use the cursor
11681166
of connection table object

python/grass/script/raster.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ def raster_what(map, coord, env=None, localized=False):
218218
[{'elevation': {'color': '255:214:000', 'label': '', 'value': '102.479'}}]
219219
220220
:param str map: the map name
221-
:param list coord: a list of list containing all the point that you want
222-
query
221+
:param list coord: a list of list containing all the point that you want to query
223222
:param env:
224223
"""
225224
map_list = [map] if isinstance(map, (bytes, str)) else map

python/grass/temporal/abstract_dataset.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def get_number_of_relations(self):
7474
topologies must be build first using the SpatioTemporalTopologyBuilder.
7575
7676
:return: The dictionary with relations as keys and number as values or
77-
None in case the topology wasn't build
77+
None in case the topology wasn't built
7878
"""
7979
if self.is_temporal_topology_build() and not self.is_spatial_topology_build():
8080
return self.get_number_of_temporal_relations()
@@ -341,8 +341,7 @@ def get_spatial_extent_as_tuple(self):
341341
Top and bottom are set to 0 in case of a two dimensional spatial
342342
extent.
343343
344-
:return: A the spatial extent as tuple (north, south, east, west,
345-
top, bottom)
344+
:return: A the spatial extent as tuple (north, south, east, west, top, bottom)
346345
"""
347346
return self.spatial_extent.get_spatial_extent_as_tuple()
348347

python/grass/temporal/abstract_map_dataset.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ def split_name(name: str, layer=None, mapset=None):
176176
the keyword arguments.
177177
178178
:param name: The name of the map
179-
:param layer: The layer of the vector map, use None in case no
180-
layer exists
179+
:param layer: The layer of the vector map, use None in case no layer exists
181180
:param mapset: The mapset in which the map is located
182181
183182
:return: tuple of three elements name, layer, mapset e(:layer)@mapset" while
@@ -244,11 +243,9 @@ def build_id(name: str, mapset, layer=None) -> str:
244243
245244
:param name: The name of the map
246245
:param mapset: The mapset in which the map is located
247-
:param layer: The layer of the vector map, use None in case no
248-
layer exists
246+
:param layer: The layer of the vector map, use None in case no layer exists
249247
250-
:return: the id of the map as "name(:layer)@mapset" where layer is
251-
optional
248+
:return: the id of the map as "name(:layer)@mapset" where layer is optional
252249
"""
253250

254251
# Split given name into relevant parts
@@ -421,8 +418,7 @@ def set_absolute_time(self, start_time, end_time=None) -> bool:
421418
This method only modifies this object and does not commit
422419
the modifications to the temporal database.
423420
424-
:param start_time: A datetime object specifying the start time of
425-
the map
421+
:param start_time: A datetime object specifying the start time of the map
426422
:param end_time: A datetime object specifying the end time of the
427423
map, None in case or time instance
428424
@@ -512,8 +508,7 @@ def update_absolute_time(self, start_time, end_time=None, dbif=None) -> None:
512508
grass file system based database in addition to the temporal
513509
database entry.
514510
515-
:param start_time: A datetime object specifying the start time of
516-
the map
511+
:param start_time: A datetime object specifying the start time of the map
517512
:param end_time: A datetime object specifying the end time of the
518513
map, None in case or time instance
519514
:param dbif: The database interface to be used
@@ -669,8 +664,7 @@ def set_temporal_extent(self, extent) -> None:
669664
"""Convenient method to set the temporal extent from a temporal extent
670665
object
671666
672-
:param extent: The temporal extent that should be set for
673-
this object
667+
:param extent: The temporal extent that should be set for this object
674668
675669
.. code-block: : python
676670
@@ -853,8 +847,7 @@ def set_spatial_extent(self, spatial_extent) -> None:
853847
This method only modifies this object and does not commit
854848
the modifications to the temporal database.
855849
856-
:param spatial_extent: An object of type SpatialExtent or its
857-
subclasses
850+
:param spatial_extent: An object of type SpatialExtent or its subclasses
858851
859852
.. code-block: : python
860853

0 commit comments

Comments
 (0)