• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.unmutePrint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.unmutePrint函数的典型用法代码示例。如果您正苦于以下问题:Python unmutePrint函数的具体用法?Python unmutePrint怎么用?Python unmutePrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: addMessage

 def addMessage(self, message, raw=False):
   if not raw:
       # We assume raw messages, formatted for HTML, are printed separately
       if self.mute: util.unmutePrint()      
       print '*** ' + message
       if self.mute: util.mutePrint()        
       message = cgi.escape(message)
   self.messages[self.currentQuestion].append(message)
开发者ID:DucQuang1,项目名称:CS188.1-Artificial-Intelligence,代码行数:8,代码来源:grading.py


示例2: sum

"""*** NOTE: Make sure to complete Question %s before working on Question %s,
*** because Question %s builds upon your answer for Question %s.
""" % (prereq, q, q, prereq)
          continue
      
      if self.mute: util.mutePrint()
      try:
        util.TimeoutFunction(getattr(gradingModule, q),300)(self) # Call the question's function
        #TimeoutFunction(getattr(gradingModule, q),1200)(self) # Call the question's function
      except Exception, inst:
        self.addExceptionMessage(q, inst, traceback)
        self.addErrorHints(exceptionMap, inst, q[1])
      except:
        self.fail('FAIL: Terminated with a string exception.')
      finally:
        if self.mute: util.unmutePrint()
      
      if self.points[q] >= self.maxes[q]:
        completedQuestions.add(q)
        
      print '\n### Question %s: %d/%d ###\n' % (q, self.points[q], self.maxes[q])
        

    print '\nFinished at %d:%02d:%02d' % time.localtime()[3:6]
    print "\nProvisional grades\n=================="
    
    for q in self.questions:
      print 'Question %s: %d/%d' % (q, self.points[q], self.maxes[q])
    print '------------------'
    print 'Total: %d/%d' % (self.points.totalCount(), sum(self.maxes.values()))
    if bonusPic and self.points.totalCount() == 25:
开发者ID:DucQuang1,项目名称:CS188.1-Artificial-Intelligence,代码行数:31,代码来源:grading.py


示例3: TimeoutFunction

                )
                continue

            if self.mute:
                util.mutePrint()
            try:
                util.TimeoutFunction(getattr(gradingModule, q), 300)(self)  # Call the question's function
                # TimeoutFunction(getattr(gradingModule, q),1200)(self) # Call the question's function
            except Exception, inst:
                self.addExceptionMessage(q, inst, traceback)
                self.addErrorHints(exceptionMap, inst, q[1])
            except:
                self.fail("FAIL: Terminated with a string exception.")
            finally:
                if self.mute:
                    util.unmutePrint()

            if self.points[q] >= self.maxes[q]:
                completedQuestions.add(q)

            print "\n### Question %s: %d/%d ###\n" % (q, self.points[q], self.maxes[q])

        print "\nFinished at %d:%02d:%02d" % time.localtime()[3:6]
        print "\nProvisional grades\n=================="

        for q in self.questions:
            print "Question %s: %d/%d" % (q, self.points[q], self.maxes[q])
        print "------------------"
        print "Total: %d/%d" % (self.points.totalCount(), sum(self.maxes.values()))
        if bonusPic and self.points.totalCount() == 25:
            print """
开发者ID:Caveat4U,项目名称:AI-Project-1,代码行数:31,代码来源:grading.py


示例4: grade

    def grade(self, gradingModule, exceptionMap={}, bonusPic=False):
        """
    Grades each question
      gradingModule: the module with all the grading functions (pass in with sys.modules[__name__])
    """

        completedQuestions = set([])
        for q in self.questions:
            print("\nQuestion %s" % q)
            print("=" * (9 + len(q)))
            print()
            self.currentQuestion = q

            incompleted = self.prereqs[q].difference(completedQuestions)
            if len(incompleted) > 0:
                prereq = incompleted.pop()
                print(
                    """*** NOTE: Make sure to complete Question %s before working on Question %s,
