def __init__(self, requirements):
self.requirements_ = []<EOL>self.conflict_ = None<EOL>self.requirements_dict = {}<EOL>self.names_ = set()<EOL>self.conflict_names_ = set()<EOL>for req in requirements:<EOL><INDENT>existing_req = self.requirements_dict.get(req.name)<EOL>if existing_req is None:<EOL><INDENT>self.requirements_dict[req.name] = req<EOL><DEDENT>else:<EOL><INDENT>merged_req = existing_req.merged(req)<EOL>if merged_req is None:<EOL><INDENT>self.conflict_ = (existing_req, req)<EOL>return<EOL><DEDENT>else:<EOL><INDENT>self.requirements_dict[req.name] = merged_req<EOL><DEDENT><DEDENT><DEDENT>seen = set()<EOL>for req in requirements:<EOL><INDENT>if req.name not in seen:<EOL><INDENT>seen.add(req.name)<EOL>req_ = self.requirements_dict[req.name]<EOL>self.requirements_.append(req_)<EOL>if req_.conflict:<EOL><INDENT>self.conflict_names_.add(req.name)<EOL><DEDENT>else:<EOL><INDENT>self.names_.add(req.name)<EOL><DEDENT><DEDENT><DEDENT>
Create a RequirementList.

        Args:
            requirements: List of Requirement objects.