当前位置: 首页>>代码示例>>Python>>正文


Python Tools.getPythonVersion方法代码示例

本文整理汇总了Python中libs.Tools.getPythonVersion方法的典型用法代码示例。如果您正苦于以下问题:Python Tools.getPythonVersion方法的具体用法?Python Tools.getPythonVersion怎么用?Python Tools.getPythonVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libs.Tools的用法示例。


在下文中一共展示了Tools.getPythonVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkInitFile

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
    def checkInitFile(self):
        """
        Check each platformio.ini file and loads the environments already
        initialized.
        """
        protected = self.Preferences.get('protected', False)
        if(not protected):
            return
        # Empy menu if it's not a IoT file
        if(not self.is_iot):
            if(Tools.getPythonVersion() > 2):
                self.Menu.createEnvironmentMenu(empty=True)
            return

        ini_path = Paths.getFullIniPath(self.dir)

        # show non native data
        if(not self.is_native):
            self.Preferences.set('native', False)
            self.Preferences.set('ini_path', self.dir)
            self.Menu.createEnvironmentMenu()
            return
        else:
            self.Preferences.set('native', True)
            self.Preferences.set('ini_path', self.dir)

        # get data from platformio.ini file
        ini_list = []
        with open(ini_path, 'r') as file:
            pattern = compile(r'\[(\w+)\W(\w+)\]')
            for line in file:
                if pattern.findall(line):
                    if('#' not in line):
                        line = match(r"\[\w+:(\w+)\]", line).group(1)
                        ini_list.append(line)

        # save preferences, update menu data
        type = 'board_id' if not self.is_native else 'found_ini'
        self.Preferences.set(type, ini_list)
        self.Menu.createEnvironmentMenu()
开发者ID:BadgerAAV,项目名称:Deviot,代码行数:42,代码来源:PlatformioCLI.py

示例2:

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
    from .Commands import CommandsPy
    from .Messages import MessageQueue
    from .I18n import I18n
except:
    import libs.Paths as Paths
    import libs.Tools as Tools
    from libs import Messages
    from libs import __version__ as version
    from libs.JSONFile import JSONFile
    from libs.Preferences import Preferences
    from libs.Progress import ThreadProgress
    from libs.Commands import CommandsPy
    from libs.Messages import MessageQueue
    from libs.I18n import I18n

if(Tools.getPythonVersion() < 3):
    from urllib import urlencode
    from urllib2 import Request
    from urllib2 import urlopen
else:
    from urllib.parse import urlencode
    from urllib.request import Request
    from urllib.request import urlopen

_ = I18n().translate


class Libraries:
    """
    Handle the library API from platformIO
    More info: http://docs.platformio.org/en/latest/librarymanager/index.html
开发者ID:BadgerAAV,项目名称:Deviot,代码行数:33,代码来源:Libraries.py

示例3: MessageQueue

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

import threading
import sublime
import time

try:
    from . import Tools
    from .I18n import I18n
except:
    from libs import Tools
    from libs.I18n import I18n

python_version = Tools.getPythonVersion()

if python_version < 3:
    import Queue as queue
else:
    import queue

_ = I18n().translate


class MessageQueue(object):
    """
    Print messages in the user console,
    placed in the message queue
    """
开发者ID:dattasaurabh82,项目名称:Deviot,代码行数:32,代码来源:Messages.py

示例4: SerialListener

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
import glob
import threading

try:
    from . import Tools
    from . import pyserial
    from . import Messages
    from .Preferences import Preferences
except:
    from libs import Tools
    from libs import pyserial
    from libs import Messages
    from libs.Preferences import Preferences

if Tools.getOsName() == 'windows':
    if Tools.getPythonVersion() < 3:
        import _winreg as winreg
    else:
        import winreg


@Tools.singleton
class SerialListener(object):
    """
    Constantly checks if a port has been connected or disconnected
    """

    def __init__(self, func=None):
        self.func = func
        self.serial_list = []
        self.is_alive = False
开发者ID:BadgerAAV,项目名称:Deviot,代码行数:33,代码来源:Serial.py


注:本文中的libs.Tools.getPythonVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。