*** because Question %s builds upon your answer for Question %s.
"""
                    % (prereq, q, q, prereq)
                )
                continue

            if self.mute:
                util.mutePrint()
            try:
                util.TimeoutFunction(getattr(gradingModule, q), 300)(self)  # Call the question's function
                # TimeoutFunction(getattr(gradingModule, q),1200)(self) # Call the question's function
            except Exception as inst:
                self.addExceptionMessage(q, inst, traceback)
                self.addErrorHints(exceptionMap, inst, q[1])
            except:
                self.fail("FAIL: Terminated with a string exception.")
            finally:
                if self.mute:
                    util.unmutePrint()

            if self.points[q] >= self.maxes[q]:
                completedQuestions.add(q)

            print("\n### Question %s: %d/%d ###\n" % (q, self.points[q], self.maxes[q]))

        print("\nFinished at %d:%02d:%02d" % time.localtime()[3:6])
        print("\nProvisional grades\n==================")

        for q in self.questions:
            print("Question %s: %d/%d" % (q, self.points[q], self.maxes[q]))
        print("------------------")
        print("Total: %d/%d" % (self.points.totalCount(), sum(self.maxes.values())))
        if bonusPic and self.points.totalCount() == 25:
            print(
                """

                     ALL HAIL GRANDPAC.
              LONG LIVE THE GHOSTBUSTING KING.

                  ---      ----      ---
                  |  \    /  + \    /  |
                  | + \--/      \--/ + |
                  |   +     +          |
                  | +     +        +   |
                @@@@@@@@@@@@@@@@@@@@@@@@@@
              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            \   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
             \ /  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
              V   \   @@@@@@@@@@@@@@@@@@@@@@@@@@@@
                   \ /  @@@@@@@@@@@@@@@@@@@@@@@@@@
                    V     @@@@@@@@@@@@@@@@@@@@@@@@
                            @@@@@@@@@@@@@@@@@@@@@@
                    /\      @@@@@@@@@@@@@@@@@@@@@@
                   /  \  @@@@@@@@@@@@@@@@@@@@@@@@@
              /\  /    @@@@@@@@@@@@@@@@@@@@@@@@@@@
             /  \ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            /    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                @@@@@@@@@@@@@@@@@@@@@@@@@@
                    @@@@@@@@@@@@@@@@@@

"""
            )
        print(
            """
Your grades are NOT yet registered.  To register your grades, make sure
to follow your instructor's guidelines to receive credit on your project.
"""
        )

        if self.edxOutput:
            self.produceOutput()
开发者ID:SughiY,项目名称:Pacman,代码行数:94,代码来源:grading.py


示例5: grade

    def grade(self, gradingModule, exceptionMap={}, bonusPic=False):
        """
        Grades each question
          gradingModule: the module with all the grading functions (pass in with sys.modules[__name__])
        """

        completedQuestions = set([])
        for q in self.questions:
            print '\nQuestion %s' % q
            print '=' * (9 + len(q))
            print
            self.currentQuestion = q

            incompleted = self.prereqs[q].difference(completedQuestions)
            if len(incompleted) > 0:
                prereq = incompleted.pop()
                print \
                    """*** NOTE: Make sure to complete Question %s before working on Question %s,
*** because Question %s builds upon your answer for Question %s.
""" % (prereq, q, q, prereq)
                continue

            if self.mute:
                util.mutePrint()
            try:
                # Call the question's function
                util.TimeoutFunction(getattr(gradingModule, q), 300)(self)
                # TimeoutFunction(getattr(gradingModule, q),1200)(self) # Call
                # the question's function
            except Exception as inst:
                self.addExceptionMessage(q, inst, traceback)
                self.addErrorHints(exceptionMap, inst, q[1])
            except:
                self.fail('FAIL: Terminated with a string exception.')
            finally:
                if self.mute:
                    util.unmutePrint()

            if self.points[q] >= self.maxes[q]:
                completedQuestions.add(q)

            print '\n### Question %s: %d/%d ###\n' % (q, self.points[q], self.maxes[q])

        print '\nFinished at %d:%02d:%02d' % time.localtime()[3:6]
        print "\nProvisional grades\n=================="

        for q in self.questions:
            print 'Question %s: %d/%d' % (q, self.points[q], self.maxes[q])
        print '------------------'
        print 'Total: %d/%d' % (self.points.totalCount(), sum(self.maxes.values()))
        if bonusPic and self.points.totalCount() == 25:
            print """

                     ALL HAIL GRANDPAC.
              LONG LIVE THE GHOSTBUSTING KING.

                  ---      ----      ---
                  |  \    /  + \    /  |
                  | + \--/      \--/ + |
                  |   +     +          |
                  | +     +        +   |
                @@@@@@@@@@@@@@@@@@@@@@@@@@
              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            \   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
             \ /  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
              V   \   @@@@@@@@@@@@@@@@@@@@@@@@@@@@
                   \ /  @@@@@@@@@@@@@@@@@@@@@@@@@@
                    V     @@@@@@@@@@@@@@@@@@@@@@@@
                            @@@@@@@@@@@@@@@@@@@@@@
                    /\      @@@@@@@@@@@@@@@@@@@@@@
                   /  \  @@@@@@@@@@@@@@@@@@@@@@@@@
              /\  /    @@@@@@@@@@@@@@@@@@@@@@@@@@@
             /  \ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            /    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                @@@@@@@@@@@@@@@@@@@@@@@@@@
                    @@@@@@@@@@@@@@@@@@

"""
        print """
Your grades are NOT yet registered.  To register your grades you must
submit your files to the edX website.  The grades obtained through the
edX website are your final grades unless your submission was not in
the spirit of the course,  such as if your submission simply hardcoded
the answers to the tests.   We will screen for this after the deadline.
"""

        if self.edxOutput:
            self.produceOutput()
开发者ID:MLDL,项目名称:rlpy,代码行数:93,代码来源:grading.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.unpack_port_no函数代码示例发布时间:2022-05-26
下一篇:
Python util.unlink函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap