コード例 #1
0
ファイル: upgrade100.py プロジェクト: jakesyl/cing
def restoreQueeny100( project, tmp=None ):
    """
    Restore queeny results from sml file.

    Return True on error
    """
    if project is None:
        nTmessage("restoreQueeny100: No project defined")
        return True

    if project.molecule is None:
        return False # Gracefully returns

    queenyDefs = project.getStatusDict(constants.QUEENY_KEY)

    if not queenyDefs.completed: # old definition
        nTdebug('restoreQueeny100: no queeny completed')
        return False # Return gracefully

    path = project.validationPath( 'Queeny')
    if not path.exists():
        ntu.nTwarning('restoreQueeny100: directory "%s" with prior queeny data not found', path)
    else:
        # delete the data and run again
        os.rename(path, project.path() / cdefs.directories.version1 / 'Queeny')
    #end if
    # regenerate the data
    project.runQueeny()
    nTmessage('restoreQueeny100: Re-generated Queeny results')
    return False
コード例 #2
0
    def __init__(self,
                 filename=None,
                 minLength=-1,
                 commentString=None,
                 minNF=-1,
                 skipHeaderLines=0,
                 separator=None):

        _AwkLike.__init__(self,
                          minLength=minLength,
                          commentString=commentString,
                          minNF=minNF,
                          skipHeaderLines=skipHeaderLines,
                          separator=separator)
        self.f = None

        if filename == None:
            self.f = sys.stdin
            self.FILENAME = 'stdin'  # pylint: disable=C0103
        else:
            self.FILENAME = filename
            if not os.path.exists(filename):
                ntu.nTerror('AwkLike: Failed to find file "%s"' % filename)
                self.f = None
            else:
                self.f = open(filename, 'r')
コード例 #3
0
ファイル: AwkLike.py プロジェクト: jakesyl/cing
 def close(self):
     """internal routine"""
     if self.FILENAME is None:
         ntu.nTerror('AwkLike.close: Cannot close file')
         return
     if self.f is None:
         ntu.nTerror('AwkLike.close: Cannot close "%s"', self.FILENAME)
         return
     if self.f is not sys.stdin:
         self.f.close()
     self.f = None
コード例 #4
0
 def close(self):
     """internal routine"""
     if self.FILENAME is None:
         ntu.nTerror('AwkLike.close: Cannot close file')
         return
     if self.f is None:
         ntu.nTerror('AwkLike.close: Cannot close "%s"', self.FILENAME)
         return
     if self.f is not sys.stdin:
         self.f.close()
     self.f = None
コード例 #5
0
 def float(self, field):
     """Return field converted to float or NaN on error """
     try:
         return float(self[field])
     except ValueError:
         ntu.nTerror(
             'AwkLike: expected float for "%s" (file: %s, line %d: "%s")',
             self[field], self.FILENAME, self.NR, self[0])
     except IndexError:
         ntu.nTerror(
             'AwkLike: invalid field number "%d" (file: %s, line %d: "%s")',
             field, self.FILENAME, self.NR, self[0])
     return fpconst.NaN
コード例 #6
0
ファイル: AwkLike.py プロジェクト: jakesyl/cing
    def __init__(self, filename=None, minLength=-1, commentString=None, minNF=-1,
                 skipHeaderLines=0, separator=None):

        _AwkLike.__init__(self, minLength=minLength, commentString=commentString, minNF=minNF,
                          skipHeaderLines=skipHeaderLines, separator=separator)
        self.f = None

        if filename is None:
            self.f = sys.stdin
            self.FILENAME = 'stdin'  # pylint: disable=C0103
        else:
            self.FILENAME = filename
            if not os.path.exists(filename):
                ntu.nTerror('AwkLike: Failed to find file "%s"' % filename)
                self.f = None
            else:
                self.f = open(filename, 'r')
