Skip to content

Commit 201e95e

Browse files
authored
Fix some deprecation warnings (#872)
Fixed * conftest.py:30: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses * mslib/msui/mscolab_project.py:486: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. * mslib/msui/mscolab_project.py:647: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. * mslib/msui/topview.py:354: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index See issue #863
1 parent 4b9e3c9 commit 201e95e

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

conftest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
See the License for the specific language governing permissions and
2525
limitations under the License.
2626
"""
27-
from __future__ import print_function
2827

29-
30-
import imp
28+
import importlib
29+
import importlib.machinery
3130
import os
3231
import sys
3332
# Disable pyc files
@@ -147,9 +146,9 @@ class mscolab_settings(object):
147146
parent_path = fs.path.join(constants.ROOT_DIR, 'mscolab')
148147

149148

150-
imp.load_source('mss_wms_settings', constants.SERVER_CONFIG_FILE_PATH)
149+
importlib.machinery.SourceFileLoader('mss_wms_settings', constants.SERVER_CONFIG_FILE_PATH).load_module()
151150
sys.path.insert(0, constants.SERVER_CONFIG_FS.root_path)
152-
imp.load_source('mscolab_settings', path)
151+
importlib.machinery.SourceFileLoader('mscolab_settings', path).load_module()
153152
sys.path.insert(0, parent_path)
154153

155154

mslib/msui/mscolab_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def get_text_browser(self, text):
484484
text_browser.anchorClicked.connect(self.on_link_click)
485485
text_browser.show()
486486
text_browser.setFixedHeight(
487-
text_browser.document().size().height() + text_browser.contentsMargins().top() * 2
487+
int(text_browser.document().size().height() + text_browser.contentsMargins().top() * 2)
488488
)
489489
return text_browser
490490

@@ -645,7 +645,7 @@ def update_text(self, message_text):
645645
html = self.chat_window.markdown.convert(self.message_text)
646646
self.messageBox.setHtml(html)
647647
self.messageBox.setFixedHeight(
648-
self.messageBox.document().size().height() + self.messageBox.contentsMargins().top() * 2
648+
int(self.messageBox.document().size().height() + self.messageBox.contentsMargins().top() * 2)
649649
)
650650
self.textArea.adjustSize()
651651

mslib/msui/topview.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,11 @@ def is_roundtrip_possible(self):
354354
first_waypoint = self.waypoints_model.waypoint_data(0)
355355
last_waypoint = self.waypoints_model.waypoint_data(self.waypoints_model.rowCount() - 1)
356356

357-
condition = first_waypoint.lat != last_waypoint.lat or first_waypoint.lon != last_waypoint.lon or \
358-
first_waypoint.flightlevel != last_waypoint.flightlevel
357+
condition = ((first_waypoint.lat != last_waypoint.lat) or
358+
(first_waypoint.lon != last_waypoint.lon) or
359+
(first_waypoint.flightlevel != last_waypoint.flightlevel))
359360

360-
return condition
361+
return bool(condition)
361362

362363
def update_roundtrip_enabled(self):
363364
self.btRoundtrip.setEnabled(self.is_roundtrip_possible())

0 commit comments

Comments
 (0)