Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _convert_to_bisect_arg(self, value):
"""
Transform a string value to a date or datetime if it looks like it.
"""
try:
value = parse_date(value)
except DateFormatError:
try:
repo = self.options.repo
if get_name(repo) == "mozilla-release" or (
not repo and re.match(r"^\d+\.\d\.\d$", value)
):
new_value = tag_of_release(value)
if not repo:
self.logger.info("Assuming repo mozilla-release")
self.fetch_config.set_repo("mozilla-release")
self.logger.info("Using tag %s for release %s" % (new_value, value))
value = new_value
elif get_name(repo) == "mozilla-beta" or (
not repo and re.match(r"^\d+\.0b\d+$", value)
):
new_value = tag_of_beta(value)
def get_value(self):
currentw = self.ui.stackedWidget.currentWidget()
if currentw == self.ui.s_date:
return self.ui.date.date().toPython()
elif currentw == self.ui.s_release:
return parse_date(date_of_release(str(self.ui.release.currentText())))
elif currentw == self.ui.s_buildid:
buildid = self.ui.buildid.text()
try:
return parse_date(buildid)
except DateFormatError:
raise DateFormatError(buildid, "Not a valid build id: `%s`")
elif currentw == self.ui.s_changeset:
return self.ui.changeset.text()
def get_value(self):
currentw = self.ui.stackedWidget.currentWidget()
if currentw == self.ui.s_date:
return self.ui.date.date().toPython()
elif currentw == self.ui.s_release:
return parse_date(date_of_release(str(self.ui.release.currentText())))
elif currentw == self.ui.s_buildid:
buildid = self.ui.buildid.text()
try:
return parse_date(buildid)
except DateFormatError:
raise DateFormatError(buildid, "Not a valid build id: `%s`")
elif currentw == self.ui.s_changeset:
return self.ui.changeset.text()
if not repo:
self.logger.info("Assuming repo mozilla-release")
self.fetch_config.set_repo("mozilla-release")
self.logger.info("Using tag %s for release %s" % (new_value, value))
value = new_value
elif get_name(repo) == "mozilla-beta" or (
not repo and re.match(r"^\d+\.0b\d+$", value)
):
new_value = tag_of_beta(value)
if not repo:
self.logger.info("Assuming repo mozilla-beta")
self.fetch_config.set_repo("mozilla-beta")
self.logger.info("Using tag %s for release %s" % (new_value, value))
value = new_value
else:
new_value = parse_date(date_of_release(value))
self.logger.info("Using date %s for release %s" % (new_value, value))
value = new_value
except UnavailableRelease:
self.logger.info("%s is not a release, assuming it's a hash..." % value)
return value