b538f8e02f54afe537e0b0cecdddcd63d8740daa,src/python/pants/engine/legacy/parser.py,LegacyPythonCallbacksParser,parse,#LegacyPythonCallbacksParser#Any#Any#,127

Before Change


      io_wrapped_python = StringIO(python)
      for token in tokenize.generate_tokens(io_wrapped_python.readline):
        if token[1] == "import":
          line_being_tokenized = token[4]
          if self._build_file_imports_behavior == "warn":
            logger.warning("{} tried to import - import statements should be avoided ({})".format(
              filepath,
              line_being_tokenized
            ))
          elif self._build_file_imports_behavior == "error":
            raise ParseError(
              "import statements have been banned, but tried to import: {}".format(
                line_being_tokenized
              )
            )
          else:
            raise ParseError(
              "Didn"t know what to do for build_file_imports_behavior value {}".format(
                self._build_file_imports_behavior
              )
            )

    return list(self._parse_context._storage.objects)

After Change


      io_wrapped_python = StringIO(python)
      for token in tokenize.generate_tokens(io_wrapped_python.readline):
        token_str = token[1]
        lineno, _ = token[2]

        self.check_for_deprecated_globs_usage(token_str, filepath, lineno)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: b538f8e02f54afe537e0b0cecdddcd63d8740daa
Time: 2020-01-31
Author: ericarellano@me.com
File Name: src/python/pants/engine/legacy/parser.py
Class Name: LegacyPythonCallbacksParser
Method Name: parse


Project Name: google-research/language
Commit Name: b4562327a4554689d8ab0906c605476ccf817336
Time: 2019-11-15
Author: kentonl@google.com
File Name: language/xsp/data_preprocessing/abstract_sql.py
Class Name:
Method Name: _get_from_clause_for_tables


Project Name: pantsbuild/pants
Commit Name: 65cd3bc9338aeb7efe02c13eea9e7b9def3435b9
Time: 2015-10-29
Author: benjyw@gmail.com
File Name: src/python/pants/option/parser.py
Class Name: Parser
Method Name: register