diff --git a/mypy/main.py b/mypy/main.py index bf1c3648ff45..943030f396c5 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -1498,7 +1498,7 @@ def read_types_packages_to_install(cache_dir: str, after_run: bool) -> list[str] # No missing stubs. return [] with open(fnam) as f: - return [line.strip() for line in f.readlines()] + return [line.strip() for line in f] def install_types( diff --git a/mypy/stubtest.py b/mypy/stubtest.py index ca25c2a870e5..7b4a3b223e00 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1667,7 +1667,7 @@ def strip_comments(s: str) -> str: return s.strip() with open(allowlist_file) as f: - for line in f.readlines(): + for line in f: entry = strip_comments(line) if entry: yield entry diff --git a/mypyc/irbuild/expression.py b/mypyc/irbuild/expression.py index 3aad620dfacf..30537777fcc1 100644 --- a/mypyc/irbuild/expression.py +++ b/mypyc/irbuild/expression.py @@ -812,10 +812,10 @@ def transform_basic_comparison( if ( is_int_rprimitive(left.type) and is_int_rprimitive(right.type) - and op in int_comparison_op_mapping.keys() + and op in int_comparison_op_mapping ): return builder.compare_tagged(left, right, op, line) - if is_fixed_width_rtype(left.type) and op in int_comparison_op_mapping.keys(): + if is_fixed_width_rtype(left.type) and op in int_comparison_op_mapping: if right.type == left.type: op_id = ComparisonOp.signed_ops[op] return builder.builder.comparison_op(left, right, op_id, line) @@ -826,7 +826,7 @@ def transform_basic_comparison( ) elif ( is_fixed_width_rtype(right.type) - and op in int_comparison_op_mapping.keys() + and op in int_comparison_op_mapping and isinstance(left, Integer) ): op_id = ComparisonOp.signed_ops[op]