Python update 模块,Version() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用update.Version()

项目:alfred-mpd    作者:deanishe    | 项目源码 | 文件源码
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
项目:Gank-Alfred-Workflow    作者:hujiaweibujidao    | 项目源码 | 文件源码
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
项目:Gank-Alfred-Workflow    作者:hujiaweibujidao    | 项目源码 | 文件源码
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
项目:workflows.kyoyue    作者:wizyoung    | 项目源码 | 文件源码
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
项目:alphy    作者:maximepeschard    | 项目源码 | 文件源码
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
项目:GoToMeetingTools    作者:plongitudes    | 项目源码 | 文件源码
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
项目:behelper    作者:istommao    | 项目源码 | 文件源码
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
项目:radar    作者:amoose136    | 项目源码 | 文件源码
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
项目:alfred-workflows    作者:arthurhammer    | 项目源码 | 文件源码
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
项目:alfred-zebra    作者:r0x73    | 项目源码 | 文件源码
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
项目:alfred-bear    作者:chrisbro    | 项目源码 | 文件源码
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
项目:alfred-confluence    作者:skleinei    | 项目源码 | 文件源码
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
项目:alfred_reviewboard    作者:lydian    | 项目源码 | 文件源码
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
项目:MathKernelToggle    作者:LingyuanJi    | 项目源码 | 文件源码
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
项目:alfred-moeha    作者:moeHa    | 项目源码 | 文件源码
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
项目:simplingua-workflow    作者:bydmm    | 项目源码 | 文件源码
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
项目:alfred-baidu-translate    作者:ketor    | 项目源码 | 文件源码
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
项目:pomodoro-alfred    作者:ecbrodie    | 项目源码 | 文件源码
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
项目:jisho-alfred-workflow    作者:janclarin    | 项目源码 | 文件源码
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
项目:Alfred-Workflow    作者:stidio    | 项目源码 | 文件源码
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
项目:alfred-workflow-stockprice    作者:sungminoh    | 项目源码 | 文件源码
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
项目:Quiver-alfred    作者:danielecook    | 项目源码 | 文件源码
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
项目:call_or_sms_contact    作者:amoose136    | 项目源码 | 文件源码
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
项目:Dotfiles    作者:Akin909    | 项目源码 | 文件源码
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
项目:alfred-unicode    作者:deanishe    | 项目源码 | 文件源码
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
项目:shanbay-alfred    作者:stdrickforce    | 项目源码 | 文件源码
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
项目:ip138-alfred    作者:nemoTyrant    | 项目源码 | 文件源码
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
项目:alfred_ntnxapi    作者:aleibovici    | 项目源码 | 文件源码
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
项目:Zhihu-Daily-Alfred-Workflow    作者:fusijie    | 项目源码 | 文件源码
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
项目:alfredToday    作者:jeeftor    | 项目源码 | 文件源码
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
项目:alfred-iett-workflow    作者:ttuygun    | 项目源码 | 文件源码
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
项目:EmojiTaco    作者:jeeftor    | 项目源码 | 文件源码
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
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
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
项目:vino-workflows    作者:wuchangfeng    | 项目源码 | 文件源码
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
项目:vino-workflows    作者:wuchangfeng    | 项目源码 | 文件源码
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
项目:vino-workflows    作者:wuchangfeng    | 项目源码 | 文件源码
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
项目:qiniu-blog-deploy    作者:Panmax    | 项目源码 | 文件源码
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
项目:alfred-status-workflow    作者:manosim    | 项目源码 | 文件源码
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
项目:alfred-fixum    作者:deanishe    | 项目源码 | 文件源码
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
项目:AlfredWorkflow-DuoTai-Helper    作者:Jeff2Ma    | 项目源码 | 文件源码
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
项目:youdao-alfred    作者:nemoTyrant    | 项目源码 | 文件源码
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
项目:alfred3-mweb-workflow    作者:DarryO    | 项目源码 | 文件源码
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
项目:alfred-workflows    作者:mttjhn    | 项目源码 | 文件源码
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
项目:alfred-mpd    作者:deanishe    | 项目源码 | 文件源码
def alfred_version(self):
        """Alfred version as :class:`~workflow.update.Version` object."""
        from update import Version
        return Version(self.alfred_env.get('version'))
项目:alfred-mpd    作者:deanishe    | 项目源码 | 文件源码
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
项目:Gank-Alfred-Workflow    作者:hujiaweibujidao    | 项目源码 | 文件源码
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 -----------------------------------------
项目:Gank-Alfred-Workflow    作者:hujiaweibujidao    | 项目源码 | 文件源码
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
项目:Gank-Alfred-Workflow    作者:hujiaweibujidao    | 项目源码 | 文件源码
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
项目:workflows.kyoyue    作者:wizyoung    | 项目源码 | 文件源码
def alfred_version(self):
        """Alfred version as :class:`~workflow.update.Version` object."""
        from update import Version
        return Version(self.alfred_env.get('version'))
项目:workflows.kyoyue    作者:wizyoung    | 项目源码 | 文件源码
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