Ejemplo n.º 1
0
 def __init__(self):
     Parser.__init__(self)
     self.word_in_int = dict()
     self.int_for_word = dict()
     self.file_in_int = dict()
     self.int_for_file = dict()
     self.map = dict()
Ejemplo n.º 2
0
 def __init__(self, rule, parent):
     Parser.__init__(self, rule, parent)
     self.parsers = []  # parsers constructed for each of rule.items
     self.active = None  # main active parser (top of self.parsers)
     self.pos = 0  # position in self.rule.items
     self.tokens = []  # all tokens we have ever seen
     self.backlog = []  # [(pos,#tokens consumed,donetext)]
Ejemplo n.º 3
0
	def __init__(self, *args, **kwds): #blast, allHits=False, evalue=1e-10, taxFilter=None, taxFilterType=0):
		"""Intialise a BLAST XML parser.
		"""
		#Initialize Parser super class
		Parser.__init__(self, *args, **kwds)

		#Build iter to loop over XML
		self.context = iter(ET.iterparse(self.infile, events=("start", "end")))
		#Boolean to allow hits to be returned
		self.runHSP = True
		#Save the current contig, or queryID 
		self.queryID = None
		#The number of Hits that have been processed
		self.numHits = 0
		#File came form RAPSearch2?
		self.rapsearch = kwds.get("rapsearch", False)

		#Start initial parsing
		event, root = self.context.next()

		if root.tag not in ["BlastOutput", "Output"]:
			raise RuntimeError("This is not a valid BLAST XML file or RAPSearch2 XML file")
		elif root.tag == "Output":
			self.rapsearch = True

		#Start looping over data until we get to first iteration
		for event, elem in self.context:
			if event == "start" and elem.tag == "Iteration":
				break 
Ejemplo n.º 4
0
 def __init__(self,rule,parent):
   Parser.__init__(self, rule, parent)
   self.parsers = []   # parsers constructed for each of rule.items
   self.active = None  # main active parser (top of self.parsers)
   self.pos = 0        # position in self.rule.items
   self.or_parser = None   # In use if we split into an OrParser
   self.fakePrefix = ''    # Text to prepend to the next parse()'s output
   self.justSplit = False  # True for left branch immediately after a split
Ejemplo n.º 5
0
 def __init__(self, downloader=None):
     '''Initialize the character parser.'''
     log.debug("Creating character parser with downloader " + str(downloader))
     Parser.__init__(self, downloader=downloader)
     self._gp = GuildParser(downloader=self._downloader)
     self._ip = ItemParser(downloader=self._downloader)
     self._ap = AchievementParser(downloader=self._downloader)
     Base.metadata.create_all(Database.engine)
Ejemplo n.º 6
0
 def __init__(self, stringToScan, scholarshipPackageId='0'):
     self.stringToScan = stringToScan
     Parser.__init__(self, self.stringToScan, '\s[^$\d\.]?[1234]\.\d+')
     self.resultList = []
     self.attributeId = '1'
     self.gpa = ''
     self.logicGroup = '0'
     self.requirementTypeCode = '>='
     self.scholarshipPackageId = scholarshipPackageId
    def __init__(self, **kwargs):
        self._extendHeader = False
        Parser.__init__(self, **kwargs)
        self._prThreshold = float(kwargs.pop("prThreshold"))
        self._imgOutputDir = str(kwargs.pop("imgOutputDir"))

        self._localRadiationBench = str(kwargs.pop("localRadiationBench"))
        self._goldBaseDir = kwargs.pop("goldBaseDir")
        self._datasets = kwargs.pop("datasets")
Ejemplo n.º 8
0
    def __init__ (self):
        Parser.__init__ (self)

        self.is_gnome = None

        # Parser context
        self.commit = None
        self.branch = None
        self.branches = []
Ejemplo n.º 9
0
 def __init__(self):
     """
     Creates a new SecondParse object.
     """
     Parser.__init__(self)
     self.__address = None
     self.__dest = None
     self.__comp = None
     self.__jump = None
Ejemplo n.º 10
0
    def __init__(self):
        Parser.__init__(self)

        self.is_gnome = None

        # Parser context
        self.commit = None
        self.branch = None
        self.branches = []
Ejemplo n.º 11
0
    def __init__(self):
        Parser.__init__(self)

        self.root_path = ''

        # Parser context
        self.state = SVNParser.COMMIT
        self.commit = None
        self.msg_lines = 0
