コード例 #1
0
ファイル: data_hub_data.py プロジェクト: ostwald/python-lib
 def __init__(self, textline, schema):
     WorksheetEntry.__init__(self, textline, schema)
     self.countryName = self['Country Name']
     self.provCode = self['ISO 3166-2 Sub-division/State Code']
     self.provName = self['ISO 3166-2 Subdivision/State Name']
     self.countryCode = self.provCode.split('-')[0]
     self.provOnlyCode = self.provCode.split('-')[1]
コード例 #2
0
    def __init__(self, textline, schema):
        WorksheetEntry.__init__(self, textline, schema)
        self.code = self['Value']
        self.uiLabel = self['UI Label']

        # due to an error in creating the country-codes data, the 'Place Name' field is corrupt
        # and we must derive the place name from the uiLable field
        ## self.name = self['Place Name']
        self.name = self.deriveName()
コード例 #3
0
    def __init__(self, data, schema, num=None):
        """
		worksheet schema: 
			Search Topic, 
			Top 10 Results (Heading+website by clicking), 
			URL, 
			Summary, 
			Key words

		exposed attributes:
			title, url, summary, keywords, num
		"""
        WorksheetEntry.__init__(self, data, schema)
        self.title = self['Top 10 Results (Heading+website by clicking)']
        self.url = self['url']
        self.summary = self['Summary']
        self.keywords = self['Key words'] and map(lambda x: x.strip(),
                                                  self['Key words'].split(','))
        self.num = num or 0
コード例 #4
0
ファイル: lexicon.py プロジェクト: ostwald/python-lib
    def __init__(self, textline, schema):
        WorksheetEntry.__init__(self, textline, schema)
        self.category = self['Lexicon']
        self.term = self._make_term()
        self.id = self['ID']
        self.segments = self.term.split("::")
        self.prettyTerm = " :: ".join(self.segments)

        # ensure there are no underscores in this term
        if '_' in self.term:
            raise KeyError, "UNDERSCORE found in %s" % self.id

        # self.xpath = self.category + "/" + "/".join(map (lambda x:x.replace(' ', '_'), self.segments))
        normalize = lambda x: x.replace(' ', '_').replace(',', '')
        self.xpath = self.category + "/" + "/".join(
            map(normalize, self.segments))

        # raw_path uses original (not normalized) segements and is used in lexicon_stds_doc
        self.raw_xpath = self.category + "/" + "/".join(self.segments)
コード例 #5
0
    def __init__(self, textline, schema):
        WorksheetEntry.__init__(self, textline, schema)
        if 0 and textline.find("25th Conference on Severe Local Storms") != -1:
            print textline
            self.showChars(textline)
            sys.exit()
            debug = 1
        else:
            debug = 0
        self.term = self['Correct']
        self.badterm = self['Incorrect']
        self.pubType = self['pubType']
        self.addto = []
        buf = self['Add to'].strip()

        if buf:
            # debug = 0
            if debug:
                self.showChars(buf)
                # sys.exit()
            self.addto = map(string.strip, buf.split(chr(10)))
コード例 #6
0
 def __init__(self, textline, schema):
     WorksheetEntry.__init__(self, textline, schema)
     self.code = self['Value']
     self.uiLabel = self['UI Label']
     self.country_code = self.uiLabel.split('-')[0].strip()
     self.name = self['Place Name']
コード例 #7
0
 def __init__(self, data, schema):
     WorksheetEntry.__init__(self, data, schema)
     for field in self.schema:
         setattr(self, field, self[field])
コード例 #8
0
	def __init__ (self, data, schema):
		WorksheetEntry.__init__(self, data, schema)
		self.source = self['source (WOS journal) 2011']
		self.pubname = self['Existing OSM pubName'] or self['OSM pubName to Add']
コード例 #9
0
ファイル: sponsor_xls.py プロジェクト: ostwald/python-lib
 def __init__(self, data, schema):
     WorksheetEntry.__init__(self, data, schema)
     self.sponsor = self['sponsor (wos 2011)']
     self.instname = self['Existing OSM instName']
コード例 #10
0
 def __init__(self, textline, schema):
     WorksheetEntry.__init__(self, textline, schema)
     self.badTerm = self['Bad Term']
     self.goodTerm = self['Good Term']
コード例 #11
0
 def __init__(self, textline, schema):
     WorksheetEntry.__init__(self, textline, schema)
     self.recId = self['recId']
コード例 #12
0
 def __init__(self, data, schema):
     WorksheetEntry.__init__(self, data, schema)