當前位置: 首頁>>代碼示例>>Python>>正文


Python platform.lower方法代碼示例

本文整理匯總了Python中sys.platform.lower方法的典型用法代碼示例。如果您正苦於以下問題:Python platform.lower方法的具體用法?Python platform.lower怎麽用?Python platform.lower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sys.platform的用法示例。


在下文中一共展示了platform.lower方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: read

# 需要導入模塊: from sys import platform [as 別名]
# 或者: from sys.platform import lower [as 別名]
def read(self, file_path: str) -> None:
        if not isfile(file_path):
            raise FileNotFoundError("File {} does not exists".format(file_path))

        if file_path.lower().endswith(".gz") and cbclib.Cbc_supportsGzip() == CHAR_ZERO:
            raise MipBaseException("CBC not compiled with gzip support")
        if (
            file_path.lower().endswith(".bz2")
            and cbclib.Cbc_supportsBzip2() == CHAR_ZERO
        ):
            raise MipBaseException("CBC not compiled with bzip2 support")

        fpstr = file_path.encode("utf-8")
        if ".mps" in file_path.lower():
            cbclib.Cbc_readMps(self._model, fpstr)
        elif ".lp" in file_path.lower():
            cbclib.Cbc_readLp(self._model, fpstr)
        else:
            raise ValueError(
                "Enter a valid extension (.lp or .mps) \
                to indicate the file format"
            ) 
開發者ID:coin-or,項目名稱:python-mip,代碼行數:24,代碼來源:cbc.py

示例2: get_os

# 需要導入模塊: from sys import platform [as 別名]
# 或者: from sys.platform import lower [as 別名]
def get_os():
    if platform.lower() == 'darwin':
        return 'osx'
    elif platform.lower().startswith('linux'):
        return 'linux'
    else:
        # throw is better
        return 'unknown' 
開發者ID:pindexis,項目名稱:marker,代碼行數:10,代碼來源:core.py

示例3: get_token

# 需要導入模塊: from sys import platform [as 別名]
# 或者: from sys.platform import lower [as 別名]
def get_token(self, url):
        token = ''
        path = os.getcwd()
        if _platform == "Windows" or _platform == "win32":
            # Check if we are on 32 or 64 bit
            file_name= 'chromedriver.exe'
        if _platform.lower() == "darwin":
            file_name= 'chromedriver'
        if _platform.lower() == "linux" or _platform.lower() == "linux2":
            file_name = 'chromedriver'
            
        full_path = ''
        if os.path.isfile(path + '/' + file_name): # check local dir first
            full_path = path + '/' + file_name

        if full_path == '':
            self.bot.logger.error(file_name + ' is needed for manual captcha solving! Please place it in the bots root directory')
            sys.exit(1)
        
        try:
            driver = webdriver.Chrome(full_path)
            driver.set_window_size(600, 600)
        except Exception:
            self.bot.logger.error('Error with Chromedriver, please ensure it is the latest version.')
            sys.exit(1)
            
        driver.get(url)
        
        elem = driver.find_element_by_class_name("g-recaptcha")
        driver.execute_script("arguments[0].scrollIntoView(true);", elem)
        self.bot.logger.info('You have 1 min to solve the Captcha')
        try:
            WebDriverWait(driver, 60).until(EC.text_to_be_present_in_element_value((By.NAME, "g-recaptcha-response"), ""))
            token = driver.execute_script("return grecaptcha.getResponse()")
            driver.close()
        except TimeoutException, err:
            self.bot.logger.error('Timed out while trying to solve captcha') 
開發者ID:PokemonGoF,項目名稱:PokemonGo-Bot,代碼行數:39,代碼來源:captcha_handler.py

示例4: sys_is_windows

# 需要導入模塊: from sys import platform [as 別名]
# 或者: from sys.platform import lower [as 別名]
def sys_is_windows():
    """ Check if user is running the code on Windows machine

    :return: `True` if OS is Windows and `False` otherwise
    :rtype: bool
    """
    return platform.lower().startswith('win') 
開發者ID:sentinel-hub,項目名稱:sentinelhub-py,代碼行數:9,代碼來源:os_utils.py

示例5: can_handle_current_platform

# 需要導入模塊: from sys import platform [as 別名]
# 或者: from sys.platform import lower [as 別名]
def can_handle_current_platform(self):
        """Returns true if this platform object can handle the server this process is running on.

        @return:  True if this platform instance can handle the current server.
        @rtype: bool
        """
        return _platform.lower().startswith("linux") 
開發者ID:scalyr,項目名稱:scalyr-agent-2,代碼行數:9,代碼來源:platform_linux.py

示例6: write

# 需要導入模塊: from sys import platform [as 別名]
# 或者: from sys.platform import lower [as 別名]
def write(self, file_path: str):
        fpstr = file_path.encode("utf-8")
        if ".mps" in file_path.lower():
            cbclib.Cbc_writeMps(self._model, fpstr)
        elif ".lp" in file_path.lower():
            cbclib.Cbc_writeLp(self._model, fpstr)
        else:
            raise ValueError(
                "Enter a valid extension (.lp or .mps) \
                to indicate the file format"
            ) 
開發者ID:coin-or,項目名稱:python-mip,代碼行數:13,代碼來源:cbc.py


注:本文中的sys.platform.lower方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。