Ejemplo n.º 12
0
    def __init__(self):
        Parser.__init__(self)

        self.root_path = ''
        
        # Parser context
        self.state = SVNParser.COMMIT
        self.commit = None
        self.msg_lines = 0
Ejemplo n.º 13
0
 def __init__(self,
              sbmlFileName,
              modelName,
              integrationType,
              method,
              inputPath="",
              outputPath=""):
     Parser.__init__(self, sbmlFileName, modelName, integrationType, method,
                     inputPath, outputPath)
Ejemplo n.º 14
0
 def __init__(self,rule,parent):
   Parser.__init__(self, rule, parent)
   self.parsers = []
   self.displays = {}
   for item in rule.items:
     parser = MakeParser(item, self)
     self.parsers.append(parser)
     self.displays[parser] = ''
   self.lastHappyEnding = ''
   self.unconfirmed = ''
   self.debug = []
Ejemplo n.º 15
0
 def __init__(self,rule,parent):
   Parser.__init__(self, rule, parent)
   self.parsers = []   # parsers constructed for each of rule.items
   self.active = None  # main active parser (top of self.parsers)
   self.pos = 0        # position in self.rule.items
   self.unconfirmed = '' # text we have output from active since it started
                         # or was done
   self.activeused = False # have we ever previously returned text from active
   self.everdone = []  # true for each position that was ever done
   self.tokenssincedone = [] # each token observed since the last done state
   self.everevil = False # have we ever emit stuff from a parser that went evil
   self.debug = []
Ejemplo n.º 16
0
 def __init__(self,rule,parent):
   Parser.__init__(self, rule, parent)
   if isinstance(self.rule.items, str):
     self.rule.items = [self.rule.items]
   if len(self.rule.items) != 1:
     raise Exception("TerminalParser's Terminal must have one rule.item; instead got '%s'" % self.rule.items)
   self.tname = self.rule.items[0]
   self.value = None
   self.parsedtodone = False # Have we already parsed the token?
                             # Separate from done because we might be optional
   self.displayValue = False
   if hasattr(self.rule, 'displayValue') and self.rule.displayValue:
     self.displayValue = self.rule.displayValue
Ejemplo n.º 17
0
    def __init__(self):
        Parser.__init__(self)

        self.root_path = ""
        self.lines = {}

        # Parser context
        self.file = None
        self.file_added_on_branch = None
        self.commit = None
        self.branches = None
        self.tags = None
        self.rev_separator = None
        self.file_separator = None
Ejemplo n.º 18
0
  def __init__(self,rule,parent):
    Parser.__init__(self, rule, parent)
    self.parsers = []   # parsers constructed for each of rule.items
    self.active = None  # main active parser (top of self.parsers)
    self.pos = 0        # position in self.rule.items

    # The not-done tokens that immediately followed done-tokens by the last
    # parser that accepted any tokens.  If the next parser that accepts a
    # token's very first token is in this set, then this SeqParser was used
    # erroneously!
    self.firstnotdonetokens = set()
    self.everdone = []  # True for each position that was ever done
    self.tokenssincedone = []   # each token observed since the last done state
    self.display = ''   # buffer of text to emit at the next emittable state
    self.lastdonetext = ''    # text from the last time we were done
Ejemplo n.º 19
0
 def __init__(self,
              sbmlFileName,
              modelName,
              integrationType,
              method,
              inputPath="",
              outputPath=""):
     self.mathPython = []
     self.mathCuda = []
     Parser.__init__(self,
                     sbmlFileName,
                     modelName,
                     integrationType,
                     method,
                     inputPath="",
                     outputPath="")
    def __init__(self, **kwargs):
        # ObjectDetectionParser.__init__(self, **kwargs)
        Parser.__init__(self, **kwargs)
        self._parseLayers = bool(kwargs.pop("parseLayers"))

        self._sizeOfDNN = len(self.__layerDimensions)
        if self._parseLayers:
            self.__layersGoldPath = str(kwargs.pop("layersGoldPath"))
            self.__layersPath = str(kwargs.pop("layersPath"))
            self._cnnParser = CNNLayerParser(
                layersDimention=self.__layerDimensions,
                layerGoldPath=self.__layersGoldPath,
                layerPath=self.__layersPath,
                dnnSize=self._sizeOfDNN,
                correctableLayers=[])

            self._csvHeader.extend(self._cnnParser.genCsvHeader())
