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


Python ViewCollection.update_vcs_time方法代码示例

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


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

示例1: update_vcs_file

# 需要导入模块: from view_collection import ViewCollection [as 别名]
# 或者: from view_collection.ViewCollection import update_vcs_time [as 别名]
    def update_vcs_file(self):
        # the git repo won't change that often
        # so we can easily wait 5 seconds
        # between updates for performance
        if ViewCollection.vcs_time(self.view) > 5:
            open(self.vcs_temp_file.name, 'w').close()
            status_args = self.get_status_args()
            status = None
            try:
                contents, errors = self.run_command(status_args)
                status = self.process_status_line(contents)
                ViewCollection.update_vcs_status(self.view, status)
            except Exception as e:
                # print e
                pass

            args = self.get_diff_args()
            try:
                if status == 'M':
                    contents, errors = self.run_command(args)
                    contents = VcsGutterHandler._to_unix(contents)
                    VcsGutterHandler._write(self.vcs_temp_file.name, contents)
                    ViewCollection.update_vcs_time(self.view)
            except Exception as e:
                print ("Unable to write file for diff ", e)
开发者ID:dichlofos,项目名称:VcsGutter,代码行数:27,代码来源:gutter_handlers.py

示例2: update_vcs_file

# 需要导入模块: from view_collection import ViewCollection [as 别名]
# 或者: from view_collection.ViewCollection import update_vcs_time [as 别名]
 def update_vcs_file(self):
     # the git repo won't change that often
     # so we can easily wait 5 seconds
     # between updates for performance
     if ViewCollection.vcs_time(self.view) > 5:
         open(self.vcs_temp_file.name, 'w').close()
         args = self.get_diff_args()
         try:
             contents = self.run_command(args)
             contents = contents.replace('\r\n', '\n')
             contents = contents.replace('\r', '\n')
             f = open(self.vcs_temp_file.name, 'w')
             f.write(contents)
             f.close()
             ViewCollection.update_vcs_time(self.view)
         except Exception:
             pass
开发者ID:cristianciofu,项目名称:VcsGutter,代码行数:19,代码来源:gutter_handlers.py

示例3: update_vcs_file

# 需要导入模块: from view_collection import ViewCollection [as 别名]
# 或者: from view_collection.ViewCollection import update_vcs_time [as 别名]
 def update_vcs_file(self):
     # the git repo won't change that often
     # so we can easily wait 5 seconds
     # between updates for performance
     if ViewCollection.vcs_time(self.view) > 5:
         open(self.vcs_temp_file.name, "w").close()
         args = self.get_diff_args()
         try:
             contents = self.run_command(args)
             contents = contents.replace(b"\r\n", b"\n")
             contents = contents.replace(b"\r", b"\n")
             f = open(self.vcs_temp_file.name, "wb")
             f.write(contents)
             f.close()
             ViewCollection.update_vcs_time(self.view)
         except Exception as e:
             print("Unable to write file for diff ", e)
开发者ID:borissamardzija,项目名称:VcsGutter,代码行数:19,代码来源:gutter_handlers.py


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