nodes: 0, module; 1, function_definition; 2, function_name:read; 3, parameters; 4, block; 5, identifier:self; 6, identifier:given_file; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, with_statement; 12, if_statement; 13, expression_statement; 14, return_statement; 15, comment:"""
          Read given_file to self.contents
          Will ignoring duplicate lines if self.unique is True
          Will sort self.contents after reading file if self.sorted is True
          """; 16, boolean_operator; 17, block; 18, assignment; 19, call; 20, with_clause; 21, block; 22, attribute; 23, block; 24, call; 25, True; 26, comparison_operator:self.unique is not False; 27, comparison_operator:self.unique is not True; 28, raise_statement; 29, attribute; 30, call; 31, attribute; 32, argument_list; 33, with_item; 34, for_statement; 35, identifier:self; 36, identifier:sorted; 37, expression_statement; 38, attribute; 39, argument_list; 40, attribute; 41, False; 42, attribute; 43, True; 44, call; 45, identifier:self; 46, identifier:filename; 47, attribute; 48, argument_list; 49, identifier:self; 50, identifier:log; 51, call; 52, as_pattern; 53, identifier:line; 54, identifier:handle; 55, block; 56, call; 57, identifier:self; 58, identifier:log; 59, call; 60, identifier:self; 61, identifier:unique; 62, identifier:self; 63, identifier:unique; 64, identifier:AttributeError; 65, argument_list; 66, identifier:str; 67, identifier:strip; 68, identifier:given_file; 69, attribute; 70, argument_list; 71, call; 72, as_pattern_target; 73, expression_statement; 74, if_statement; 75, if_statement; 76, attribute; 77, argument_list; 78, attribute; 79, argument_list; 80, string:"Attribute 'unique' is not True or False."; 81, string; 82, identifier:format; 83, attribute; 84, identifier:open; 85, argument_list; 86, identifier:handle; 87, assignment; 88, comparison_operator:line is None; 89, block; 90, boolean_operator; 91, block; 92, identifier:self; 93, identifier:sort; 94, string; 95, identifier:format; 96, call; 97, string_content:Read-only opening {0}; 98, identifier:self; 99, identifier:filename; 100, attribute; 101, string; 102, identifier:line; 103, call; 104, identifier:line; 105, None; 106, expression_statement; 107, comment:# Blank lines that were just \n become None so convert them to empty string.; 108, comparison_operator:self.unique is False; 109, comparison_operator:line not in self.contents; 110, expression_statement; 111, string_content:Read {0} lines.; 112, identifier:len; 113, argument_list; 114, identifier:self; 115, identifier:filename; 116, string_content:r; 117, attribute; 118, argument_list; 119, assignment; 120, attribute; 121, False; 122, identifier:line; 123, attribute; 124, call; 125, attribute; 126, identifier:line; 127, identifier:rstrip; 128, string; 129, identifier:line; 130, string; 131, identifier:self; 132, identifier:unique; 133, identifier:self; 134, identifier:contents; 135, attribute; 136, argument_list; 137, identifier:self; 138, identifier:contents; 139, string_content; 140, attribute; 141, identifier:append; 142, identifier:line; 143, escape_sequence:\r; 144, escape_sequence:\n; 145, identifier:self; 146, identifier:contents
code: def read(self, given_file):
          """
          Read given_file to self.contents
          Will ignoring duplicate lines if self.unique is True
          Will sort self.contents after reading file if self.sorted is True
          """
          if self.unique is not False and self.unique is not True:
              raise AttributeError("Attribute 'unique' is not True or False.")
          self.filename = str.strip(given_file)
          self.log('Read-only opening {0}'.format(self.filename))
          with open(self.filename, 'r') as handle:
              for line in handle:
                  line = line.rstrip('\r\n')
                  if line is None:
                      line = ''  # Blank lines that were just \n become None so convert them to empty string.
                  if self.unique is False or line not in self.contents:
                      self.contents.append(line)
          if self.sorted:
              self.sort()
          self.log('Read {0} lines.'.format(len(self.contents)))
          return True