def __init__(self, target, branch, build, flags, platform=None):
if target not in self.TARGET_CHOICES:<EOL><INDENT>raise FetcherException("<STR_LIT>" % target)<EOL><DEDENT>self._memo = {'<STR_LIT>': target}<EOL>"<STR_LIT>"<EOL>self._branch = branch<EOL>self._flags = BuildFlags(*flags)<EOL>self._platform = platform or Platform()<EOL>if isinstance(build, BuildTask):<EOL><INDENT>self._task = build<EOL><DEDENT>else:<EOL><INDENT>self._task = BuildTask(build, branch, self._flags, self._platform)<EOL>now = datetime.now(timezone('<STR_LIT>'))<EOL>if build == '<STR_LIT>' and (now - self.build_datetime).total_seconds() > <NUM_LIT>:<EOL><INDENT>LOG.warning('<STR_LIT>', self.build_id)<EOL><DEDENT>if re.search(self.moz_info["<STR_LIT>"].replace('<STR_LIT:->', '<STR_LIT>'), build) is not None:<EOL><INDENT>if self._branch is None:<EOL><INDENT>branch = re.search(r'<STR_LIT>', build)<EOL>self._branch = branch.group('<STR_LIT>') if branch is not None else '<STR_LIT:?>'<EOL><DEDENT>asan, debug, fuzzing, coverage, valgrind = self._flags<EOL>if not debug:<EOL><INDENT>debug = '<STR_LIT>' in build or '<STR_LIT>' in build<EOL><DEDENT>if not asan:<EOL><INDENT>asan = '<STR_LIT>' in build<EOL><DEDENT>if not fuzzing:<EOL><INDENT>fuzzing = '<STR_LIT>' in build<EOL><DEDENT>if not coverage:<EOL><INDENT>coverage = '<STR_LIT>' in build<EOL><DEDENT>if not valgrind:<EOL><INDENT>valgrind = '<STR_LIT>' in build<EOL><DEDENT>self._flags = BuildFlags(asan, debug, fuzzing, coverage, valgrind)<EOL>if self._branch != '<STR_LIT:?>' and self._branch not in build:<EOL><INDENT>raise FetcherException("<STR_LIT>"<EOL>"<STR_LIT>" % (build, self._branch))<EOL><DEDENT>if self._flags.asan and '<STR_LIT>' not in build:<EOL><INDENT>raise FetcherException("<STR_LIT>"<EOL>"<STR_LIT>" % build)<EOL><DEDENT>if self._flags.debug and not ('<STR_LIT>' in build or '<STR_LIT>' in build):<EOL><INDENT>raise FetcherException("<STR_LIT>"<EOL>"<STR_LIT>" % build)<EOL><DEDENT>if self._flags.fuzzing and '<STR_LIT>' not in build:<EOL><INDENT>raise FetcherException("<STR_LIT>"<EOL>"<STR_LIT>" % build)<EOL><DEDENT>if self._flags.coverage and '<STR_LIT>' not in build:<EOL><INDENT>raise FetcherException("<STR_LIT>"<EOL>"<STR_LIT>" % build)<EOL><DEDENT>if self._flags.valgrind and '<STR_LIT>' not in build:<EOL><INDENT>raise FetcherException("<STR_LIT>"<EOL>"<STR_LIT>" % build)<EOL><DEDENT><DEDENT><DEDENT>if not isinstance(build, BuildTask) and self.moz_info["<STR_LIT>"] in build:<EOL><INDENT>options = build.split(self.moz_info["<STR_LIT>"], <NUM_LIT:1>)[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>options = self._flags.build_string()<EOL><DEDENT>self._auto_name = '<STR_LIT>' % (self._platform.auto_name_prefix(), self._branch[<NUM_LIT:0>], self.build_id, options)<EOL>
@type target: string
@param target: the download target, eg. 'js', 'firefox'

@type branch: string
@param branch: a valid gecko branch, eg. 'central', 'inbound', 'beta', 'release', 'esr52', etc.

@type build: string
@param build: build identifier. acceptable identifers are: TaskCluster namespace, hg changeset, date, 'latest'

@type flags: BuildFlags or sequence of booleans
@param flags: ('asan', 'debug', 'fuzzing', 'coverage', 'valgrind'),
              each a bool, not all combinations exist in TaskCluster

@type platform: Platform
@param platform: force platform if different than current system