Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1323855?usp=email )
Change subject: wbtypes: Remove redundant integer conversion
......................................................................
wbtypes: Remove redundant integer conversion
round() returns an integer when ndigits is omitted. Remove the surrounding
int() call from Coordinate.precisionToDim() and update its documentation
example while preserving the returned value and type.
Change-Id: I3e1e15f7923b897a8cef05ffb28c0a7d5b4b9a18
---
M pywikibot/_wbtypes.py
1 file changed, 5 insertions(+), 7 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index 891b287..a58b133 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -300,8 +300,8 @@
.. code-block:: python
- dim = int(round(math.radians(
- precision)*radius*math.cos(math.radians(self.lat))))
+ dim = round(math.radians(
+ precision) * radius * math.cos(math.radians(self.lat)))
:return: Dimension in meters
:raises ValueError: If neither *dim* nor *precision* is set
@@ -313,11 +313,9 @@
raise ValueError('No values set for dim or precision')
radius = 6378137
- self._dim = int(
- round(
- math.radians(self._precision) * radius * math.cos(
- math.radians(self.lat))
- )
+ self._dim = round(
+ math.radians(self._precision) * radius * math.cos(
+ math.radians(self.lat))
)
return self._dim
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1323855?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3e1e15f7923b897a8cef05ffb28c0a7d5b4b9a18
Gerrit-Change-Number: 1323855
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]