Skip to content

Commit

Permalink
autotest: fix whole testsuite (yes \!) for all pyflakes errors
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/gdal/trunk@28394 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
rouault committed Jan 31, 2015
1 parent 11ab6f3 commit 7bd30f9
Show file tree
Hide file tree
Showing 309 changed files with 1,801 additions and 2,974 deletions.
1 change: 0 additions & 1 deletion autotest/alg/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from osgeo import gdal
from osgeo import ogr
import gdaltest
import ogrtest
import array

###############################################################################
Expand Down
3 changes: 0 additions & 3 deletions autotest/alg/cutline.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

from osgeo import gdal

import ogrtest
import gdaltest

Expand Down
3 changes: 1 addition & 2 deletions autotest/alg/dither.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest

from osgeo import gdal, gdalconst
from osgeo import gdal

###############################################################################
# Test
Expand Down
31 changes: 13 additions & 18 deletions autotest/alg/polygonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,20 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest
import ogrtest

from osgeo import gdal, gdalconst, ogr
from osgeo import gdal, ogr

###############################################################################
# Test a fairly simple case, with nodata masking.

def polygonize_1():

try:
x = gdal.Polygonize
gdaltest.have_ng = 1
except:
gdaltest.have_ng = 0
return 'skip'

src_ds = gdal.Open('data/polygonize_in.grd')
src_band = src_ds.GetRasterBand(1)

Expand All @@ -65,6 +57,9 @@ def polygonize_1():

# run the algorithm.
result = gdal.Polygonize( src_band, src_band.GetMaskBand(), mem_layer, 0 )
if result != 0:
gdaltest.post_reason( 'Polygonize failed' )
return 'fail'

# Confirm we get the set of expected features in the output layer.

Expand Down Expand Up @@ -96,9 +91,6 @@ def polygonize_1():

def polygonize_2():

if not gdaltest.have_ng:
return 'skip'

src_ds = gdal.Open('data/polygonize_in.grd')
src_band = src_ds.GetRasterBand(1)

Expand All @@ -113,6 +105,9 @@ def polygonize_2():

# run the algorithm.
result = gdal.Polygonize( src_band, None, mem_layer, 0 )
if result != 0:
gdaltest.post_reason( 'Polygonize failed' )
return 'fail'

# Confirm we get the set of expected features in the output layer.

Expand All @@ -136,9 +131,6 @@ def polygonize_2():

def polygonize_3():

if not gdaltest.have_ng:
return 'skip'

src_ds = gdal.Open('data/polygonize_in_2.grd')
src_band = src_ds.GetRasterBand(1)

Expand All @@ -153,6 +145,9 @@ def polygonize_3():

# run the algorithm.
result = gdal.Polygonize( src_band, None, mem_layer, 0 )
if result != 0:
gdaltest.post_reason( 'Polygonize failed' )
return 'fail'

# Confirm we get the expected count of features.

Expand Down Expand Up @@ -182,9 +177,6 @@ def polygonize_3():

def polygonize_4():

if not gdaltest.have_ng:
return 'skip'

src_ds = gdal.Open('data/polygonize_in.grd')
src_band = src_ds.GetRasterBand(1)

Expand All @@ -199,6 +191,9 @@ def polygonize_4():

# run the algorithm.
result = gdal.Polygonize( src_band, None, mem_layer, 0, ["8CONNECTED=8"] )
if result != 0:
gdaltest.post_reason( 'Polygonize failed' )
return 'fail'

# Confirm we get the set of expected features in the output layer.

Expand Down
17 changes: 1 addition & 16 deletions autotest/alg/proximity.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,19 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest

from osgeo import gdal, gdalconst
from osgeo import gdal

###############################################################################
# Test a fairly default case.

def proximity_1():

try:
x = gdal.ComputeProximity
gdaltest.have_ng = 1
except:
gdaltest.have_ng = 0
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('data/pat.tif')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -80,13 +72,6 @@ def proximity_1():

def proximity_2():

