Skip to content

Commit 2d52ed3

Browse files
committed
Apply suggestions from code review
1 parent 01ed5b5 commit 2d52ed3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

python/PyQt6/core/__init__.py.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,8 @@ try:
742742

743743
QgsGeometry.as_shapely = _geometry_as_shapely
744744

745-
def _geometry_from_shapely(shapely_geom) -> QgsGeometry:
745+
@staticmethod
746+
def _geometry_from_shapely(shapely_geom: _sg.base.BaseGeometry) -> QgsGeometry:
746747
geom = QgsGeometry()
747748
geom.fromWkb(shapely_geom.wkb)
748749

@@ -756,7 +757,8 @@ except ModuleNotFoundError:
756757

757758
QgsGeometry.as_shapely = _geometry_as_shapely
758759

759-
def _geometry_from_shapely(self):
760+
@staticmethod
761+
def _geometry_from_shapely(shapely_geom):
760762
raise QgsNotSupportedException('QgsGeometry.from_shapely is not available, shapely is not installed on the system')
761763

762764
QgsGeometry.from_shapely = _geometry_from_shapely
@@ -805,5 +807,5 @@ Creates a new geometry from a shapely object.
805807

806808
:raises QgsNotSupportedException: if shapely is not available on the system
807809

808-
.. versionadded:: 3.42
810+
.. versionadded:: 3.44
809811
"""

python/core/__init__.py.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,8 @@ try:
753753

754754
QgsGeometry.as_shapely = _geometry_as_shapely
755755

756-
def _geometry_from_shapely(shapely_geom) -> QgsGeometry:
756+
@staticmethod
757+
def _geometry_from_shapely(shapely_geom: _sg.base.BaseGeometry) -> QgsGeometry:
757758
geom = QgsGeometry()
758759
geom.fromWkb(shapely_geom.wkb)
759760

@@ -767,7 +768,8 @@ except ModuleNotFoundError:
767768

768769
QgsGeometry.as_shapely = _geometry_as_shapely
769770

770-
def _geometry_from_shapely(self):
771+
@static_method
772+
def _geometry_from_shapely(shapely_geom):
771773
raise QgsNotSupportedException('QgsGeometry.from_shapely is not available, shapely is not installed on the system')
772774

773775
QgsGeometry.from_shapely = _geometry_from_shapely
@@ -815,5 +817,5 @@ Creates a new geometry from a shapely object.
815817

816818
:raises QgsNotSupportedException: if shapely is not available on the system
817819

818-
.. versionadded:: 3.42
820+
.. versionadded:: 3.44
819821
"""

0 commit comments

Comments
 (0)