@@ -217,14 +217,14 @@ def func(arg1, arg2):
217217
218218 Example:
219219
220- >>> a= 1
221- >>> b= 2
222- >>> func(a,b)
220+ >>> a = 1
221+ >>> b = 2
222+ >>> func(a, b)
223223 True
224224 """
225225
226226 if arg1 == arg2:
227- raise ValueError (' arg1 must not be equal to arg2' )
227+ raise ValueError (" arg1 must not be equal to arg2" )
228228
229229 return True
230230```
@@ -575,7 +575,9 @@ If different subprocesses need different regions, use different environments:
575575
576576``` python
577577with gs.RegionManager(raster = input_raster, env = os.environ.copy()) as manager:
578- gs.run_command(" r.slope.aspect" , elevation = input_raster, slope = slope, env = manager.env)
578+ gs.run_command(
579+ " r.slope.aspect" , elevation = input_raster, slope = slope, env = manager.env
580+ )
579581```
580582
581583This approach makes the computational region completely safe for parallel
@@ -587,7 +589,7 @@ If you can't use a context manager, you can use `gs.use_temp_region()` and
587589``` python
588590gs.use_temp_region() # From now on, use a separate region in the script.
589591# Set the computational region with g.region as needed.
590- grass.run_command(' g.region' , raster = ' input' )
592+ grass.run_command(" g.region" , raster = " input" )
591593gs.del_temp_region()
592594# Original region applies now.
593595```
@@ -689,7 +691,6 @@ def remove(name):
689691 )
690692
691693
692-
693694def main ():
694695 temporary = gs.append_node_pid(" tmp_mapcalc" )
695696 atexit.register(remove, temporary)
@@ -707,13 +708,13 @@ Use gs.findfile() when there is a need to test if a map exists.
707708
708709``` python
709710# test for input raster map
710- result = gs.find_file(map_name, element = ' raster' )
711- if not result[' file' ]:
711+ result = gs.find_file(map_name, element = " raster" )
712+ if not result[" file" ]:
712713 gs.fatal(_(" Raster map <{} > not found" ).format(map_name))
713714
714715# test for input vector map
715- result = gs.find_file(map_name, element = ' vector' )
716- if not result[' file' ]:
716+ result = gs.find_file(map_name, element = " vector" )
717+ if not result[" file" ]:
717718 gs.fatal(_(" Vector map <{} > not found" ).format(map_name))
718719```
719720
@@ -922,7 +923,7 @@ def main():
922923 try :
923924 import pandas as pd # noqa: E402
924925 except ModuleNotFoundError :
925- gs.fatal(_(" Pandas library not installed" ))
926+ gs.fatal(_(" Pandas library not installed" ))
926927```
927928
928929#### Tool name
@@ -1011,9 +1012,9 @@ instead of constructing string from several parts (bad example):
10111012``` python
10121013# don't do this
10131014if ... :
1014- maplabel = ' raster map'
1015+ maplabel = " raster map"
10151016else :
1016- maplabel = ' 3D raster map'
1017+ maplabel = " 3D raster map"
10171018win.SetLabel(_(" Name for new {} to create" ).format(maplabel))
10181019```
10191020
@@ -1024,9 +1025,11 @@ string. The comment must start with GTC keyword and must be on a line before
10241025string:
10251026
10261027``` python
1027- self .bwizard = wx.Button(... ,
1028+ self .bwizard = wx.Button(
1029+ ... ,
10281030 # GTC New location
1029- label = _(" N&ew" ))
1031+ label = _(" N&ew" ),
1032+ )
10301033
10311034# GTC %s will be replaced with name of current shell
10321035gs.message(_(" Running through {} " ).format(shellname))
0 commit comments