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


Python update.Version方法代碼示例

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


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

示例1: last_version_run

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def last_version_run(self):
        """Return version of last version to run (or ``None``).

        .. versionadded:: 1.9.10

        :returns: :class:`~workflow.update.Version` instance
            or ``None``

        """
        if self._last_version_run is UNSET:

            version = self.settings.get('__workflow_last_version')
            if version:
                from update import Version
                version = Version(version)

            self._last_version_run = version

        self.logger.debug('last run version: %s', self._last_version_run)

        return self._last_version_run 
開發者ID:TKkk-iOSer,項目名稱:wechat-alfred-workflow,代碼行數:23,代碼來源:workflow.py

示例2: last_version_run

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def last_version_run(self):
        """Return version of last version to run (or ``None``)

        .. versionadded:: 1.9.10

        :returns: :class:`~workflow.update.Version` instance
            or ``None``

        """

        if self._last_version_run is UNSET:

            version = self.settings.get('__workflow_last_version')
            if version:
                from update import Version
                version = Version(version)

            self._last_version_run = version

        self.logger.debug('Last run version : {0}'.format(
                          self._last_version_run))

        return self._last_version_run 
開發者ID:danielecook,項目名稱:Quiver-alfred,代碼行數:25,代碼來源:workflow.py

示例3: last_version_run

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def last_version_run(self):
        """Return version of last version to run (or ``None``).

        .. versionadded:: 1.9.10

        :returns: :class:`~workflow.update.Version` instance
            or ``None``

        """
        if self._last_version_run is UNSET:

            version = self.settings.get('__workflow_last_version')
            if version:
                from update import Version
                version = Version(version)

            self._last_version_run = version

        self.logger.debug('Last run version : {0}'.format(
                          self._last_version_run))

        return self._last_version_run 
開發者ID:ecbrodie,項目名稱:pomodoro-alfred,代碼行數:24,代碼來源:workflow.py

示例4: alfred_version

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def alfred_version(self):
        """Alfred version as :class:`~workflow.update.Version` object."""
        from update import Version
        return Version(self.alfred_env.get('version')) 
開發者ID:TKkk-iOSer,項目名稱:wechat-alfred-workflow,代碼行數:6,代碼來源:workflow.py

示例5: set_last_version

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def set_last_version(self, version=None):
        """Set :attr:`last_version_run` to current version.

        .. versionadded:: 1.9.10

        :param version: version to store (default is current version)
        :type version: :class:`~workflow.update.Version` instance
            or ``unicode``
        :returns: ``True`` if version is saved, else ``False``

        """
        if not version:
            if not self.version:
                self.logger.warning(
                    "Can't save last version: workflow has no version")
                return False

            version = self.version

        if isinstance(version, basestring):
            from update import Version
            version = Version(version)

        self.settings['__workflow_last_version'] = str(version)

        self.logger.debug('set last run version: %s', version)

        return True 
開發者ID:TKkk-iOSer,項目名稱:wechat-alfred-workflow,代碼行數:30,代碼來源:workflow.py

示例6: alfred_version

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def alfred_version(self):
        from update import Version
        return Version(self.alfred_env.get('version')) 
開發者ID:danielecook,項目名稱:Quiver-alfred,代碼行數:5,代碼來源:workflow.py

示例7: version

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def version(self):
        """Return the version of the workflow

        .. versionadded:: 1.9.10

        Get the version from the ``update_settings`` dict passed on
        instantiation or the ``version`` file located in the workflow's
        root directory. Return ``None`` if neither exist or
        :class:`ValueError` if the version number is invalid (i.e. not
        semantic).

        :returns: Version of the workflow (not Alfred-Workflow)
        :rtype: :class:`~workflow.update.Version` object

        """

        if self._version is UNSET:

            version = None
            # First check `update_settings`
            if self._update_settings:
                version = self._update_settings.get('version')

            # Fallback to `version` file
            if not version:
                filepath = self.workflowfile('version')

                if os.path.exists(filepath):
                    with open(filepath, 'rb') as fileobj:
                        version = fileobj.read()

            if version:
                from update import Version
                version = Version(version)

            self._version = version

        return self._version

    # Workflow utility methods ----------------------------------------- 
開發者ID:danielecook,項目名稱:Quiver-alfred,代碼行數:42,代碼來源:workflow.py

示例8: set_last_version

# 需要導入模塊: import update [as 別名]
# 或者: from update import Version [as 別名]
def set_last_version(self, version=None):
        """Set :attr:`last_version_run` to current version

        .. versionadded:: 1.9.10

        :param version: version to store (default is current version)
        :type version: :class:`~workflow.update.Version` instance
            or ``unicode``
        :returns: ``True`` if version is saved, else ``False``

        """

        if not version:
            if not self.version:
                self.logger.warning(
                    "Can't save last version: workflow has no version")
                return False

            version = self.version

        if isinstance(version, basestring):
            from update import Version
            version = Version(version)

        self.settings['__workflow_last_version'] = str(version)

        self.logger.debug('Set last run version : {0}'.format(version))

        return True 
開發者ID:danielecook,項目名稱:Quiver-alfred,代碼行數:31,代碼來源:workflow.py


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