如何从具有.class扩展名的mercurial存储库中删除所有文件?
这种模式的使用不起作用:
PS> hg forget -I **.class
abort: no files specified
Run Code Online (Sandbox Code Playgroud)
但是,这种模式的使用列出了我想忘记的所有文件:
PS> hg status -A -I **.class
C be\ac\ulg\montefiore\run\distributions\DiscreteDistribution.class
C be\ac\ulg\montefiore\run\distributions\ExponentialDistribution.class
C be\ac\ulg\montefiore\run\distributions\GaussianDistribution.class
C be\ac\ulg\montefiore\run\distributions\GaussianMixtureDistribution.class
C be\ac\ulg\montefiore\run\distributions\MultiGaussianDistribution.class
C be\ac\ulg\montefiore\run\distributions\MultiRandomDistribution.class
C be\ac\ulg\montefiore\run\distributions\PoissonDistribution.class
C be\ac\ulg\montefiore\run\distributions\RandomDistribution.class
C be\ac\ulg\montefiore\run\distributions\SimpleMatrix.class
C be\ac\ulg\montefiore\run\jahmm\Centroid.class
C be\ac\ulg\montefiore\run\jahmm\CentroidFactory.class
C be\ac\ulg\montefiore\run\jahmm\CentroidObservationInteger.class
C be\ac\ulg\montefiore\run\jahmm\CentroidObservationReal.class
C be\ac\ulg\montefiore\run\jahmm\CentroidObservationVector.class
C be\ac\ulg\montefiore\run\jahmm\ForwardBackwardCalculator$Computation.class
C be\ac\ulg\montefiore\run\jahmm\ForwardBackwardCalculator.class
C be\ac\ulg\montefiore\run\jahmm\ForwardBackwardScaledCalculator.class
Run Code Online (Sandbox Code Playgroud)
我不理解忘记对待模式的方式是什么?我正在使用Mercurial 2.0版.
我想在Python中声明用户定义的异常的层次结构.但是,我希望我的顶级用户定义的class(TransactionException)是抽象的.也就是说,我打算TransactionException指定其子类需要定义的方法.但是,TransactionException永远不应该实例化或提出.
我有以下代码:
from abc import ABCMeta, abstractmethod
class TransactionException(Exception):
__metaclass__ = ABCMeta
@abstractmethod
def displayErrorMessage(self):
pass
Run Code Online (Sandbox Code Playgroud)
但是,上面的代码允许我实例化TransactionException...
a = TransactionException()
Run Code Online (Sandbox Code Playgroud)
在这种情况下a是没有意义的,而应该绘制一个例外.以下代码删除了TransactionException作为Exception... 的子类的事实
from abc import ABCMeta, abstractmethod
class TransactionException():
__metaclass__ = ABCMeta
@abstractmethod
def displayErrorMessage(self):
pass
Run Code Online (Sandbox Code Playgroud)
这段代码正确地禁止实例化,但现在我不能提出一个子类,TransactionException因为它Exception不再是一个子类.
可以在Python中定义一个抽象异常吗?如果是这样,怎么样?如果没有,为什么不呢?
注意:我使用的是Python 2.7,但很乐意接受Python 2.x或Python 3.x的答案.