Skip to content

Commit

Permalink
Pyton code: Use new-style classes (OSGeo#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
bje- authored and rouault committed Apr 29, 2018
1 parent 0d223db commit 075cbe8
Show file tree
Hide file tree
Showing 38 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion autotest/gcore/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def basic_test_9():
# Test gdal.PushErrorHandler() with a Python error handler as a method (#5186)


class my_python_error_handler_class:
class my_python_error_handler_class(object):
def __init__(self):
self.eErrClass = None
self.err_no = None
Expand Down
2 changes: 1 addition & 1 deletion autotest/gcore/hfa_srs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
###############################################################################
# Write a HFA/Imagine and read it back to check its SRS

class TestHFASRS:
class TestHFASRS(object):
def __init__(self, epsg_code, use_epsg_code, expected_fail):
self.epsg_code = epsg_code
self.use_epsg_code = use_epsg_code
Expand Down
2 changes: 1 addition & 1 deletion autotest/gcore/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def misc_5():


###############################################################################
class misc_6_interrupt_callback_class:
class misc_6_interrupt_callback_class(object):
def __init__(self):
pass

Expand Down
2 changes: 1 addition & 1 deletion autotest/gcore/tiff_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -2901,7 +2901,7 @@ def tiff_read_gcp_internal_and_auxxml():
# Test reading .tif + .aux


class myHandlerClass:
class myHandlerClass(object):
def __init__(self):
self.msg = None

Expand Down
2 changes: 1 addition & 1 deletion autotest/gcore/tiff_srs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
###############################################################################
# Write a geotiff and read it back to check its SRS

class TestTiffSRS:
class TestTiffSRS(object):
def __init__(self, epsg_code, use_epsg_code, expected_fail):
self.epsg_code = epsg_code
self.use_epsg_code = use_epsg_code
Expand Down
4 changes: 2 additions & 2 deletions autotest/gcore/vsis3.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def method(request):
# Test temporary redirect
handler = webserver.SequentialHandler()

class HandlerClass:
class HandlerClass(object):
def __init__(self, response_value):
self.old_authorization = None
self.response_value = response_value
Expand Down Expand Up @@ -936,7 +936,7 @@ def method(request):
# Test temporary redirect
handler = webserver.SequentialHandler()

class HandlerClass:
class HandlerClass(object):
def __init__(self, response_value):
self.old_authorization = None
self.response_value = response_value
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/envisat.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _get_mds_num(filename):
#


class TestEnvisat:
class TestEnvisat(object):
# Just a base class

def __init__(self, downloadURL, fileName, size, checksum):
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#


class TestFIT:
class TestFIT(object):
def __init__(self, fileName):
self.fileName = fileName
self.fitDriver = gdal.GetDriverByName('FIT')
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def fits_init():
#


class TestFITS:
class TestFITS(object):
def __init__(self, fileName):
self.fileName = fileName

Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/gxf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def gxf_2():
#


class TestGXF:
class TestGXF(object):
def __init__(self, downloadURL, fileName, checksum, download_size):
self.downloadURL = downloadURL
self.fileName = fileName
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def hdf5_17():
return 'success'


class TestHDF5:
class TestHDF5(object):
def __init__(self, downloadURL, fileName, subdatasetname, checksum, download_size):
self.downloadURL = downloadURL
self.fileName = fileName
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

###############################################################################
#
class TestL1B:
class TestL1B(object):
def __init__(self, downloadURL, fileName, checksum, download_size, gcpNumber):
self.downloadURL = downloadURL
self.fileName = fileName
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/mrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def mrf_cleanup():
gdaltest_list = []


class myTestCreateCopyWrapper:
class myTestCreateCopyWrapper(object):

def __init__(self, ut):
self.ut = ut
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/netcdf_cfchecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def chkDerivedName(name):
# ======================
# Checking class
# ======================
class CFChecker:
class CFChecker(object):

def __init__(self, uploader=None, useFileName="yes", badc=None, coards=None, cfStandardNamesXML=None, cfAreaTypesXML=None, udunitsDat=None, version=newest_version):
self.uploader = uploader
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/xmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#


class TestXMPRead:
class TestXMPRead(object):
def __init__(self, drivername, filename, expect_xmp):
self.drivername = drivername
self.filename = filename
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/xpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

###############################################################################
#
class TestXPM:
class TestXPM(object):
def __init__(self, downloadURL, fileName, checksum, download_size):
self.downloadURL = downloadURL
self.fileName = fileName
Expand Down
2 changes: 1 addition & 1 deletion autotest/ogr/ogr_gml_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
###############################################################################


class gml_geom_unit:
class gml_geom_unit(object):
def __init__(self, unit):
self.unit = unit

Expand Down
2 changes: 1 addition & 1 deletion autotest/ogr/ogr_gmlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def ogr_gmlas_abstractgeometry():
# Test validation against schema


class MyHandler:
class MyHandler(object):
def __init__(self):
self.error_list = []

Expand Down
2 changes: 1 addition & 1 deletion autotest/ogr/ogr_wkbwkt_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
###############################################################################


class wkb_wkt_unit:
class wkb_wkt_unit(object):
def __init__(self, unit):
self.unit = unit

Expand Down
2 changes: 1 addition & 1 deletion autotest/ogr/ogr_wktempty.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from osgeo import ogr


class TestWktEmpty:
class TestWktEmpty(object):
def __init__(self, inString, expectedOutString):
self.inString = inString
self.expectedOutString = expectedOutString
Expand Down
2 changes: 1 addition & 1 deletion autotest/osr/osr_ct_proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# Class to perform the tests.


class ProjTest:
class ProjTest(object):
def __init__(self, src_srs, src_xyz, src_error,
dst_srs, dst_xyz, dst_error, options, requirements):
self.src_srs = src_srs
Expand Down
2 changes: 1 addition & 1 deletion autotest/osr/osr_metacrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# Class to perform the tests.


class MetaCRSTest:
class MetaCRSTest(object):
def __init__(self, test_line):
self.test_line = test_line
self.src_xyz = None
Expand Down
2 changes: 1 addition & 1 deletion autotest/pymod/gdaltest.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def testCreateCopyInterruptCallback(pct, message, user_data):
###############################################################################


class GDALTest:
class GDALTest(object):
def __init__(self, drivername, filename, band, chksum,
xoff=0, yoff=0, xsize=0, ysize=0, options=None,
filename_absolute=0, chksum_after_reopening=None, open_options=None):
Expand Down
6 changes: 3 additions & 3 deletions autotest/pymod/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def install_http_handler(handler_instance):
custom_handler = None


class RequestResponse:
class RequestResponse(object):
def __init__(self, method, path, code, headers=None, body=None, custom_method=None, expected_headers=None, expected_body=None):
self.method = method
self.path = path
Expand All @@ -67,7 +67,7 @@ def __init__(self, method, path, code, headers=None, body=None, custom_method=No
self.expected_body = expected_body


class FileHandler:
class FileHandler(object):
def __init__(self, _dict):
self.dict = _dict

Expand Down Expand Up @@ -108,7 +108,7 @@ def do_GET(self, request):
request.wfile.write(filedata[start:end])


class SequentialHandler:
class SequentialHandler(object):
def __init__(self):
self.req_count = 0
self.req_resp = []
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/include/python/docs/doxy2swig.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def my_open_write(dest):
return open(dest, 'w')


class Doxy2SWIG:
class Doxy2SWIG(object):
"""Converts Doxygen generated XML files into a file containing
docstrings that can be used by SWIG-1.3.x that have support for
feature("docstring"). Once the data is parsed it is stored in
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/samples/build_jp2_from_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def parse_jp2file(inpath, xml_tree, out_f):
# Wrapper class for GDAL VSI*L API with class Python file interface


class VSILFile:
class VSILFile(object):
def __init__(self, filename, access):
self.f = gdal.VSIFOpenL(filename, access)

Expand Down
4 changes: 2 additions & 2 deletions gdal/swig/python/samples/gdal_cp.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def Usage():
return -1


class TermProgress:
class TermProgress(object):
def __init__(self):
self.nLastTick = -1
self.nThisTick = 0
Expand Down Expand Up @@ -79,7 +79,7 @@ def Progress(self, dfComplete, message):
return True


class ScaledProgress:
class ScaledProgress(object):
def __init__(self, dfMin, dfMax, UnderlyingProgress):
self.dfMin = dfMin
self.dfMax = dfMax
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/samples/gdal_vrtmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def names_to_fileinfos(names):
# *****************************************************************************


class file_info:
class file_info(object):
"""A class holding information about a GDAL file."""

def __init__(self):
Expand Down
4 changes: 2 additions & 2 deletions gdal/swig/python/samples/gdalpythonserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from osgeo import gdal


class GDALPythonServerRasterBand:
class GDALPythonServerRasterBand(object):

def __init__(self, gdal_band):
self.gdal_band = gdal_band
Expand Down Expand Up @@ -124,7 +124,7 @@ def GetHistogram(self, dfMin, dfMax, nBuckets, bIncludeOutOfRange, bApproxOK):
return self.gdal_band.GetHistogram(dfMin, dfMax, nBuckets, include_out_of_range=bIncludeOutOfRange, approx_ok=bApproxOK)


class GDALPythonServerDataset:
class GDALPythonServerDataset(object):

def __init__(self, filename, access=gdal.GA_ReadOnly, open_options=None):
nFlags = 0
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/samples/loslas2ntv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# dummy object to hold options


class Options:
class Options(object):
def __init__(self):
self.verbose_flag = 0
self.append = 0
Expand Down
6 changes: 3 additions & 3 deletions gdal/swig/python/samples/ogr2ogr.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
###############################################################################


class ScaledProgressObject:
class ScaledProgressObject(object):
def __init__(self, min, max, cbk, cbk_data=None):
self.min = min
self.max = max
Expand Down Expand Up @@ -107,7 +107,7 @@ def TermProgress(dfComplete, pszMessage, pProgressArg):
return True


class TargetLayerInfo:
class TargetLayerInfo(object):
def __init__(self):
self.poDstLayer = None
self.poCT = None
Expand All @@ -116,7 +116,7 @@ def __init__(self):
self.iSrcZField = None


class AssociatedLayers:
class AssociatedLayers(object):
def __init__(self):
self.poSrcLayer = None
self.psInfo = None
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/samples/ogr_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def wkbFlatten(x):
###############################################################


class Options:
class Options(object):
def __init__(self):
self.lco = []
self.dispatch_fields = []
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/samples/tigerpoly.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@


#############################################################################
class Module:
class Module(object):

def __init__(self):
self.lines = {}
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/samples/validate_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class GPKGCheckException(Exception):
pass


class GPKGChecker:
class GPKGChecker(object):

EXT_GEOM_TYPES = ('CIRCULARSTRING', 'COMPOUNDCURVE', 'CURVEPOLYGON',
'MULTICURVE', 'MULTISURFACE', 'CURVE', 'SURFACE')
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/samples/validate_jp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def get_gmljp2(filename):
return mdd[0]


class ErrorReport:
class ErrorReport(object):
def __init__(self, collect_internally=False):
self.error_count = 0
self.warning_count = 0
Expand Down
2 changes: 1 addition & 1 deletion gdal/swig/python/scripts/gdal_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def names_to_fileinfos(names):
# *****************************************************************************


class file_info:
class file_info(object):
"""A class holding information about a GDAL file."""

def __init__(self):
Expand Down
Loading

0 comments on commit 075cbe8

Please sign in to comment.