Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _getYearBefore(date):
""" Returns an ISO8601-formatted date that is exactly one year earlier than
the given date """
# Get the tuple of year, month, day etc
newDate = tuple([date[0] - 1] + list(date[1:]))
return iso8601.tostring(time.mktime(newDate))
self._snarf_emails_from_gce(gce)
self._snarf_postal_from_gce(gce)
self._snarf_org_details_from_gce(gce)
self._snarf_phones_and_faxes_from_gce(gce)
self._snarf_dates_from_gce(gce)
self._snarf_websites_from_gce(gce)
self._snarf_ims_from_gce(gce)
self._snarf_sync_tags_from_gce(gce)
self._snarf_custom_props_from_gce(gce)
# Google entries do not have a created entry. We should just set it to
# the current time, and take it from there.
if not self.get_created():
self.set_created(iso8601.tostring(time.time()))
self.set_updated(iso8601.tostring(time.time()))
output.write(" default=\"%s\">" % vars[vid].zvalues[0])
firstTime = 1
for z in vars[vid].zvalues:
if firstTime:
firstTime = 0
else:
output.write(",")
output.write(str(z))
output.write("")
# Set the time dimension
if len(vars[vid].tvalues) > 0:
output.write("" %
iso8601.tostring(vars[vid].tvalues[-1]))
firstTime = 1
for t in vars[vid].tvalues:
if firstTime:
firstTime = 0
else:
output.write(",")
output.write(iso8601.tostring(t))
output.write("")
output.write("") # end of variable Layer
output.write("") # end of dataset layer
output.write("") # end of top-level container layer
output.write("")
output.write("")
def set_last_sync_start (self, profile, val=None, sync=True):
if not val:
val = iso8601.tostring(time.time())
return self._set_profile_prop(profile, 'last_sync_start', val, sync)
def get_curr_time (self):
return iso8601.tostring(time.time())
# Check for fill values, replacing with "None"
datavalues = [_checkFillValue(val, _getFillValue()) for val in datavalues]
req.content_type = info_format
# Output in simple XML. TODO make this GeoRSS and/or KML?
if info_format == "text/xml":
req.write("\n")
req.write("")
req.write("%f" % lon)
req.write("%f" % lat)
for i in xrange(len(tIndices)):
req.write("")
if len(var.tvalues) > 0:
tval = var.tvalues[tIndices[i]]
req.write("<time>%s</time>" % iso8601.tostring(tval))
if datavalues[i] is None:
req.write("none")
else:
req.write("%s" % str(datavalues[i]))
req.write("")
req.write("")
else:
# Output the data as a PNG JFreeChart (most useful for timeseries)
# TODO: this needs to be separated to preserve pure Python
ts = TimeSeries("Data", Millisecond)
for i in xrange(len(tIndices)):
tval = var.tvalues[tIndices[i]]
tvalLong = Double(tval * 1000).longValue()
date = Date(tvalLong)
ts.add(Millisecond(date), datavalues[i])
xydataset = TimeSeriesCollection()
doc.write("")
datasets = config.datasets
for ds in datasets.keys():
if datasets[ds].ready:
doc.write("%s" % datasets[ds].title)
vars = datasets[ds].variables
for format in getmap.getSupportedImageFormats():
doc.write("")
for varID in vars.keys():
doc.write("<a in="" for="" href="\"%s?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=&CRS=CRS:84&WIDTH=256&HEIGHT=256&FORMAT=%s&TRANSPARENT=true""> 0:
doc.write("&TIME=%s" % iso8601.tostring(tvals[-1]))
doc.write("\">%s</a><br>" % vars[varID].title)
doc.write("")
if config.server.allowFeatureInfo:
doc.write("")
if datasets[ds].queryable:
for varID in vars.keys():
doc.write("<a in="" for="" href="\"%s?SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=1.3.0&CRS=CRS:84&WIDTH=256&HEIGHT=256&INFO_FORMAT=text/xml""> 0:
doc.write("&TIME=%s" % iso8601.tostring(tvals[-1]))
doc.write("\">%s</a><br>" % vars[varID].title)
else:
def _getMonthAfter(date):
""" Returns an ISO8601-formatted date that is exactly one month later than
the given date """
if date[1] == 12:
month = 1
year = date[0] + 1
else:
month = date[1] + 1
year = date[0]
newDate = tuple([year] + [month] + list(date[2:]))
return iso8601.tostring(time.mktime(newDate))
self._snarf_group_membership_from_gce(gce)
self._snarf_emails_from_gce(gce)
self._snarf_postal_from_gce(gce)
self._snarf_org_details_from_gce(gce)
self._snarf_phones_and_faxes_from_gce(gce)
self._snarf_dates_from_gce(gce)
self._snarf_websites_from_gce(gce)
self._snarf_ims_from_gce(gce)
self._snarf_sync_tags_from_gce(gce)
self._snarf_custom_props_from_gce(gce)
# Google entries do not have a created entry. We should just set it to
# the current time, and take it from there.
if not self.get_created():
self.set_created(iso8601.tostring(time.time()))
self.set_updated(iso8601.tostring(time.time()))