Skip to content

Commit 7f97a3f

Browse files
committedNov 11, 2024
remove Python2 crumbs
1 parent 6b9549e commit 7f97a3f

34 files changed

+56
-63
lines changed
 

‎autotest/conftest.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# coding: utf-8
2-
from __future__ import absolute_import, division, print_function
3-
42
import os
53
import sys
64

‎autotest/gcore/basic_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def test_basic_test_9():
222222
# Test gdal.PushErrorHandler() with a Python error handler as a method (#5186)
223223

224224

225-
class my_python_error_handler_class(object):
225+
class my_python_error_handler_class:
226226
def __init__(self):
227227
self.eErrClass = None
228228
self.err_no = None

‎autotest/gcore/cog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def my_cbk(pct, _, arg):
559559
filename2 = directory + "/cog2.tif"
560560
src_ds = gdal.Open(filename)
561561

562-
class my_error_handler(object):
562+
class my_error_handler:
563563
def __init__(self):
564564
self.debug_msg_list = []
565565
self.other_msg_list = []

‎autotest/gcore/misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test_misc_5():
254254

255255

256256
###############################################################################
257-
class misc_6_interrupt_callback_class(object):
257+
class misc_6_interrupt_callback_class:
258258
def __init__(self):
259259
pass
260260