コード例 #7
0
ファイル: importPlugin.py プロジェクト: jakesyl/cing
def importPlugin(pluginCodeModule, pluginName):
    """
    Import the plugin pluginName present in PluginCode directory.
    Adds reference to global plugins dict
    Returns None on error
    """
    isInstalled = False
    if plugins.has_key(pluginName):
        try:
            plugin = plugins[pluginName]
            #            nTdebug("reloading same module just to see it change")
            reload(plugin.module)
        except ImportWarning, extraInfo:  # Disable after done debugging; can't use nTdebug yet.
            ntu.nTmessage(
                "importPlugin: Skipping reload of an optional compound (please recode to use SkipTest): %s" % extraInfo
            )
            # Internally we need to know if we're called by nosetests or by regular call.
        except SkipTest, extraInfo:
            ntu.nTmessage("importPlugin: Skipping reload report of an optional compound: %s" % extraInfo)
コード例 #8
0
ファイル: AwkLike.py プロジェクト: jakesyl/cing
 def float(self, field):
     """Return field converted to float or NaN on error """
     try:
         return float(self[field])
     except ValueError:
         ntu.nTerror('AwkLike: expected float for "%s" (file: %s, line %d: "%s")',
                     self[field],
                     self.FILENAME,
                     self.NR,
                     self[0]
                     )
     except IndexError:
         ntu.nTerror('AwkLike: invalid field number "%d" (file: %s, line %d: "%s")',
                     field,
                     self.FILENAME,
                     self.NR,
                     self[0]
                     )
     return fpconst.NaN
コード例 #9
0
ファイル: importPlugin.py プロジェクト: jakesyl/cing
 """
 isInstalled = False
 if plugins.has_key(pluginName):
     try:
         plugin = plugins[pluginName]
         #            nTdebug("reloading same module just to see it change")
         reload(plugin.module)
     except ImportWarning, extraInfo:  # Disable after done debugging; can't use nTdebug yet.
         ntu.nTmessage(
             "importPlugin: Skipping reload of an optional compound (please recode to use SkipTest): %s" % extraInfo
         )
         # Internally we need to know if we're called by nosetests or by regular call.
     except SkipTest, extraInfo:
         ntu.nTmessage("importPlugin: Skipping reload report of an optional compound: %s" % extraInfo)
     except Exception:
         ntu.nTtracebackError()
         ntu.nTexception("importPlugin: A reload failed for " + pluginName)
         return None
 #    module = __import__( moduleName, globals(), locals(), [] )
 #    ntu.nTmessage('==> Attempting import plugin ' + pluginName )
 # by the manuals words:
 # "However, when a non-empty fromlist argument is given, the module named by name is returned."
 pluginCodeModulePackage = None
 try:
     # JFD changed from default to zero which means to only try absolute imports.
     pluginCodeModulePackage = __import__(pluginCodeModule, globals(), locals(), [pluginName])
     isInstalled = True
     ntu.nTdebug("importPlugin: Installed plugin: [%s]" % pluginName)
 except ImportWarning:
     ntu.nTdebug(
         "importPlugin: Skipping import of an optional plugin: [%s] (please recode to use SkipTest)" % pluginName
コード例 #10
0
ファイル: AwkLike.py プロジェクト: jakesyl/cing
 def printit(self):
     ntu.nTmessage('==> FILENAME=%s NR=%d NF=%d' % (self.FILENAME, self.NR, self.NF))
     for i, field in self.enumerate():  # can't use enumerate as that will loop through the 'lines'
         ntu.nTmessage('%2d >%s<' % (i, self[i]))
コード例 #11
0
 def printit(self):
     ntu.nTmessage('==> FILENAME=%s NR=%d NF=%d' %
                   (self.FILENAME, self.NR, self.NF))
     for i, field in self.enumerate(
     ):  # can't use enumerate as that will loop throught the 'lines'
         ntu.nTmessage('%2d >%s<' % (i, self[i]))