try:
x = gdal.ComputeProximity
gdaltest.have_ng = 1
except:
gdaltest.have_ng = 0
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('data/pat.tif')
src_band = src_ds.GetRasterBand(1)
Expand Down
4 changes: 1 addition & 3 deletions autotest/alg/rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest
import ogrtest

from osgeo import gdal, gdalconst, ogr, osr
from osgeo import gdal, ogr, osr

###############################################################################
# Simple polygon rasterization.
Expand Down Expand Up @@ -108,7 +107,6 @@ def rasterize_2():

# Setup working spatial reference
sr_wkt = 'LOCAL_CS["arbitrary"]'
sr = osr.SpatialReference( sr_wkt )

# Create a memory raster to rasterize into.

Expand Down
13 changes: 1 addition & 12 deletions autotest/alg/reproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,19 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest

from osgeo import gdal, gdalconst, osr
from osgeo import gdal, osr

###############################################################################
# Test a trivial case.

def reproject_1():

try:
x = gdal.ReprojectImage
except:
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('../gcore/data/byte.tif')

Expand Down Expand Up @@ -76,11 +70,6 @@ def reproject_1():

def reproject_2():

try:
x = gdal.ReprojectImage
except:
return 'skip'

sr = osr.SpatialReference()
sr.ImportFromEPSG(32611)

Expand Down
29 changes: 1 addition & 28 deletions autotest/alg/sieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,19 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest

from osgeo import gdal, gdalconst
from osgeo import gdal

###############################################################################
# Test a fairly default case.

def sieve_1():

try:
x = gdal.SieveFilter
except:
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('data/sieve_src.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -79,12 +73,6 @@ def sieve_1():

def sieve_2():


try:
x = gdal.SieveFilter
except:
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('data/sieve_src.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -116,11 +104,6 @@ def sieve_2():

def sieve_3():

try:
x = gdal.SieveFilter
except:
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('data/unmergable.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -152,11 +135,6 @@ def sieve_3():

def sieve_4():

try:
x = gdal.SieveFilter
except:
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('data/sieve_2634.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down Expand Up @@ -190,11 +168,6 @@ def sieve_4():

def sieve_5():

try:
x = gdal.SieveFilter
except:
return 'skip'

drv = gdal.GetDriverByName( 'GTiff' )
src_ds = gdal.Open('data/sieve_src.grd')
src_band = src_ds.GetRasterBand(1)
Expand Down
3 changes: 1 addition & 2 deletions autotest/alg/tps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )
Expand Down Expand Up @@ -57,7 +56,7 @@ def tps_1():
transformer = gdal.Transformer(ds, None,
['DST_SRS='+utm_wkt,
'METHOD=GCP_TPS'] )
if gdal.GetLastErrorType() == 0:
if transformer is None or gdal.GetLastErrorType() == 0:
return 'fail'

return 'success'
Expand Down
1 change: 0 additions & 1 deletion autotest/alg/transformgeoloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )
Expand Down
2 changes: 0 additions & 2 deletions autotest/gcore/aaigrid_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@
# Boston, MA 02111-1307, USA.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest
from osgeo import gdal

###############################################################################
# When imported build a list of units based on the files available.
Expand Down
2 changes: 0 additions & 2 deletions autotest/gcore/aaigrid_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@
# Boston, MA 02111-1307, USA.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )

import gdaltest
from osgeo import gdal

###############################################################################
# When imported build a list of units based on the files available.
Expand Down
1 change: 0 additions & 1 deletion autotest/gcore/asyncreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# DEALINGS IN THE SOFTWARE.
###############################################################################

import os
import sys

sys.path.append( '../pymod' )
Expand Down
2 changes: 1 addition & 1 deletion autotest/gcore/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def basic_test_6():

def basic_test_7_internal():
try:
ds = gdal.Open('non_existing_ds', gdal.GA_ReadOnly)
gdal.Open('non_existing_ds', gdal.GA_ReadOnly)
gdaltest.post_reason('opening should have thrown an exception')
return 'fail'
except:
Expand Down
Loading

0 comments on commit 7bd30f9

Please sign in to comment.