d24cfe2257a88b80c2938cc212dcfcc8a329d970,contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/missing_contextmanager.py,MissingContextManager,nits,#MissingContextManager#,23

Before Change


    with_context_exprs = (set(node.context_expr for with_context in with_contexts for node in with_context.items)
                          if PY3 else
                          set(node.context_expr for node in with_contexts))
    with_context_calls = set(expr for expr in with_context_exprs if isinstance(expr, ast.Call))

    for call in self.iter_ast_types(ast.Call):
      if isinstance(call.func, ast.Name) and call.func.id == "open" \
        and (call not in with_context_calls):

After Change


    with_context_exprs = ({node.context_expr for with_context in with_contexts for node in with_context.items}
                          if PY3 else
                          {node.context_expr for node in with_contexts})
    with_context_calls = {expr for expr in with_context_exprs if isinstance(expr, ast.Call)}

    for call in self.iter_ast_types(ast.Call):
      if isinstance(call.func, ast.Name) and call.func.id == "open" \
        and (call not in with_context_calls):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 12

Non-data size: 7

Instances


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/missing_contextmanager.py
Class Name: MissingContextManager
Method Name: nits


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: src/python/pants/backend/graph_info/tasks/cloc.py
Class Name: CountLinesOfCode
Method Name: console_output


Project Name: RasaHQ/rasa
Commit Name: 2a4957c857267d6e00ba34d2e343f0a7a35272b2
Time: 2020-10-20
Author: vladimir@rasa.com
File Name: rasa/core/policies/rule_policy.py
Class Name: RulePolicy
Method Name: _check_prediction


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: tests/python/pants_test/backend/codegen/antlr/python/test_antlr_py_gen.py
Class Name: AntlrPyGenTest
Method Name: test_antlr_py_gen


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: src/python/pants/releases/packages.py
Class Name: Package
Method Name: owners


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: src/python/pants/backend/python/interpreter_cache.py
Class Name: PythonInterpreterCache
Method Name: select_interpreter_for_targets


Project Name: RasaHQ/rasa
Commit Name: 15d7634de14af794c2bdc0ab5a3e4d9817609f2f
Time: 2018-09-28
Author: ric.wkr@gmail.com
File Name: tests/test_agent.py
Class Name:
Method Name: test_agent_with_model_server


Project Name: tensorflow/datasets
Commit Name: 544e3b197e42d32699adc3c6acedd05905c4a5d2
Time: 2020-04-10
Author: cs17btech11040@iith.ac.in
File Name: tensorflow_datasets/core/registered.py
Class Name:
Method Name: _get_all_versions


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: src/python/pants/build_graph/build_file_address_mapper.py
Class Name: BuildFileAddressMapper
Method Name: _raise_incorrect_address_error


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: src/python/pants/releases/packages.py
Class Name:
Method Name: check_ownership


Project Name: brian-team/brian2
Commit Name: 69d286af1811baf67c2eccbd6d6f8329f40aa97f
Time: 2019-04-25
Author: 120003362@sastra.ac.in
File Name: brian2/core/network.py
Class Name: Network
Method Name: _nextclocks


Project Name: pantsbuild/pants
Commit Name: d24cfe2257a88b80c2938cc212dcfcc8a329d970
Time: 2018-08-22
Author: ericarellano@me.com
File Name: src/python/pants/backend/project_info/tasks/export.py
Class Name: ExportTask
Method Name: _source_roots_for_target