‎autotest/gcore/tiff_read.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3266,7 +3266,7 @@ def test_tiff_read_gcp_internal_and_auxxml(
32663266
# Test reading .tif + .aux
32673267

32683268

3269-
class myHandlerClass(object):
3269+
class myHandlerClass:
32703270
def __init__(self):
32713271
self.msg = None
32723272

‎autotest/gcore/vsis3.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ def method(request):
893893
# Test temporary redirect
894894
handler = webserver.SequentialHandler()
895895

896-
class HandlerClass(object):
896+
class HandlerClass:
897897
def __init__(self, response_value):
898898
self.old_authorization = None
899899
self.response_value = response_value
@@ -1484,7 +1484,7 @@ def method(request):
14841484
# Test temporary redirect
14851485
handler = webserver.SequentialHandler()
14861486

1487-
class HandlerClass(object):
1487+
class HandlerClass:
14881488
def __init__(self, response_value):
14891489
self.old_authorization = None
14901490
self.response_value = response_value

‎autotest/gdrivers/envisat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _get_mds_num(filename):
6060
#
6161

6262

63-
class EnvisatTestBase(object):
63+
class EnvisatTestBase:
6464
# Just a base class
6565

6666
def download_file(self):

‎autotest/ogr/data/pydrivers/ogr_DUMMY.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
from gdal_python_driver import BaseDataset, BaseDriver, BaseLayer
2626
except ImportError:
2727
# To be able to run in standalone mode
28-
class BaseDriver(object):
28+
class BaseDriver:
2929
pass
3030

31-
class BaseDataset(object):
31+
class BaseDataset:
3232
pass
3333

34-
class BaseLayer(object):
34+
class BaseLayer:
3535
pass
3636

3737

‎autotest/ogr/ogr_gmlas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def test_ogr_gmlas_abstractgeometry():
582582
# Test validation against schema
583583

584584

585-
class MyHandler(object):
585+
class MyHandler:
586586
def __init__(self):
587587
self.error_list = []
588588

‎autotest/pymod/gdaltest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def testCreateCopyInterruptCallback(pct, message, user_data):
7474
###############################################################################
7575

7676

77-
class GDALTest(object):
77+
class GDALTest:
7878
def __init__(
7979
self,
8080
drivername,

‎autotest/pymod/webserver.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def install_http_handler(handler_instance):
3939
custom_handler = None
4040

4141

42-
class RequestResponse(object):
42+
class RequestResponse:
4343
def __init__(
4444
self,
4545
method,
@@ -76,7 +76,7 @@ def __repr__(self):
7676
)
7777

7878

79-
class FileHandler(object):
79+
class FileHandler:
8080
"""
8181
Handler that serves files from a dictionary and/or a fallback VSI location.
8282
"""
@@ -197,7 +197,7 @@ def do_DELETE(self, request):
197197
self.send_response(request, filedata)
198198

199199

200-
class BaseMockedHttpHandler(object):
200+
class BaseMockedHttpHandler:
201201
@staticmethod
202202
def _process_req_resp(req_resp, request):
203203
if req_resp.custom_method:

‎autotest/utilities/test_gdalbuildvrt_lib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def test_gdalbuildvrt_lib_bandList_subset_of_bands_from_multiple_band_source():
604604

605605
###############################################################################
606606
def test_gdalbuildvrt_lib_warnings_and_custom_error_handler():
607-
class GdalErrorHandler(object):
607+
class GdalErrorHandler:
608608
def __init__(self):
609609
self.got_failure = False
610610
self.got_warning = False

‎autotest/utilities/test_gdaltindex_lib.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_gdaltindex_lib_basic(four_tile_index):
9292

9393

9494
def test_gdaltindex_lib_already_existing_rasters(four_tiles, four_tile_index, tmp_path):
95-
class GdalErrorHandler(object):
95+
class GdalErrorHandler:
9696
def __init__(self):
9797
self.warnings = []
9898

@@ -147,7 +147,7 @@ def test_gdaltindex_skipDifferentProjection(tmp_path, four_tile_index):
147147
ds.SetGeoTransform([47, 0.1, 0, 2, 0, -0.1])
148148
ds = None
149149

150-
class GdalErrorHandler(object):
150+
class GdalErrorHandler:
151151
def __init__(self):
152152
self.warning = None
153153

‎doc/source/api/python_gotchas.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ But you can do something like this instead:
232232
233233
from osgeo import gdal
234234
235-
class GdalErrorHandler(object):
235+
class GdalErrorHandler:
236236
def __init__(self):
237237
self.err_level = gdal.CE_None
238238
self.err_no = 0

‎doc/source/drivers/raster/vrt.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ Given the following :file:`mandelbrot.py` file :
16301630
#print('Using numba')
16311631
g_max_iterations = 100
16321632
except Exception:
1633-
class jit(object):
1633+
class jit:
16341634
def __init__(self, nopython = True, nogil = True):
16351635
pass
16361636

‎examples/pydrivers/ogr_DUMMY.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
from gdal_python_driver import BaseDataset, BaseDriver, BaseLayer
2525
except ImportError:
2626
# To be able to run in standalone mode
27-
class BaseDriver(object):
27+
class BaseDriver:
2828
pass
2929

30-
class BaseDataset(object):
30+
class BaseDataset:
3131
pass
3232

33-
class BaseLayer(object):
33+
class BaseLayer:
3434
pass
3535

3636

‎examples/pydrivers/ogr_PASSTHROUGH.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@
2323
from gdal_python_driver import BaseDataset, BaseDriver, BaseLayer
2424
except ImportError:
2525
# To be able to run in standalone mode
26-
class BaseDriver(object):
26+
class BaseDriver:
2727
pass
2828

29-
class BaseDataset(object):
29+
class BaseDataset:
3030
pass
3131

32-
class BaseLayer(object):
32+
class BaseLayer:
3333
RandomRead = "RandomRead"
3434
FastSpatialFilter = "FastSpatialFilter"
3535
FastFeatureCount = "FastFeatureCount"
3636
FastGetExtent = "FastGetExtent"
3737
StringsAsUTF8 = "StringsAsUTF8"
38-
pass
3938

4039

4140
class Layer(BaseLayer):

‎gcore/gdalpythondriverloader.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static bool InitializePythonAndLoadGDALPythonDriverModule()
126126
"import json\n"
127127
"import inspect\n"
128128
"import sys\n"
129-
"class BaseLayer(object):\n"
129+
"class BaseLayer:\n"
130130
" RandomRead='RandomRead'\n"
131131
" FastSpatialFilter='FastSpatialFilter'\n"
132132
" FastFeatureCount='FastFeatureCount'\n"
@@ -141,11 +141,11 @@ static bool InitializePythonAndLoadGDALPythonDriverModule()
141141
"BaseLayer'\n"
142142
" return _gdal_python_driver.layer_featureCount(self, force)\n"
143143
"\n"
144-
"class BaseDataset(object):\n"
144+
"class BaseDataset:\n"
145145
" def __init__(self):\n"
146146
" pass\n"
147147
"\n"
148-
"class BaseDriver(object):\n"
148+
"class BaseDriver:\n"
149149
" def __init__(self):\n"
150150
" pass\n"
151151
"\n"

‎scripts/generate_log_feature_release.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
)
2121

2222

23-
class Commit(object):
23+
class Commit:
2424
def __init__(self):
2525
self.metadata = ""
2626
self.message = ""

‎swig/include/python/python_exceptions.i

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static void popErrorHandler()
293293
}
294294