Ejemplo n.º 21
0
 def __init__(self,rule,parent):
   Parser.__init__(self, rule, parent)
   self.firstparse = True
   msg = self.rule.msg.split('%s')
   self.msg_start = msg[0]
   self.msg_middle = self.rule.msg.count('%s') > 0
   self.msg_end = ''
   if len(msg) == 2:
     self.msg_end = msg[1]
   elif len(msg) > 2:
     raise Exception("DispParser %s found inappropriate msg '%s'" % (self.name, msg))
   if len(self.rule.items) != 1:
     raise Exception("DispParser %s must have 1 item" % self.name)
   self.parser = MakeParser(self.rule.items[0], self)
   self.bad = self.parser.bad
   self.done = self.parser.done
   self.name = self.name % self.parser.name
   self.debug = []
    def __init__(self, param):
        """
        generated source for method __init__
        """
        Parser.__init__(self)

        self.param = param
        self.differ = Differential(self.param.Seed)

        self.predict = []
        self.interval = None

        # Kalman Filter params
        self.P = 100

        # estimation error covariance (over all time instance)
        self.Q = 1000

        # process noise synthetic data
        self.R = 1000000

        # measurement noise optimal for alpha = 1, synthetic data
        self.K = 0

        # kalman gain
        # PID control params - default
        self.Cp = 0.9  # proportional gain, to keep output proportional to current error
        self.Ci = 0.1  # integral gain, to eliminate offset
        self.Cd = 0.0  # derivative gain, to ensure stability - prevent large error in future

        # fixed internally
        self.theta = 1  # magnitude of changes
        self.xi = 0.2  # gamma (10%)
        self.minIntvl = 1  # make sure the interval is greater than 1

        self.windowPID = 5  # I(integration) window
        self.ratioM = 0.2  # sampling rate

        #
        self.isSampling = False
    def __init__(self, param):
        """
        generated source for method __init__
        """
        Parser.__init__(self)

        self.param = param
        self.differ = Differential(self.param.Seed)

        self.predict = []
        self.interval = None

        # Kalman Filter params
        self.P = 100

        # estimation error covariance (over all time instance)
        self.Q = 1000

        # process noise synthetic data
        self.R = 1000000

        # measurement noise optimal for alpha = 1, synthetic data
        self.K = 0

        # kalman gain
        # PID control params - default
        self.Cp = 0.9  # proportional gain, to keep output proportional to current error
        self.Ci = 0.1  # integral gain, to eliminate offset
        self.Cd = 0.0  # derivative gain, to ensure stability - prevent large error in future

        # fixed internally
        self.theta = 1  # magnitude of changes
        self.xi = 0.2  # gamma (10%)
        self.minIntvl = 1  # make sure the interval is greater than 1

        self.windowPID = 5  # I(integration) window
        self.ratioM = 0.2  # sampling rate

        #
        self.isSampling = False
Ejemplo n.º 24
0
 def __init__(self, downloader=None):
     '''Initialize the team parser.'''
     log.debug("Creating ItemParser with " + str(downloader))
     Parser.__init__(self, downloader=downloader)
Ejemplo n.º 25
0
 def __init__(self):
     Parser.__init__(self)
Ejemplo n.º 26
0
 def __init__(self):
     Parser.__init__(self)
     self.uidList = []
     self.uidSet = set()
Ejemplo n.º 27
0
 def __init__(self):
     Parser.__init__(self)
     self.topicSet = set([])
Ejemplo n.º 28
0
 def __init__(self):
     Parser.__init__(self)
     self.allExt = [
         "tok", "tt", "ptb", "sd", "conll", "conllx", "conllu", "corenlp",
         "epe"
     ]
Ejemplo n.º 29
0
 def __init__(self):
     Parser.__init__(self)
     self.idList = []
     self.idSet = set()
     self.allIdSet = set([])
 def __init__(self, db=DataBase()):
     Parser.__init__(self, db)
     self.db = db  # mongodb by default
Ejemplo n.º 31
0
 def __init__(self, html):
   Parser.__init__(self, html)
Ejemplo n.º 32
0
 def __init__(self):
     """
     Creates a new FirstParse object.
     """
     Parser.__init__(self)
     self.__line_number = 0  # initialize the line number to 0
Ejemplo n.º 33
0
 def __init__(self,rule,parent):
   if not isinstance(rule, Action):
     raise Exception("Cannot use an ActionParser on a non-Action rule")
   Parser.__init__(self, rule, parent)
   self.actioned = False
   self.active = MakeParser(rule.items, self)
