MicroPythonCommandsInterface: fixed a code formatting issue and simplified the 'is_visible()' function. micropython

Fri, 02 Aug 2019 19:20:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 02 Aug 2019 19:20:07 +0200
branch
micropython
changeset 7113
04ac3f9a87e6
parent 7112
701cdc76f887
child 7114
f416440c8be1

MicroPythonCommandsInterface: fixed a code formatting issue and simplified the 'is_visible()' function.

eric6/MicroPython/MicroPythonCommandsInterface.py file | annotate | diff | comparison | revisions
--- a/eric6/MicroPython/MicroPythonCommandsInterface.py	Thu Aug 01 20:25:51 2019 +0200
+++ b/eric6/MicroPython/MicroPythonCommandsInterface.py	Fri Aug 02 19:20:07 2019 +0200
@@ -13,13 +13,18 @@
 import time
 import os
 
-from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QThread, QTimer, QCoreApplication, QEventLoop
+from PyQt5.QtCore import (
+    pyqtSlot, pyqtSignal, QObject, QThread, QTimer, QCoreApplication,
+    QEventLoop
+)
 
 from .MicroPythonSerialPort import MicroPythonSerialPort
 
 import Preferences
 
 
+# TODO: change code sent to the boards to functions and retrieve them using
+#       inspect.getsource() or inspect.getsourcelines()
 class MicroPythonCommandsInterface(QObject):
     """
     Class implementing some file system commands for MicroPython.
@@ -318,8 +323,7 @@
             "import os as __os_",
             "\n".join([
                 "def is_visible(filename):",
-                "    return (not filename.startswith('.') and"
-                " not filename.endswith('~'))",
+                "    return filename[0] != '.' and filename[-1] != '~'",
             ]),
             "\n".join([
                 "def stat(filename):",

eric ide

mercurial