295295
%pythoncode %{
296-
class ExceptionMgr(object):
296+
class ExceptionMgr:
297297
"""
298298
Context manager to manage Python Exception state
299299
for GDAL/OGR/OSR/GNM.

‎swig/python/gdal-utils/osgeo_utils/gdal2tiles.py

+9-11
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
# SPDX-License-Identifier: MIT
2121
# ******************************************************************************
2222

23-
from __future__ import division
24-
2523
import contextlib
2624
import glob
2725
import json
@@ -129,7 +127,7 @@ class UnsupportedTileMatrixSet(Exception):
129127
pass
130128

131129

132-
class TileMatrixSet(object):
130+
class TileMatrixSet:
133131
def __init__(self) -> None:
134132
self.identifier = None
135133
self.srs = None
@@ -328,7 +326,7 @@ def get_profile_list():
328326
MAXZOOMLEVEL = 32
329327

330328

331-
class GlobalMercator(object):
329+
class GlobalMercator:
332330
r"""
333331
TMS Global Mercator Profile
334332
---------------------------
@@ -547,7 +545,7 @@ def QuadTree(self, tx, ty, zoom):
547545
return quadKey
548546

549547

550-
class GlobalGeodetic(object):
548+
class GlobalGeodetic:
551549
r"""
552550
TMS Global Geodetic Profile
553551
---------------------------
@@ -644,7 +642,7 @@ def TileLatLonBounds(self, tx, ty, zoom):
644642
return (b[1], b[0], b[3], b[2])
645643

646644

647-
class Zoomify(object):
645+
class Zoomify:
648646
"""
649647
Tiles compatible with the Zoomify viewer
650648
----------------------------------------
@@ -2126,7 +2124,7 @@ def options_post_processing(
21262124
return options
21272125

21282126

2129-
class TileDetail(object):
2127+
class TileDetail:
21302128
tx = 0
21312129
ty = 0
21322130
tz = 0
@@ -2155,7 +2153,7 @@ def __repr__(self):
21552153
return "TileDetail %s\n%s\n%s\n" % (self.tx, self.ty, self.tz)
21562154

21572155

2158-
class TileJobInfo(object):
2156+
class TileJobInfo:
21592157
"""
21602158
Plain object to hold tile job configuration for a dataset
21612159
"""
@@ -2196,7 +2194,7 @@ class Gdal2TilesError(Exception):
21962194
pass
21972195

21982196

2199-
class GDAL2Tiles(object):
2197+
class GDAL2Tiles:
22002198
def __init__(self, input_file: str, output_folder: str, options: Options) -> None:
22012199
"""Constructor function - initialization"""
22022200
self.out_drv = None
@@ -4463,7 +4461,7 @@ def worker_tile_details(
44634461
return tile_job_info, tile_details
44644462

44654463

4466-
class ProgressBar(object):
4464+
class ProgressBar:
44674465
def __init__(self, total_items: int, progress_cbk=gdal.TermProgress_nocb) -> None:
44684466
self.total_items = total_items
44694467
self.nb_items_done = 0
@@ -4632,7 +4630,7 @@ def multi_threaded_tiling(
46324630
shutil.rmtree(os.path.dirname(conf.src_file))
46334631

46344632

4635-
class DividedCache(object):
4633+
class DividedCache:
46364634
def __init__(self, nb_processes):
46374635
self.nb_processes = nb_processes
46384636

‎swig/python/gdal-utils/osgeo_utils/gdal_merge.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def names_to_fileinfos(names):
219219
# *****************************************************************************
220220

221221

222-
class file_info(object):
222+
class file_info:
223223
"""A class holding information about a GDAL file."""
224224

225225
def __init__(self):

0 commit comments

Comments
 (0)
Please sign in to comment.