Ejemplo n.º 34
0
 def __init__(self, downloader=None):
     '''Initialize the achievement parser.'''
     Parser.__init__(self, no_downloader=True)
Ejemplo n.º 35
0
 def __init__(self):
     Parser.__init__(self)
     # 根据本地文件目录和hdfs目录运行环境不同,选择不同的目录
     self.so = cdll.LoadLibrary(r"../util/libtopicid.so") if os.path.exists(r"../util/libtopicid.so") else cdll.LoadLibrary(r"./util/libtopicid.so")
Ejemplo n.º 36
0
    def __init__(self, porter):

        Parser.__init__(self, ".I")
        self.porter = porter
Ejemplo n.º 37
0
 def __init__(self, downloader=None):
     '''Initialize the guild parser.'''
     Parser.__init__(self, downloader=downloader)
     Base.metadata.create_all(Database.engine)
Ejemplo n.º 38
0
 def __init__(self, html):
   Parser.__init__(self, html)
   # init Length, or it will be messed up
   self.getDates()
Ejemplo n.º 39
0
 def __init__(self):
     Parser.__init__(self)
     self.unEscDict = {}
     for k, v in self.escDict.iteritems():
         self.unEscDict[v] = k
Ejemplo n.º 40
0
 def __init__(self, day, startTime, endTime):
     Parser.__init__(self)
     self.startTime = day + " " + startTime
     self.endTime = day + " " + endTime
 def __init__(self, html):
   Parser.__init__(self, html)
   self.getPlayerNames()
Ejemplo n.º 42
0
 def __init__(self):
     Parser.__init__(self)
     self.filename = "./log/redis.log"
     self.logFile = open(self.filename, "w")
 def __init__(self, sbmlFileName, modelName, integrationType, method, inputPath="", outputPath=""):
     Parser.__init__(self, sbmlFileName, modelName, integrationType, method, inputPath, outputPath)
Ejemplo n.º 44
0
 def __init__(self, **kwargs):
     Parser.__init__(self, **kwargs)
Ejemplo n.º 45
0
 def __init__(self, downloader=None):
     log.debug("Creating arena with downloader " + str(downloader))
     Parser.__init__(self, downloader=downloader)
     self._tp = Team.TeamParser(downloader=self._downloader)
Ejemplo n.º 46
0
    def __init__(self):
        Parser.__init__(self)

        # Parser context
        self.state = BzrParser.COMMIT
        self.commit = None
Ejemplo n.º 47
0
 def __init__(self):
     '''
     Constructor
     '''
     Parser.__init__(self, ".I")
Ejemplo n.º 48
0
 def __init__(self, sbmlFileName, modelName, integrationType, method, inputPath="", outputPath=""):
     self.mathPython = []
     self.mathCuda = []
     Parser.__init__(self, sbmlFileName, modelName, integrationType, method, inputPath="", outputPath="")
Ejemplo n.º 49
0
 def __init__(self):
     Parser.__init__(self)
     self.topicDict = {}
Ejemplo n.º 50
0
 def __init__(self):
     Parser.__init__(self)
     self.allExt = ["tok", "tt", "ptb", "sd", "conll", "conllx", "conllu", "corenlp", "epe"]
Ejemplo n.º 51
0
 def __init__(self, downloader=None):
     '''Initialize the team parser.'''
     log.debug("Creating TeamParser with " + str(downloader))
     Parser.__init__(self, downloader=downloader)
     self._cp = GuildCharacter.CharacterParser(downloader=self._downloader)        
Ejemplo n.º 52
0
 def __init__(self, html):
     Parser.__init__(self, html)
     self.getPlayerNames()
Ejemplo n.º 53
0
 def __init__(self, root_dir, unique_id):
         Parser.__init__(self, root_dir, unique_id)
Ejemplo n.º 54
0
 def __init__(self, baseUrl):
     Parser.__init__(self, baseUrl)
     print("Mangareader Parser initialized")
Ejemplo n.º 55
0
    def __init__(self):
        Parser.__init__(self)

        # Parser context
        self.state = BzrParser.COMMIT
        self.commit = None
Ejemplo n.º 56
0
 def __init__(self,rule,parent):
   Parser.__init__(self, rule, parent)
   self.active = None
   self.unconfirmed = ''
   self.neverGoBad = False
   self.debug = []