Ejemplo n.º 1
0
def test_translateyears():
    """See that we can translate years properly"""
    x = translate_years("X ('07-'17)")
    assert x[0] == 2007
    x = translate_years("X ('98-'06)")
    assert x[0] == 1998
    assert x[-1] == 2006
    x = translate_years("X ('14, '15, '16, '17)")
    assert x[0] == 2014
    assert x[-1] == 2017
    x = translate_years("X ('06)")
    assert x[0] == 2006
Ejemplo n.º 2
0
 def test_translateyears(self):
     """See that we can translate years properly"""
     x = translate_years("X ('07-'17)")
     self.assertEquals(x[0], 2007)
     x = translate_years("X ('98-'06)")
     self.assertEquals(x[0], 1998)
     self.assertEquals(x[-1], 2006)
     x = translate_years("X ('14, '15, '16, '17)")
     self.assertEquals(x[0], 2014)
     self.assertEquals(x[-1], 2017)
     x = translate_years("X ('06)")
     self.assertEquals(x[0], 2006)
Ejemplo n.º 3
0
 def test_translateyears(self):
     """See that we can translate years properly"""
     x = translate_years("X ('07-'17)")
     self.assertEquals(x[0], 2007)
     x = translate_years("X ('98-'06)")
     self.assertEquals(x[0], 1998)
     self.assertEquals(x[-1], 2006)
     x = translate_years("X ('14, '15, '16, '17)")
     self.assertEquals(x[0], 2014)
     self.assertEquals(x[-1], 2017)
     x = translate_years("X ('06)")
     self.assertEquals(x[0], 2006)
Ejemplo n.º 4
0
ssheet.get_worksheets()
sheet = ssheet.worksheets["Data Collected"]
# We can't use the list feed as it corrupts the site IDs
sheet.get_cell_feed()
myrow = None
for i in range(1, sheet.rows + 1):
    if sheet.get_cell_value(i, 1) == "WAT1":
        myrow = i
        break
years = {}
for col in range(2, sheet.cols + 1):
    site = sheet.get_cell_value(1, col)
    if site not in sites:
        continue
    val = sheet.get_cell_value(myrow, col)
    years[site] = util.translate_years(val)

# Now we dance
NOT_DONE = ["BATH_A", "TIDE_NEW", "TIDE_OLD"]
for site in sites:
    if site not in NOT_DONE:
        continue
    print("---- Processing: %s -----" % (site,))
    # Compute the base folder
    foldername = "%s - %s" % (site, pis[site])
    res = (
        drive.files()
        .list(
            q=(
                "mimeType = 'application/vnd.google-apps.folder' and title = '%s'"
                " and '%s' in parents"
Ejemplo n.º 5
0
ssheet.get_worksheets()
sheet = ssheet.worksheets['Data Collected']
# We can't use the list feed as it corrupts the site IDs
sheet.get_cell_feed()
myrow = None
for i in range(1, sheet.rows + 1):
    if sheet.get_cell_value(i, 1) == 'WAT4':
        myrow = i
        break
years = {}
for col in range(2, sheet.cols + 1):
    site = sheet.get_cell_value(1, col)
    if site not in sites:
        continue
    val = sheet.get_cell_value(myrow, col)
    years[site] = util.translate_years(val)

# Now we dance
NOT_DONE = ['BATH_A', 'TIDE_NEW', 'TIDE_OLD']
for site in sites:
    if site not in NOT_DONE:
        continue
    if years[site] is None or len(years[site]) == 0:
        continue
    print("---------- Processing %s -----------" % (site, ))
    # Compute the base folder
    foldername = "%s - %s" % (site, pis[site])
    res = util.exponential_backoff(drive.files().list(
        q=("mimeType = 'application/vnd.google-apps.folder' and title = '%s'"
           " and '%s' in parents"
           ) % (foldername, config['td']['syncfolder'])).execute)