after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def __init__(self, contract_name, lvalue):
assert isinstance(contract_name, Constant)
assert is_valid_lvalue(lvalue)
super(NewContract, self).__init__()
self._contract_name = contract_name
# todo create analyze to add the contract instance
self._lvalue = lvalue
self._callid = None # only us... | def __init__(self, contract_name, lvalue):
assert isinstance(contract_name, Constant)
assert is_valid_lvalue(lvalue)
super(NewContract, self).__init__()
self._contract_name = contract_name
# todo create analyze to add the contract instance
self._lvalue = lvalue
self._callid = None # only us... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def __str__(self):
options = ""
if self.call_value:
options = "value:{} ".format(self.call_value)
if self.call_salt:
options += "salt:{} ".format(self.call_salt)
args = [str(a) for a in self.arguments]
return "{} = new {}({}) {}".format(
self.lvalue, self.contract_name, ",".j... | def __str__(self):
value = ""
if self.call_value:
value = "value:{}".format(self.call_value)
args = [str(a) for a in self.arguments]
return "{} = new {}({}) {}".format(
self.lvalue, self.contract_name, ",".join(args), value
)
| https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def __init__(self, called, nbr_arguments, result, type_call):
assert isinstance(
called,
(
Contract,
Variable,
SolidityVariableComposed,
SolidityFunction,
Structure,
Event,
),
)
super(TmpCall, self).__init__()
... | def __init__(self, called, nbr_arguments, result, type_call):
assert isinstance(
called,
(
Contract,
Variable,
SolidityVariableComposed,
SolidityFunction,
Structure,
Event,
),
)
super(TmpCall, self).__init__()
... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def __init__(self, contract_name, lvalue):
super(TmpNewContract, self).__init__()
self._contract_name = contract_name
self._lvalue = lvalue
self._call_value = None
self._call_salt = None
| def __init__(self, contract_name, lvalue):
super(TmpNewContract, self).__init__()
self._contract_name = contract_name
self._lvalue = lvalue
| https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def copy_ir(ir, *instances):
"""
Args:
ir (Operation)
local_variables_instances(dict(str -> LocalVariable))
state_variables_instances(dict(str -> StateVariable))
temporary_variables_instances(dict(int -> Variable))
reference_variables_instances(dict(int -> Variable))
... | def copy_ir(ir, *instances):
"""
Args:
ir (Operation)
local_variables_instances(dict(str -> LocalVariable))
state_variables_instances(dict(str -> StateVariable))
temporary_variables_instances(dict(int -> Variable))
reference_variables_instances(dict(int -> Variable))
... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def parse_call(expression, caller_context):
src = expression["src"]
if caller_context.is_compact_ast:
attributes = expression
type_conversion = expression["kind"] == "typeConversion"
type_return = attributes["typeDescriptions"]["typeString"]
else:
attributes = expression["at... | def parse_call(expression, caller_context):
src = expression["src"]
if caller_context.is_compact_ast:
attributes = expression
type_conversion = expression["kind"] == "typeConversion"
type_return = attributes["typeDescriptions"]["typeString"]
else:
attributes = expression["at... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def parse_expression(expression, caller_context):
"""
Returns:
str: expression
"""
# Expression
# = Expression ('++' | '--')
# | NewExpression
# | IndexAccess
# | MemberAccess
# | FunctionCall
# | '(' Expression ')'
# | ('!' | '~' | 'delete' | '... | def parse_expression(expression, caller_context):
"""
Returns:
str: expression
"""
# Expression
# = Expression ('++' | '--')
# | NewExpression
# | IndexAccess
# | MemberAccess
# | FunctionCall
# | '(' Expression ')'
# | ('!' | '~' | 'delete' | '... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def _visit_call_expression(self, expression):
self._visit_expression(expression.called)
for arg in expression.arguments:
if arg:
self._visit_expression(arg)
if expression.call_value:
self._visit_expression(expression.call_value)
if expression.call_gas:
self._visit_exp... | def _visit_call_expression(self, expression):
self._visit_expression(expression.called)
for arg in expression.arguments:
if arg:
self._visit_expression(arg)
if expression.call_value:
self._visit_expression(expression.call_value)
if expression.call_gas:
self._visit_exp... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def _post_call_expression(self, expression):
called = get(expression.called)
args = [get(a) for a in expression.arguments if a]
for arg in args:
arg_ = Argument(arg)
arg_.set_expression(expression)
self._result.append(arg_)
if isinstance(called, Function):
# internal call... | def _post_call_expression(self, expression):
called = get(expression.called)
args = [get(a) for a in expression.arguments if a]
for arg in args:
arg_ = Argument(arg)
arg_.set_expression(expression)
self._result.append(arg_)
if isinstance(called, Function):
# internal call... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def _post_new_contract(self, expression):
val = TemporaryVariable(self._node)
operation = TmpNewContract(expression.contract_name, val)
operation.set_expression(expression)
if expression.call_value:
call_value = get(expression.call_value)
operation.call_value = call_value
if expressi... | def _post_new_contract(self, expression):
val = TemporaryVariable(self._node)
operation = TmpNewContract(expression.contract_name, val)
operation.set_expression(expression)
self._result.append(operation)
set_val(expression, val)
| https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def choose_printers(args, all_printer_classes):
printers_to_run = []
# disable default printer
if args.printers_to_run is None:
return []
if args.printers_to_run == "all":
return all_printer_classes
printers = {p.ARGUMENT: p for p in all_printer_classes}
for p in args.printers... | def choose_printers(args, all_printer_classes):
printers_to_run = []
# disable default printer
if args.printers_to_run is None:
return []
printers = {p.ARGUMENT: p for p in all_printer_classes}
for p in args.printers_to_run.split(","):
if p in printers:
printers_to_run.... | https://github.com/crytic/slither/issues/207 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 512, in main_impl
extension = "*.sol" if not args.solc_ast else "*.json"
AttributeError: 'Namespace' object has no attribute 'solc_ast' | AttributeError |
def parse_args(detector_classes, printer_classes):
parser = argparse.ArgumentParser(
description="Slither. For usage information, see https://github.com/crytic/slither/wiki/Usage",
usage="slither.py contract.sol [flag]",
)
parser.add_argument("filename", help="contract.sol")
cryticpars... | def parse_args(detector_classes, printer_classes):
parser = argparse.ArgumentParser(
description="Slither. For usage information, see https://github.com/crytic/slither/wiki/Usage",
usage="slither.py contract.sol [flag]",
)
parser.add_argument("filename", help="contract.sol")
cryticpars... | https://github.com/crytic/slither/issues/207 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 512, in main_impl
extension = "*.sol" if not args.solc_ast else "*.json"
AttributeError: 'Namespace' object has no attribute 'solc_ast' | AttributeError |
def process_truffle(dirname, args, detector_classes, printer_classes):
# Truffle on windows has naming conflicts where it will invoke truffle.js directly instead
# of truffle.cmd (unless in powershell or git bash). The cleanest solution is to explicitly call
# truffle.cmd. Reference:
# https://trufflefr... | def process_truffle(dirname, args, detector_classes, printer_classes):
if not args.ignore_truffle_compile:
cmd = ["truffle", "compile"]
if args.truffle_version:
cmd = ["npx", args.truffle_version, "compile"]
elif os.path.isfile("package.json"):
with open("package.json... | https://github.com/crytic/slither/issues/173 | INFO:Slither:'truffle compile' running (use --truffle-version truffle@x.x.x to use specific version)
ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 471, in main_impl
(results, number_contracts) = process_truffle(filename, args... | FileNotFoundError |
def __init__(self, t, length):
assert isinstance(t, Type)
if length:
if isinstance(length, int):
length = Literal(length)
assert isinstance(length, Expression)
if not isinstance(length, Literal):
cf = ConstantFolding(length)
length = cf.result()
su... | def __init__(self, t, length):
assert isinstance(t, Type)
if length:
if isinstance(length, int):
length = Literal(length)
assert isinstance(length, Expression)
super(ArrayType, self).__init__()
self._type = t
self._length = length
| https://github.com/crytic/slither/issues/144 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 278, in main_impl
(results_tmp, number_contracts_tmp) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 40, in proces... | AttributeError |
def __init__(self, function, contract):
super(FunctionSolc, self).__init__()
self._contract = contract
if self.is_compact_ast:
self._name = function["name"]
else:
self._name = function["attributes"][self.get_key()]
self._functionNotParsed = function
self._params_was_analyzed = Fa... | def __init__(self, function, contract):
super(FunctionSolc, self).__init__()
self._contract = contract
if self.is_compact_ast:
self._name = function["name"]
else:
self._name = function["attributes"][self.get_key()]
self._functionNotParsed = function
self._params_was_analyzed = Fa... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def _parse_variable_definition(self, statement, node):
try:
local_var = LocalVariableSolc(statement)
local_var.set_function(self)
local_var.set_offset(statement["src"], self.contract.slither)
self._add_local_variable(local_var)
# local_var.analyze(self)
new_node = s... | def _parse_variable_definition(self, statement, node):
try:
local_var = LocalVariableSolc(statement)
local_var.set_function(self)
local_var.set_offset(statement["src"], self.contract.slither)
self._variables[local_var.name] = local_var
# local_var.analyze(self)
new_... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def _parse_variable_definition_init_tuple(self, statement, index, node):
local_var = LocalVariableInitFromTupleSolc(statement, index)
# local_var = LocalVariableSolc(statement[self.get_children('children')][0], statement[self.get_children('children')][1::])
local_var.set_function(self)
local_var.set_off... | def _parse_variable_definition_init_tuple(self, statement, index, node):
local_var = LocalVariableInitFromTupleSolc(statement, index)
# local_var = LocalVariableSolc(statement[self.get_children('children')][0], statement[self.get_children('children')][1::])
local_var.set_function(self)
local_var.set_off... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def _parse_params(self, params):
assert params[self.get_key()] == "ParameterList"
if self.is_compact_ast:
params = params["parameters"]
else:
params = params[self.get_children("children")]
for param in params:
assert param[self.get_key()] == "VariableDeclaration"
local... | def _parse_params(self, params):
assert params[self.get_key()] == "ParameterList"
if self.is_compact_ast:
params = params["parameters"]
else:
params = params[self.get_children("children")]
for param in params:
assert param[self.get_key()] == "VariableDeclaration"
local... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def _parse_returns(self, returns):
assert returns[self.get_key()] == "ParameterList"
if self.is_compact_ast:
returns = returns["parameters"]
else:
returns = returns[self.get_children("children")]
for ret in returns:
assert ret[self.get_key()] == "VariableDeclaration"
l... | def _parse_returns(self, returns):
assert returns[self.get_key()] == "ParameterList"
if self.is_compact_ast:
returns = returns["parameters"]
else:
returns = returns[self.get_children("children")]
for ret in returns:
assert ret[self.get_key()] == "VariableDeclaration"
l... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def find_variable(var_name, caller_context, referenced_declaration=None):
if isinstance(caller_context, Contract):
function = None
contract = caller_context
elif isinstance(caller_context, Function):
function = caller_context
contract = function.contract
else:
logger.... | def find_variable(var_name, caller_context, referenced_declaration=None):
if isinstance(caller_context, Contract):
function = None
contract = caller_context
elif isinstance(caller_context, Function):
function = caller_context
contract = function.contract
else:
logger.... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def __init__(self, var):
"""
A variable can be declared through a statement, or directly.
If it is through a statement, the following children may contain
the init value.
It may be possible that the variable is declared through a statement,
but the init value is declared at the VariableDeclarati... | def __init__(self, var):
"""
A variable can be declared through a statement, or directly.
If it is through a statement, the following children may contain
the init value.
It may be possible that the variable is declared through a statement,
but the init value is declared at the VariableDeclarati... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def _init_from_declaration(self, var, init):
if self._is_compact_ast:
attributes = var
self._typeName = attributes["typeDescriptions"]["typeString"]
else:
assert len(var["children"]) <= 2
assert var["name"] == "VariableDeclaration"
attributes = var["attributes"]
... | def _init_from_declaration(self, var, init):
if self._is_compact_ast:
attributes = var
self._typeName = attributes["typeDescriptions"]["typeString"]
else:
assert len(var["children"]) <= 2
assert var["name"] == "VariableDeclaration"
attributes = var["attributes"]
... | https://github.com/crytic/slither/issues/151 | ERROR:root:Error in test.sol
ERROR:root:Traceback (most recent call last):
File "/Users/matt/anaconda3/lib/python3.7/site-packages/slither_analyzer-0.5.0-py3.7.egg/slither/__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/Users/matt/anac... | AssertionError |
def generate_ssa_irs(
node,
local_variables_instances,
all_local_variables_instances,
state_variables_instances,
all_state_variables_instances,
init_local_variables_instances,
visited,
):
if node in visited:
return
if node.type in [NodeType.ENDIF, NodeType.ENDLOOP] and any(
... | def generate_ssa_irs(
node,
local_variables_instances,
all_local_variables_instances,
state_variables_instances,
all_state_variables_instances,
init_local_variables_instances,
visited,
):
if node in visited:
return
if node.type in [NodeType.ENDIF, NodeType.ENDLOOP] and any(
... | https://github.com/crytic/slither/issues/143 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 341, in _convert_to_slithir
contract.convert_expression_to_slithir()
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\contract.py", line 386, in convert_e... | TypeError |
def __init__(self, local_variable):
assert isinstance(local_variable, LocalVariable)
super(LocalIRVariable, self).__init__()
# initiate ChildContract
self.set_function(local_variable.function)
# initiate Variable
self._name = local_variable.name
self._initial_expression = local_variable.e... | def __init__(self, local_variable):
assert isinstance(local_variable, LocalVariable)
super(LocalIRVariable, self).__init__()
# initiate ChildContract
self.set_function(local_variable.function)
# initiate Variable
self._name = local_variable.name
self._initial_expression = local_variable.e... | https://github.com/crytic/slither/issues/143 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 341, in _convert_to_slithir
contract.convert_expression_to_slithir()
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\contract.py", line 386, in convert_e... | TypeError |
def propage_type_and_convert_call(result, node):
calls_value = {}
calls_gas = {}
call_data = []
idx = 0
# use of while len() as result can be modified during the iteration
while idx < len(result):
ins = result[idx]
if isinstance(ins, TmpCall):
new_ins = extract_tmp... | def propage_type_and_convert_call(result, node):
calls_value = {}
calls_gas = {}
call_data = []
idx = 0
# use of while len() as result can be modified during the iteration
while idx < len(result):
ins = result[idx]
if isinstance(ins, TmpCall):
new_ins = extract_tmp... | https://github.com/crytic/slither/issues/135 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slithe... | AttributeError |
def extract_tmp_call(ins):
assert isinstance(ins, TmpCall)
if isinstance(ins.called, Variable) and isinstance(ins.called.type, FunctionType):
call = InternalDynamicCall(ins.lvalue, ins.called, ins.called.type)
call.call_id = ins.call_id
return call
if isinstance(ins.ori, Member):
... | def extract_tmp_call(ins):
assert isinstance(ins, TmpCall)
if isinstance(ins.ori, Member):
if isinstance(ins.ori.variable_left, Contract):
st = ins.ori.variable_left.get_structure_from_name(ins.ori.variable_right)
if st:
op = NewStructure(st, ins.lvalue)
... | https://github.com/crytic/slither/issues/135 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slithe... | AttributeError |
def __init__(self, lvalue, function, function_type):
assert isinstance(function_type, FunctionType)
assert isinstance(function, Variable)
assert is_valid_lvalue(lvalue) or lvalue is None
super(InternalDynamicCall, self).__init__()
self._function = function
self._function_type = function_type
... | def __init__(self, lvalue, function, function_type):
assert isinstance(function_type, FunctionType)
assert isinstance(function, Variable)
assert is_valid_lvalue(lvalue) or lvalue is None
super(InternalDynamicCall, self).__init__()
self._function = function
self._function_type = function_type
... | https://github.com/crytic/slither/issues/135 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slithe... | AttributeError |
def __str__(self):
value = ""
gas = ""
args = [str(a) for a in self.arguments]
if self.call_value:
value = "value:{}".format(self.call_value)
if self.call_gas:
gas = "gas:{}".format(self.call_gas)
if not self.lvalue:
lvalue = ""
elif isinstance(self.lvalue.type, (list... | def __str__(self):
args = [str(a) for a in self.arguments]
if not self.lvalue:
lvalue = ""
elif isinstance(self.lvalue.type, (list,)):
lvalue = "{}({}) = ".format(
self.lvalue, ",".join(str(x) for x in self.lvalue.type)
)
else:
lvalue = "{}({}) = ".format(self... | https://github.com/crytic/slither/issues/135 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slithe... | AttributeError |
def __init__(self, t, length):
assert isinstance(t, Type)
if length:
if isinstance(length, int):
length = Literal(length)
assert isinstance(length, Expression)
super(ArrayType, self).__init__()
self._type = t
self._length = length
| def __init__(self, t, length):
assert isinstance(t, Type)
if length:
assert isinstance(length, Expression)
super(ArrayType, self).__init__()
self._type = t
self._length = length
| https://github.com/crytic/slither/issues/139 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slithe... | AssertionError |
def _post_index_access(self, expression):
left = get(expression.expression_left)
right = get(expression.expression_right)
val = ReferenceVariable(self._node)
# access to anonymous array
# such as [0,1][x]
if isinstance(left, list):
init_array_val = TemporaryVariable(self._node)
i... | def _post_index_access(self, expression):
left = get(expression.expression_left)
right = get(expression.expression_right)
val = ReferenceVariable(self._node)
operation = Index(val, left, right, expression.type)
self._result.append(operation)
set_val(expression, val)
| https://github.com/crytic/slither/issues/139 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slithe... | AssertionError |
def analyze_content(self):
if self._content_was_analyzed:
return
self._content_was_analyzed = True
if self.is_compact_ast:
body = self._functionNotParsed["body"]
if body and body[self.get_key()] == "Block":
self._is_implemented = True
self._parse_cfg(body)
... | def analyze_content(self):
if self._content_was_analyzed:
return
self._content_was_analyzed = True
if self.is_compact_ast:
body = self._functionNotParsed["body"]
if body and body[self.get_key()] == "Block":
self._is_implemented = True
self._parse_cfg(body)
... | https://github.com/crytic/slither/issues/140 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 341, in _convert_to_slithir
contract.convert_expression_to_slithir()
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\contract.py", line 367, in convert_e... | Exception |
def analyze_content(self):
if self._content_was_analyzed:
return
self._content_was_analyzed = True
if self.is_compact_ast:
body = self._functionNotParsed["body"]
if body and body[self.get_key()] == "Block":
self._is_implemented = True
self._parse_cfg(body)
... | def analyze_content(self):
if self._content_was_analyzed:
return
self._content_was_analyzed = True
if self.is_compact_ast:
body = self._functionNotParsed["body"]
if body and body[self.get_key()] == "Block":
self._is_implemented = True
self._parse_cfg(body)
... | https://github.com/crytic/slither/issues/140 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 341, in _convert_to_slithir
contract.convert_expression_to_slithir()
File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\contract.py", line 367, in convert_e... | Exception |
def _parse_dowhile(self, doWhilestatement, node):
node_startDoWhile = self._new_node(NodeType.STARTLOOP, doWhilestatement["src"])
node_condition = self._new_node(NodeType.IFLOOP, doWhilestatement["src"])
if self.is_compact_ast:
node_condition.add_unparsed_expression(doWhilestatement["condition"])
... | def _parse_dowhile(self, doWhilestatement, node):
node_startDoWhile = self._new_node(NodeType.STARTLOOP, doWhilestatement["src"])
node_condition = self._new_node(NodeType.IFLOOP, doWhilestatement["src"])
if self.is_compact_ast:
node_condition.add_unparsed_expression(doWhilestatement["condition"])
... | https://github.com/crytic/slither/issues/133 | ERROR:root:Traceback (most recent call last):
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
slithe... | IndexError |
def copy_expression(self, expression, true_expression, false_expression):
if self.condition:
return
if isinstance(expression, ConditionalExpression):
raise Exception("Nested ternary operator not handled")
if isinstance(
expression, (Literal, Identifier, IndexAccess, NewArray, NewCo... | def copy_expression(self, expression, true_expression, false_expression):
if self.condition:
return
if isinstance(expression, ConditionalExpression):
raise Exception("Nested ternary operator not handled")
if isinstance(expression, (Literal, Identifier, IndexAccess, NewArray)):
retu... | https://github.com/crytic/slither/issues/98 | $ slither contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol
INFO:Slither:Compilation warnings/errors on contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:27:2: Warning: Defining constructors ... | Exception |
def generate_c_type_stub(
module: ModuleType,
class_name: str,
obj: type,
output: List[str],
imports: List[str],
sigs: Optional[Dict[str, str]] = None,
class_sigs: Optional[Dict[str, str]] = None,
) -> None:
"""Generate stub for a single class using runtime introspection.
The result... | def generate_c_type_stub(
module: ModuleType,
class_name: str,
obj: type,
output: List[str],
imports: List[str],
sigs: Optional[Dict[str, str]] = None,
class_sigs: Optional[Dict[str, str]] = None,
) -> None:
"""Generate stub for a single class using runtime introspection.
The result... | https://github.com/python/mypy/issues/10137 | PS C:\Users\Gen\Repos> stubgen -m av.enum
Traceback (most recent call last):
File "c:\users\gen\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\gen\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code... | TypeError |
def refresh_suppressed_submodules(
module: str,
path: Optional[str],
deps: Dict[str, Set[str]],
graph: Graph,
fscache: FileSystemCache,
refresh_file: Callable[[str, str], List[str]],
) -> Optional[List[str]]:
"""Look for submodules that are now suppressed in target package.
If a submodu... | def refresh_suppressed_submodules(
module: str,
path: Optional[str],
deps: Dict[str, Set[str]],
graph: Graph,
fscache: FileSystemCache,
refresh_file: Callable[[str, str], List[str]],
) -> Optional[List[str]]:
"""Look for submodules that are now suppressed in target package.
If a submodu... | https://github.com/python/mypy/issues/10035 | $ dmypy run -- t/t.py
Daemon crashed!
Traceback (most recent call last):
File "/Users/jukka/src/mypy/mypy/dmypy_server.py", line 221, in serve
resp = self.run_command(command, data)
File "/Users/jukka/src/mypy/mypy/dmypy_server.py", line 264, in run_command
return method(self, **data)
File "/Users/jukka/src/mypy/mypy/d... | FileNotFoundError |
def fine_grained_increment_follow_imports(
self, sources: List[BuildSource]
) -> List[str]:
"""Like fine_grained_increment, but follow imports."""
t0 = time.time()
# TODO: Support file events
assert self.fine_grained_manager is not None
fine_grained_manager = self.fine_grained_manager
grap... | def fine_grained_increment_follow_imports(
self, sources: List[BuildSource]
) -> List[str]:
"""Like fine_grained_increment, but follow imports."""
t0 = time.time()
# TODO: Support file events
assert self.fine_grained_manager is not None
fine_grained_manager = self.fine_grained_manager
grap... | https://github.com/python/mypy/issues/10029 | Daemon crashed!
Traceback (most recent call last):
File "/Users/jukka/src/mypy/mypy/dmypy_server.py", line 221, in serve
resp = self.run_command(command, data)
File "/Users/jukka/src/mypy/mypy/dmypy_server.py", line 264, in run_command
return method(self, **data)
File "/Users/jukka/src/mypy/mypy/dmypy_server.py", line ... | ValueError |
def infer_sig_from_docstring(
docstr: Optional[str], name: str
) -> Optional[List[FunctionSig]]:
"""Convert function signature to list of TypedFunctionSig
Look for function signatures of function in docstring. Signature is a string of
the format <function_name>(<signature>) -> <return type> or perhaps ... | def infer_sig_from_docstring(docstr: str, name: str) -> Optional[List[FunctionSig]]:
"""Convert function signature to list of TypedFunctionSig
Look for function signatures of function in docstring. Signature is a string of
the format <function_name>(<signature>) -> <return type> or perhaps without
the ... | https://github.com/python/mypy/issues/9888 | Traceback (most recent call last):
File "/install/bin/stubgen", line 8, in <module>
sys.exit(main())
File "mypy/stubgen.py", line 1564, in main
File "mypy/stubgen.py", line 1457, in generate_stubs
File "mypy/stubgenc.py", line 64, in generate_stub_for_c_module
File "mypy/stubgenc.py", line 293, in generate_c_type_stub
... | TypeError |
def is_protocol_implementation(
left: Instance, right: Instance, proper_subtype: bool = False
) -> bool:
"""Check whether 'left' implements the protocol 'right'.
If 'proper_subtype' is True, then check for a proper subtype.
Treat recursive protocols by using the 'assuming' structural subtype matrix
... | def is_protocol_implementation(
left: Instance, right: Instance, proper_subtype: bool = False
) -> bool:
"""Check whether 'left' implements the protocol 'right'.
If 'proper_subtype' is True, then check for a proper subtype.
Treat recursive protocols by using the 'assuming' structural subtype matrix
... | https://github.com/python/mypy/issues/9437 | /XXXXX/venv/lib/python3.7/site-packages/xarray/core/dataarray.py:2001: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.782
Traceback (most recent call... | RuntimeError |
def accept(
self,
node: Expression,
type_context: Optional[Type] = None,
allow_none_return: bool = False,
always_allow_any: bool = False,
) -> Type:
"""Type check a node in the given type context. If allow_none_return
is True and this expression is a call, allow it to return None. This
... | def accept(
self,
node: Expression,
type_context: Optional[Type] = None,
allow_none_return: bool = False,
always_allow_any: bool = False,
) -> Type:
"""Type check a node in the given type context. If allow_none_return
is True and this expression is a call, allow it to return None. This
... | https://github.com/python/mypy/issues/9054 | test.py:3: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.790+dev.6ee562a8f3e69ac134f8c501b79b3712c9e24bbd
Traceback (most recent call last):
File "*... | KeyError |
def console_entry() -> None:
try:
main(None, sys.stdout, sys.stderr)
sys.stdout.flush()
sys.stderr.flush()
except BrokenPipeError:
# Python flushes standard streams on exit; redirect remaining output
# to devnull to avoid another BrokenPipeError at shutdown
devnul... | def console_entry() -> None:
main(None, sys.stdout, sys.stderr)
| https://github.com/python/mypy/issues/9419 | test.py:3: error: Unsupported operand types for + ("int" and "str")
Traceback (most recent call last):
File "/home/septatrix/.local/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/septatrix/.local/lib/python3.8/site-packages/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.std... | BrokenPipeError |
def main(
script_path: Optional[str],
stdout: TextIO,
stderr: TextIO,
args: Optional[List[str]] = None,
) -> None:
"""Main entry point to the type checker.
Args:
script_path: Path to the 'mypy' script (used for finding data files).
args: Custom command-line arguments. If not gi... | def main(
script_path: Optional[str],
stdout: TextIO,
stderr: TextIO,
args: Optional[List[str]] = None,
) -> None:
"""Main entry point to the type checker.
Args:
script_path: Path to the 'mypy' script (used for finding data files).
args: Custom command-line arguments. If not gi... | https://github.com/python/mypy/issues/9419 | test.py:3: error: Unsupported operand types for + ("int" and "str")
Traceback (most recent call last):
File "/home/septatrix/.local/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/septatrix/.local/lib/python3.8/site-packages/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.std... | BrokenPipeError |
def flush_errors(new_messages: List[str], serious: bool) -> None:
if options.pretty:
new_messages = formatter.fit_in_terminal(new_messages)
messages.extend(new_messages)
f = stderr if serious else stdout
for msg in new_messages:
if options.color_output:
msg = formatter.colori... | def flush_errors(new_messages: List[str], serious: bool) -> None:
if options.pretty:
new_messages = formatter.fit_in_terminal(new_messages)
messages.extend(new_messages)
f = stderr if serious else stdout
try:
for msg in new_messages:
if options.color_output:
m... | https://github.com/python/mypy/issues/9419 | test.py:3: error: Unsupported operand types for + ("int" and "str")
Traceback (most recent call last):
File "/home/septatrix/.local/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/septatrix/.local/lib/python3.8/site-packages/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.std... | BrokenPipeError |
def visit_super_expr(self, e: SuperExpr) -> Type:
"""Type check a super expression (non-lvalue)."""
# We have an expression like super(T, var).member
# First compute the types of T and var
types = self._super_arg_types(e)
if isinstance(types, tuple):
type_type, instance_type = types
el... | def visit_super_expr(self, e: SuperExpr) -> Type:
"""Type check a super expression (non-lvalue)."""
# We have an expression like super(T, var).member
# First compute the types of T and var
types = self._super_arg_types(e)
if isinstance(types, tuple):
type_type, instance_type = types
el... | https://github.com/python/mypy/issues/7580 | version: 0.740+dev.fd9c1a07a984d66e35b502881aee80529c930501
Traceback (most recent call last):
File "/Users/maxchase/.pyenv/versions/structured-data/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/maxchase/.pyenv/versions/3.7.4/envs/structured-data/lib/python3.7/site-packages/mypy/__main__.py", l... | AssertionError |
def analyze_class_attribute_access(
itype: Instance, name: str, mx: MemberContext
) -> Optional[Type]:
"""original_type is the type of E in the expression E.var"""
node = itype.type.get(name)
if not node:
if itype.type.fallback_to_any:
return AnyType(TypeOfAny.special_form)
r... | def analyze_class_attribute_access(
itype: Instance, name: str, mx: MemberContext
) -> Optional[Type]:
"""original_type is the type of E in the expression E.var"""
node = itype.type.get(name)
if not node:
if itype.type.fallback_to_any:
return AnyType(TypeOfAny.special_form)
r... | https://github.com/python/mypy/issues/3603 | $ mypy i.py
$ python3 i.py
Traceback (most recent call last):
File "i.py", line 13, in <module>
goo(Child())
File "i.py", line 10, in goo
1 + 'boom' # no error from mypy but there's an error at runtime
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def type_object_type(info: TypeInfo, builtin_type: Callable[[str], Instance]) -> Type:
"""Return the type of a type object.
For a generic type G with type variables T and S the type is generally of form
Callable[..., G[T, S]]
where ... are argument types for the __init__/__new__ method (without the... | def type_object_type(info: TypeInfo, builtin_type: Callable[[str], Instance]) -> Type:
"""Return the type of a type object.
For a generic type G with type variables T and S the type is generally of form
Callable[..., G[T, S]]
where ... are argument types for the __init__/__new__ method (without the... | https://github.com/python/mypy/issues/3603 | $ mypy i.py
$ python3 i.py
Traceback (most recent call last):
File "i.py", line 13, in <module>
goo(Child())
File "i.py", line 10, in goo
1 + 'boom' # no error from mypy but there's an error at runtime
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def __init__(
self,
name: str,
is_in_init: bool,
is_init_var: bool,
has_default: bool,
line: int,
column: int,
type: Optional[Type],
) -> None:
self.name = name
self.is_in_init = is_in_init
self.is_init_var = is_init_var
self.has_default = has_default
self.line = line... | def __init__(
self,
name: str,
is_in_init: bool,
is_init_var: bool,
has_default: bool,
line: int,
column: int,
) -> None:
self.name = name
self.is_in_init = is_in_init
self.is_init_var = is_init_var
self.has_default = has_default
self.line = line
self.column = column
| https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def to_argument(self) -> Argument:
return Argument(
variable=self.to_var(),
type_annotation=self.type,
initializer=None,
kind=ARG_OPT if self.has_default else ARG_POS,
)
| def to_argument(self, info: TypeInfo) -> Argument:
return Argument(
variable=self.to_var(info),
type_annotation=info[self.name].type,
initializer=None,
kind=ARG_OPT if self.has_default else ARG_POS,
)
| https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def to_var(self) -> Var:
return Var(self.name, self.type)
| def to_var(self, info: TypeInfo) -> Var:
return Var(self.name, info[self.name].type)
| https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def serialize(self) -> JsonDict:
assert self.type
return {
"name": self.name,
"is_in_init": self.is_in_init,
"is_init_var": self.is_init_var,
"has_default": self.has_default,
"line": self.line,
"column": self.column,
"type": self.type.serialize(),
}
| def serialize(self) -> JsonDict:
return {
"name": self.name,
"is_in_init": self.is_in_init,
"is_init_var": self.is_init_var,
"has_default": self.has_default,
"line": self.line,
"column": self.column,
}
| https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def deserialize(
cls, info: TypeInfo, data: JsonDict, api: SemanticAnalyzerPluginInterface
) -> "DataclassAttribute":
data = data.copy()
typ = deserialize_and_fixup_type(data.pop("type"), api)
return cls(type=typ, **data)
| def deserialize(cls, info: TypeInfo, data: JsonDict) -> "DataclassAttribute":
return cls(**data)
| https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def transform(self) -> None:
"""Apply all the necessary transformations to the underlying
dataclass so as to ensure it is fully type checked according
to the rules in PEP 557.
"""
ctx = self._ctx
info = self._ctx.cls.info
attributes = self.collect_attributes()
if attributes is None:
... | def transform(self) -> None:
"""Apply all the necessary transformations to the underlying
dataclass so as to ensure it is fully type checked according
to the rules in PEP 557.
"""
ctx = self._ctx
info = self._ctx.cls.info
attributes = self.collect_attributes()
if attributes is None:
... | https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def reset_init_only_vars(
self, info: TypeInfo, attributes: List[DataclassAttribute]
) -> None:
"""Remove init-only vars from the class and reset init var declarations."""
for attr in attributes:
if attr.is_init_var:
if attr.name in info.names:
del info.names[attr.name]
... | def reset_init_only_vars(
self, info: TypeInfo, attributes: List[DataclassAttribute]
) -> None:
"""Remove init-only vars from the class and reset init var declarations."""
for attr in attributes:
if attr.is_init_var:
if attr.name in info.names:
del info.names[attr.name]
... | https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def collect_attributes(self) -> Optional[List[DataclassAttribute]]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ct... | def collect_attributes(self) -> Optional[List[DataclassAttribute]]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ct... | https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def _freeze(self, attributes: List[DataclassAttribute]) -> None:
"""Converts all attributes to @property methods in order to
emulate frozen classes.
"""
info = self._ctx.cls.info
for attr in attributes:
sym_node = info.names.get(attr.name)
if sym_node is not None:
var = s... | def _freeze(self, attributes: List[DataclassAttribute]) -> None:
"""Converts all attributes to @property methods in order to
emulate frozen classes.
"""
info = self._ctx.cls.info
for attr in attributes:
sym_node = info.names.get(attr.name)
if sym_node is not None:
var = s... | https://github.com/python/mypy/issues/6809 | bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages... | AssertionError |
def collect_attributes(self) -> Optional[List[DataclassAttribute]]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ct... | def collect_attributes(self) -> Optional[List[DataclassAttribute]]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ct... | https://github.com/python/mypy/issues/8022 | crash_mypy_2.py:14: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.750+dev.596cde6bd8ddcdbbe5ca2b0d0019ec689a7e8b9c
Traceback (most recent call last)... | flush_error |
def visit_instance(self, template: Instance) -> List[Constraint]:
original_actual = actual = self.actual
res = [] # type: List[Constraint]
if isinstance(actual, (CallableType, Overloaded)) and template.type.is_protocol:
if template.type.protocol_members == ["__call__"]:
# Special case: ... | def visit_instance(self, template: Instance) -> List[Constraint]:
original_actual = actual = self.actual
res = [] # type: List[Constraint]
if isinstance(actual, (CallableType, Overloaded)) and template.type.is_protocol:
if template.type.protocol_members == ["__call__"]:
# Special case: ... | https://github.com/python/mypy/issues/3279 | $ mypy --quick --show-traceback a.py
b.py:7: error: Revealed type is 'def () -> b.C'
/Users/jukka/src/mypy/b.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.510-dev-c856a53fe06c0ad9193d86ab35fb86693940f273-dirty
Traceback (most recent call last):
File "/Users/jukk... | IndexError |
def join_instances(t: Instance, s: Instance) -> ProperType:
"""Calculate the join of two instance types."""
if t.type == s.type:
# Simplest case: join two types with the same base type (but
# potentially different arguments).
if is_subtype(t, s) or is_subtype(s, t):
# Compati... | def join_instances(t: Instance, s: Instance) -> ProperType:
"""Calculate the join of two instance types."""
if t.type == s.type:
# Simplest case: join two types with the same base type (but
# potentially different arguments).
if is_subtype(t, s) or is_subtype(s, t):
# Compati... | https://github.com/python/mypy/issues/3279 | $ mypy --quick --show-traceback a.py
b.py:7: error: Revealed type is 'def () -> b.C'
/Users/jukka/src/mypy/b.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.510-dev-c856a53fe06c0ad9193d86ab35fb86693940f273-dirty
Traceback (most recent call last):
File "/Users/jukk... | IndexError |
def visit_instance(self, t: Instance) -> ProperType:
if isinstance(self.s, Instance):
si = self.s
if t.type == si.type:
if is_subtype(t, self.s) or is_subtype(self.s, t):
# Combine type arguments. We could have used join below
# equivalently.
... | def visit_instance(self, t: Instance) -> ProperType:
if isinstance(self.s, Instance):
si = self.s
if t.type == si.type:
if is_subtype(t, self.s) or is_subtype(self.s, t):
# Combine type arguments. We could have used join below
# equivalently.
... | https://github.com/python/mypy/issues/3279 | $ mypy --quick --show-traceback a.py
b.py:7: error: Revealed type is 'def () -> b.C'
/Users/jukka/src/mypy/b.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.510-dev-c856a53fe06c0ad9193d86ab35fb86693940f273-dirty
Traceback (most recent call last):
File "/Users/jukk... | IndexError |
def visit_lambda_expr(self, e: LambdaExpr) -> Type:
"""Type check lambda expression."""
self.chk.check_default_args(e, body_is_trivial=False)
inferred_type, type_override = self.infer_lambda_type_using_context(e)
if not inferred_type:
self.chk.return_types.append(AnyType(TypeOfAny.special_form))... | def visit_lambda_expr(self, e: LambdaExpr) -> Type:
"""Type check lambda expression."""
self.chk.check_default_args(e, body_is_trivial=False)
inferred_type, type_override = self.infer_lambda_type_using_context(e)
if not inferred_type:
self.chk.return_types.append(AnyType(TypeOfAny.special_form))... | https://github.com/python/mypy/issues/8079 | Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.p... | AssertionError |
def analyze_var(
name: str,
var: Var,
itype: Instance,
info: TypeInfo,
mx: MemberContext,
*,
implicit: bool = False,
) -> Type:
"""Analyze access to an attribute via a Var node.
This is conceptually part of analyze_member_access and the arguments are similar.
itype is the class... | def analyze_var(
name: str,
var: Var,
itype: Instance,
info: TypeInfo,
mx: MemberContext,
*,
implicit: bool = False,
) -> Type:
"""Analyze access to an attribute via a Var node.
This is conceptually part of analyze_member_access and the arguments are similar.
itype is the class... | https://github.com/python/mypy/issues/8072 | Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.p... | AssertionError |
def add_class_tvars(
t: ProperType,
isuper: Optional[Instance],
is_classmethod: bool,
original_type: Type,
original_vars: Optional[List[TypeVarDef]] = None,
) -> Type:
"""Instantiate type variables during analyze_class_attribute_access,
e.g T and Q in the following:
class A(Generic[T]):... | def add_class_tvars(
t: ProperType,
isuper: Optional[Instance],
is_classmethod: bool,
original_type: Type,
original_vars: Optional[List[TypeVarDef]] = None,
) -> Type:
"""Instantiate type variables during analyze_class_attribute_access,
e.g T and Q in the following:
class A(Generic[T]):... | https://github.com/python/mypy/issues/8072 | Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.p... | AssertionError |
def collect_attributes(self) -> Optional[List[DataclassAttribute]]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ct... | def collect_attributes(self) -> Optional[List[DataclassAttribute]]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ct... | https://github.com/python/mypy/issues/7792 | Traceback (most recent call last):
File "C:\Users\anhans\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\anhans\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\anhans\AppD... | ValueError |
def visit_instance(self, typ: Instance) -> SnapshotItem:
return (
"Instance",
encode_optional_str(typ.type.fullname()),
snapshot_types(typ.args),
("None",)
if typ.last_known_value is None
else snapshot_type(typ.last_known_value),
)
| def visit_instance(self, typ: Instance) -> SnapshotItem:
return (
"Instance",
typ.type.fullname(),
snapshot_types(typ.args),
None if typ.last_known_value is None else snapshot_type(typ.last_known_value),
)
| https://github.com/python/mypy/issues/7834 | Traceback (most recent call last):
File "mypy/suggestions.py", line 212, in restore_after
File "mypy/suggestions.py", line 187, in suggest
File "mypy/suggestions.py", line 355, in get_suggestion
File "mypy/suggestions.py", line 325, in find_best
File "mypy/suggestions.py", line 524, in try_type
File "mypy/server/update... | TypeError |
def visit_callable_type(self, typ: CallableType) -> SnapshotItem:
# FIX generics
return (
"CallableType",
snapshot_types(typ.arg_types),
snapshot_type(typ.ret_type),
tuple([encode_optional_str(name) for name in typ.arg_names]),
tuple(typ.arg_kinds),
typ.is_type_ob... | def visit_callable_type(self, typ: CallableType) -> SnapshotItem:
# FIX generics
return (
"CallableType",
snapshot_types(typ.arg_types),
snapshot_type(typ.ret_type),
tuple(typ.arg_names),
tuple(typ.arg_kinds),
typ.is_type_obj(),
typ.is_ellipsis_args,
)... | https://github.com/python/mypy/issues/7834 | Traceback (most recent call last):
File "mypy/suggestions.py", line 212, in restore_after
File "mypy/suggestions.py", line 187, in suggest
File "mypy/suggestions.py", line 355, in get_suggestion
File "mypy/suggestions.py", line 325, in find_best
File "mypy/suggestions.py", line 524, in try_type
File "mypy/server/update... | TypeError |
def visit_literal_type(self, typ: LiteralType) -> SnapshotItem:
return ("LiteralType", snapshot_type(typ.fallback), typ.value)
| def visit_literal_type(self, typ: LiteralType) -> SnapshotItem:
return ("LiteralType", typ.value, snapshot_type(typ.fallback))
| https://github.com/python/mypy/issues/7834 | Traceback (most recent call last):
File "mypy/suggestions.py", line 212, in restore_after
File "mypy/suggestions.py", line 187, in suggest
File "mypy/suggestions.py", line 355, in get_suggestion
File "mypy/suggestions.py", line 325, in find_best
File "mypy/suggestions.py", line 524, in try_type
File "mypy/server/update... | TypeError |
def parse_section(
prefix: str,
template: Options,
section: Mapping[str, str],
stderr: TextIO = sys.stderr,
) -> Tuple[Dict[str, object], Dict[str, str]]:
"""Parse one section of a config file.
Returns a dict of option values encountered, and a dict of report directories.
"""
results = ... | def parse_section(
prefix: str,
template: Options,
section: Mapping[str, str],
stderr: TextIO = sys.stderr,
) -> Tuple[Dict[str, object], Dict[str, str]]:
"""Parse one section of a config file.
Returns a dict of option values encountered, and a dict of report directories.
"""
results = ... | https://github.com/python/mypy/issues/7523 | Traceback (most recent call last):
File "/home/anton/.pyenv/versions/fleet-manager-service/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/home/anton/.pyenv/versions/3.7.0/envs/fleet-manager-service/lib/python3.7/site-packages/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.stder... | AttributeError |
def check_subtype(
self,
subtype: Type,
supertype: Type,
context: Context,
msg: str = message_registry.INCOMPATIBLE_TYPES,
subtype_label: Optional[str] = None,
supertype_label: Optional[str] = None,
*,
code: Optional[ErrorCode] = None,
) -> bool:
"""Generate an error if the subty... | def check_subtype(
self,
subtype: Type,
supertype: Type,
context: Context,
msg: str = message_registry.INCOMPATIBLE_TYPES,
subtype_label: Optional[str] = None,
supertype_label: Optional[str] = None,
*,
code: Optional[ErrorCode] = None,
) -> bool:
"""Generate an error if the subty... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def iterable_item_type(self, instance: Instance) -> Type:
iterable = map_instance_to_supertype(
instance, self.lookup_typeinfo("typing.Iterable")
)
item_type = iterable.args[0]
if not isinstance(get_proper_type(item_type), AnyType):
# This relies on 'map_instance_to_supertype' returning ... | def iterable_item_type(self, instance: Instance) -> Type:
iterable = map_instance_to_supertype(
instance, self.lookup_typeinfo("typing.Iterable")
)
item_type = iterable.args[0]
if not isinstance(get_proper_type(item_type), AnyType):
# This relies on 'map_instance_to_supertype' returning ... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def visit_instance(self, template: Instance) -> List[Constraint]:
original_actual = actual = self.actual
res = [] # type: List[Constraint]
if isinstance(actual, (CallableType, Overloaded)) and template.type.is_protocol:
if template.type.protocol_members == ["__call__"]:
# Special case: ... | def visit_instance(self, template: Instance) -> List[Constraint]:
original_actual = actual = self.actual
res = [] # type: List[Constraint]
if isinstance(actual, (CallableType, Overloaded)) and template.type.is_protocol:
if template.type.protocol_members == ["__call__"]:
# Special case: ... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def visit_callable_type(self, template: CallableType) -> List[Constraint]:
if isinstance(self.actual, CallableType):
cactual = self.actual
# FIX verify argument counts
# FIX what if one of the functions is generic
res = [] # type: List[Constraint]
# We can't infer constrain... | def visit_callable_type(self, template: CallableType) -> List[Constraint]:
if isinstance(self.actual, CallableType):
cactual = self.actual
# FIX verify argument counts
# FIX what if one of the functions is generic
res = [] # type: List[Constraint]
# We can't infer constrain... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def unpack_callback_protocol(t: Instance) -> Optional[Type]:
assert t.type.is_protocol
if t.type.protocol_members == ["__call__"]:
return find_member("__call__", t, t, is_operator=True)
return None
| def unpack_callback_protocol(t: Instance) -> Optional[Type]:
assert t.type.is_protocol
if t.type.protocol_members == ["__call__"]:
return find_member("__call__", t, t)
return None
| https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def incompatible_argument_note(
self,
original_caller_type: ProperType,
callee_type: ProperType,
context: Context,
code: Optional[ErrorCode],
) -> None:
if (
isinstance(original_caller_type, (Instance, TupleType, TypedDictType))
and isinstance(callee_type, Instance)
and c... | def incompatible_argument_note(
self,
original_caller_type: ProperType,
callee_type: ProperType,
context: Context,
code: Optional[ErrorCode],
) -> None:
if (
isinstance(original_caller_type, (Instance, TupleType, TypedDictType))
and isinstance(callee_type, Instance)
and c... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def visit_instance(self, left: Instance) -> bool:
if left.type.fallback_to_any:
if isinstance(self.right, NoneType):
# NOTE: `None` is a *non-subclassable* singleton, therefore no class
# can by a subtype of it, even with an `Any` fallback.
# This special case is needed t... | def visit_instance(self, left: Instance) -> bool:
if left.type.fallback_to_any:
if isinstance(self.right, NoneType):
# NOTE: `None` is a *non-subclassable* singleton, therefore no class
# can by a subtype of it, even with an `Any` fallback.
# This special case is needed t... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def visit_callable_type(self, left: CallableType) -> bool:
right = self.right
if isinstance(right, CallableType):
return is_callable_compatible(
left,
right,
is_compat=self._is_subtype,
ignore_pos_arg_names=self.ignore_pos_arg_names,
)
elif isi... | def visit_callable_type(self, left: CallableType) -> bool:
right = self.right
if isinstance(right, CallableType):
return is_callable_compatible(
left,
right,
is_compat=self._is_subtype,
ignore_pos_arg_names=self.ignore_pos_arg_names,
)
elif isi... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def visit_overloaded(self, left: Overloaded) -> bool:
right = self.right
if isinstance(right, Instance):
if right.type.is_protocol and right.type.protocol_members == ["__call__"]:
# same as for CallableType
call = find_member("__call__", right, left, is_operator=True)
... | def visit_overloaded(self, left: Overloaded) -> bool:
right = self.right
if isinstance(right, Instance):
if right.type.is_protocol and right.type.protocol_members == ["__call__"]:
# same as for CallableType
call = find_member("__call__", right, left)
assert call is no... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def find_member(
name: str, itype: Instance, subtype: Type, is_operator: bool = False
) -> Optional[Type]:
"""Find the type of member by 'name' in 'itype's TypeInfo.
Fin the member type after applying type arguments from 'itype', and binding
'self' to 'subtype'. Return None if member was not found.
... | def find_member(name: str, itype: Instance, subtype: Type) -> Optional[Type]:
"""Find the type of member by 'name' in 'itype's TypeInfo.
Fin the member type after applying type arguments from 'itype', and binding
'self' to 'subtype'. Return None if member was not found.
"""
# TODO: this code shares... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def visit_instance(self, left: Instance) -> bool:
right = self.right
if isinstance(right, Instance):
if TypeState.is_cached_subtype_check(self._subtype_kind, left, right):
return True
if not self.ignore_promotions:
for base in left.type.mro:
if base._promo... | def visit_instance(self, left: Instance) -> bool:
right = self.right
if isinstance(right, Instance):
if TypeState.is_cached_subtype_check(self._subtype_kind, left, right):
return True
if not self.ignore_promotions:
for base in left.type.mro:
if base._promo... | https://github.com/python/mypy/issues/7243 | Traceback (most recent call last):
File "/home/zero323/anaconda3/bin/mypy", line 10, in <module>
sys.exit(console_entry())
...
RecursionError: maximum recursion depth exceeded while calling a Python object
foo.pyi:6: : note: use --pdb to drop into pdb | RecursionError |
def transform(self) -> None:
"""Apply all the necessary transformations to the underlying
dataclass so as to ensure it is fully type checked according
to the rules in PEP 557.
"""
ctx = self._ctx
info = self._ctx.cls.info
attributes = self.collect_attributes()
if attributes is None:
... | def transform(self) -> None:
"""Apply all the necessary transformations to the underlying
dataclass so as to ensure it is fully type checked according
to the rules in PEP 557.
"""
ctx = self._ctx
info = self._ctx.cls.info
attributes = self.collect_attributes()
if attributes is None:
... | https://github.com/python/mypy/issues/7320 | $ ~/src/mypy/venv/bin/mypy test.py --show-traceback
test.py:10: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.730+dev.c610a312853921d09083f7525c1838... | KeyError |
def reset_init_only_vars(
self, info: TypeInfo, attributes: List[DataclassAttribute]
) -> None:
"""Remove init-only vars from the class and reset init var declarations."""
for attr in attributes:
if attr.is_init_var:
if attr.name in info.names:
del info.names[attr.name]
... | def reset_init_only_vars(
self, info: TypeInfo, attributes: List[DataclassAttribute]
) -> None:
"""Remove init-only vars from the class and reset init var declarations."""
for attr in attributes:
if attr.is_init_var:
del info.names[attr.name]
for stmt in info.defn.defs.body:
... | https://github.com/python/mypy/issues/7320 | $ ~/src/mypy/venv/bin/mypy test.py --show-traceback
test.py:10: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.730+dev.c610a312853921d09083f7525c1838... | KeyError |
def check_mapping_str_interpolation(
self,
specifiers: List[ConversionSpecifier],
replacements: Expression,
expr: FormatStringExpr,
) -> None:
if isinstance(replacements, DictExpr) and all(
isinstance(k, (StrExpr, BytesExpr, UnicodeExpr)) for k, v in replacements.items
):
mapping... | def check_mapping_str_interpolation(
self,
specifiers: List[ConversionSpecifier],
replacements: Expression,
expr: FormatStringExpr,
) -> None:
if isinstance(replacements, DictExpr) and all(
isinstance(k, (StrExpr, BytesExpr)) for k, v in replacements.items
):
mapping = {} # type... | https://github.com/python/mypy/issues/7293 | $ cat example.py
print(b'%(x)s' % {b'x': b'data'})
$ python3 example.py
b'data'
$ mypy example.py --show-traceback
mypy example.py --show-traceback
example.py:1: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please repo... | TypeError |
def check_func_def(
self, defn: FuncItem, typ: CallableType, name: Optional[str]
) -> None:
"""Type check a function definition."""
# Expand type variables with value restrictions to ordinary types.
expanded = self.expand_typevars(defn, typ)
for item, typ in expanded:
old_binder = self.binde... | def check_func_def(
self, defn: FuncItem, typ: CallableType, name: Optional[str]
) -> None:
"""Type check a function definition."""
# Expand type variables with value restrictions to ordinary types.
expanded = self.expand_typevars(defn, typ)
for item, typ in expanded:
old_binder = self.binde... | https://github.com/python/mypy/issues/5846 | Traceback (most recent call last):
File "/home/derrick_chambers/anaconda3/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/home/derrick_chambers/anaconda3/lib/python3.7/site-packages... | AssertionError |
def enclosing_class(self) -> Optional[TypeInfo]:
"""Is there a class *directly* enclosing this function?"""
top = self.top_function()
assert top, "This method must be called from inside a function"
index = self.stack.index(top)
assert index, "CheckerScope stack must always start with a module"
e... | def enclosing_class(self) -> Optional[TypeInfo]:
top = self.top_function()
assert top, "This method must be called from inside a function"
index = self.stack.index(top)
assert index, "CheckerScope stack must always start with a module"
enclosing = self.stack[index - 1]
if isinstance(enclosing, T... | https://github.com/python/mypy/issues/5846 | Traceback (most recent call last):
File "/home/derrick_chambers/anaconda3/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/home/derrick_chambers/anaconda3/lib/python3.7/site-packages... | AssertionError |
def active_self_type(self) -> Optional[Union[Instance, TupleType]]:
"""An instance or tuple type representing the current class.
This returns None unless we are in class body or in a method.
In particular, inside a function nested in method this returns None.
"""
info = self.active_class()
if n... | def active_self_type(self) -> Optional[Union[Instance, TupleType]]:
info = self.active_class()
if info:
return fill_typevars(info)
return None
| https://github.com/python/mypy/issues/5846 | Traceback (most recent call last):
File "/home/derrick_chambers/anaconda3/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/home/derrick_chambers/anaconda3/lib/python3.7/site-packages... | AssertionError |
def analyze_overloaded_func_def(self, defn: OverloadedFuncDef) -> None:
# OverloadedFuncDef refers to any legitimate situation where you have
# more than one declaration for the same function in a row. This occurs
# with a @property with a setter or a deleter, and for a classic
# @overload.
defn._... | def analyze_overloaded_func_def(self, defn: OverloadedFuncDef) -> None:
# OverloadedFuncDef refers to any legitimate situation where you have
# more than one declaration for the same function in a row. This occurs
# with a @property with a setter or a deleter, and for a classic
# @overload.
defn._... | https://github.com/python/mypy/issues/7209 | Traceback (most recent call last):
File "/home/hong/src/mypy/.venv/bin/mypy", line 11, in <module>
load_entry_point('mypy', 'console_scripts', 'mypy')()
File "/home/hong/src/mypy/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.stderr)
File "/home/hong/src/mypy/mypy/main.py", line 83, in main
res ... | AssertionError |
def analyze_ref_expr(self, e: RefExpr, lvalue: bool = False) -> Type:
result = None # type: Optional[Type]
node = e.node
if isinstance(e, NameExpr) and e.is_special_form:
# A special form definition, nothing to check here.
return AnyType(TypeOfAny.special_form)
if isinstance(node, Var... | def analyze_ref_expr(self, e: RefExpr, lvalue: bool = False) -> Type:
result = None # type: Optional[Type]
node = e.node
if isinstance(e, NameExpr) and e.is_special_form:
# A special form definition, nothing to check here.
return AnyType(TypeOfAny.special_form)
if isinstance(node, Var... | https://github.com/python/mypy/issues/7044 | (tildes) vagrant@ubuntu-xenial:/opt/tildes$ mypy --new-semantic-analyzer --show-traceback test_mypy.py
test_mypy.py:16: error: Cannot assign to a method
test_mypy.py:16: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-development-mypy-build
Please... | AssertionError |
def analyze_overloaded_func_def(self, defn: OverloadedFuncDef) -> None:
# OverloadedFuncDef refers to any legitimate situation where you have
# more than one declaration for the same function in a row. This occurs
# with a @property with a setter or a deleter, and for a classic
# @overload.
defn._... | def analyze_overloaded_func_def(self, defn: OverloadedFuncDef) -> None:
# OverloadedFuncDef refers to any legitimate situation where you have
# more than one declaration for the same function in a row. This occurs
# with a @property with a setter or a deleter, and for a classic
# @overload.
defn._... | https://github.com/python/mypy/issues/7044 | (tildes) vagrant@ubuntu-xenial:/opt/tildes$ mypy --new-semantic-analyzer --show-traceback test_mypy.py
test_mypy.py:16: error: Cannot assign to a method
test_mypy.py:16: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-development-mypy-build
Please... | AssertionError |
def function_type(func: mypy.nodes.FuncBase, fallback: Instance) -> FunctionLike:
if func.type:
assert isinstance(func.type, FunctionLike)
return func.type
else:
# Implicit type signature with dynamic types.
if isinstance(func, mypy.nodes.FuncItem):
return callable_ty... | def function_type(func: mypy.nodes.FuncBase, fallback: Instance) -> FunctionLike:
if func.type:
assert isinstance(func.type, FunctionLike)
return func.type
else:
# Implicit type signature with dynamic types.
# Overloaded functions always have a signature, so func must be an ordin... | https://github.com/python/mypy/issues/7044 | (tildes) vagrant@ubuntu-xenial:/opt/tildes$ mypy --new-semantic-analyzer --show-traceback test_mypy.py
test_mypy.py:16: error: Cannot assign to a method
test_mypy.py:16: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-development-mypy-build
Please... | AssertionError |
def attr_class_maker_callback(
ctx: "mypy.plugin.ClassDefContext", auto_attribs_default: bool = False
) -> None:
"""Add necessary dunder methods to classes decorated with attr.s.
attrs is a package that lets you define classes without writing dull boilerplate code.
At a quick glance, the decorator sea... | def attr_class_maker_callback(
ctx: "mypy.plugin.ClassDefContext", auto_attribs_default: bool = False
) -> None:
"""Add necessary dunder methods to classes decorated with attr.s.
attrs is a package that lets you define classes without writing dull boilerplate code.
At a quick glance, the decorator sea... | https://github.com/python/mypy/issues/7076 | /Users/skreft/.virtualenvs/zapship/lib/python3.6/site-packages/aiohttp/client.py:49: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.720+dev.262fe3dc4... | KeyError |
def collect_attributes(self) -> List[DataclassAttribute]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ctx = self._... | def collect_attributes(self) -> List[DataclassAttribute]:
"""Collect all attributes declared in the dataclass and its parents.
All assignments of the form
a: SomeType
b: SomeOtherType = ...
are collected.
"""
# First, collect attributes belonging to the current class.
ctx = self._... | https://github.com/python/mypy/issues/7076 | /Users/skreft/.virtualenvs/zapship/lib/python3.6/site-packages/aiohttp/client.py:49: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.720+dev.262fe3dc4... | KeyError |
def calculate_class_mro(
self, defn: ClassDef, obj_type: Optional[Callable[[], Instance]] = None
) -> None:
"""Calculate method resolution order for a class.
`obj_type` may be omitted in the third pass when all classes are already analyzed.
It exists just to fill in empty base class list during second ... | def calculate_class_mro(
self, defn: ClassDef, obj_type: Optional[Callable[[], Instance]] = None
) -> None:
"""Calculate method resolution order for a class.
`obj_type` may be omitted in the third pass when all classes are already analyzed.
It exists just to fill in empty base class list during second ... | https://github.com/python/mypy/issues/6706 | tmp/sample.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "ve/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "mypy/semanal.py", line 3791, in accept
File "mypy/nodes.py", line 895, in accept__Node_glue
Fi... | TypeError |
def save_namedtuple_body(self, named_tuple_info: TypeInfo) -> Iterator[None]:
"""Preserve the generated body of class-based named tuple and then restore it.
Temporarily clear the names dict so we don't get errors about duplicate names
that were already set in build_namedtuple_typeinfo (we already added the... | def save_namedtuple_body(self, named_tuple_info: TypeInfo) -> Iterator[None]:
"""Preserve the generated body of class-based named tuple and then restore it.
Temporarily clear the names dict so we don't get errors about duplicate names
that were already set in build_namedtuple_typeinfo (we already added the... | https://github.com/python/mypy/issues/6973 | mypy . --new-semantic-analyzer --show-traceback
./test.py: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.710+dev.16ade15bcd2a5b6b02ad2c76b6b13efa6c2dd... | AssertionError |
def add_method(
ctx: ClassDefContext,
name: str,
args: List[Argument],
return_type: Type,
self_type: Optional[Type] = None,
tvar_def: Optional[TypeVarDef] = None,
) -> None:
"""Adds a new method to a class."""
info = ctx.cls.info
# First remove any previously generated methods with ... | def add_method(
ctx: ClassDefContext,
name: str,
args: List[Argument],
return_type: Type,
self_type: Optional[Type] = None,
tvar_def: Optional[TypeVarDef] = None,
) -> None:
"""Adds a new method to a class."""
info = ctx.cls.info
# First remove any previously generated methods with ... | https://github.com/python/mypy/issues/6973 | mypy . --new-semantic-analyzer --show-traceback
./test.py: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.710+dev.16ade15bcd2a5b6b02ad2c76b6b13efa6c2dd... | AssertionError |
def analyze_unbound_type_without_type_info(
self, t: UnboundType, sym: SymbolTableNode, defining_literal: bool
) -> Type:
"""Figure out what an unbound type that doesn't refer to a TypeInfo node means.
This is something unusual. We try our best to find out what it is.
"""
name = sym.fullname
if... | def analyze_unbound_type_without_type_info(
self, t: UnboundType, sym: SymbolTableNode, defining_literal: bool
) -> Type:
"""Figure out what an unbound type that doesn't refer to a TypeInfo node means.
This is something unusual. We try our best to find out what it is.
"""
name = sym.fullname
if... | https://github.com/python/mypy/issues/6913 | resource_manager.py:51: error: Invalid type "mypy_extensions.TypedDict"
resource_manager.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/home/babywolf/dev/sd/.venv/bin/mypy", line 10, in <module>
sys.exit(console_entry())... | AssertionError |
def analyze_unbound_type_without_type_info(
self, t: UnboundType, sym: SymbolTableNode, defining_literal: bool
) -> Type:
"""Figure out what an unbound type that doesn't refer to a TypeInfo node means.
This is something unusual. We try our best to find out what it is.
"""
name = sym.fullname
if... | def analyze_unbound_type_without_type_info(
self, t: UnboundType, sym: SymbolTableNode, defining_literal: bool
) -> Type:
"""Figure out what an unbound type that doesn't refer to a TypeInfo node means.
This is something unusual. We try our best to find out what it is.
"""
name = sym.fullname
if... | https://github.com/python/mypy/issues/6913 | resource_manager.py:51: error: Invalid type "mypy_extensions.TypedDict"
resource_manager.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/home/babywolf/dev/sd/.venv/bin/mypy", line 10, in <module>
sys.exit(console_entry())... | AssertionError |
def false_only(t: Type) -> Type:
"""
Restricted version of t with only False-ish values
"""
if not t.can_be_false:
if state.strict_optional:
# All values of t are True-ish, so there are no false values in it
return UninhabitedType(line=t.line)
else:
# ... | def false_only(t: Type) -> Type:
"""
Restricted version of t with only False-ish values
"""
if not t.can_be_false:
# All values of t are True-ish, so there are no false values in it
return UninhabitedType(line=t.line)
elif not t.can_be_true:
# All values of t are already Fals... | https://github.com/python/mypy/issues/3601 | $ mypy n.py
n.py:11: error: Incompatible types in assignment (expression has type "int", variable has type "str")
$ python3 n.py
Traceback (most recent call last):
File "n.py", line 23, in <module>
Foo()
File "n.py", line 15, in __init__
self.mypy_does_not_typecheck_this() # no error
AttributeError: 'Foo' object has n... | AttributeError |
def flatten(t: Expression) -> List[Expression]:
"""Flatten a nested sequence of tuples/lists into one list of nodes."""
if isinstance(t, TupleExpr) or isinstance(t, ListExpr):
return [b for a in t.items for b in flatten(a)]
elif isinstance(t, StarExpr):
return flatten(t.expr)
else:
... | def flatten(t: Expression) -> List[Expression]:
"""Flatten a nested sequence of tuples/lists into one list of nodes."""
if isinstance(t, TupleExpr) or isinstance(t, ListExpr):
return [b for a in t.items for b in flatten(a)]
else:
return [t]
| https://github.com/python/mypy/issues/4986 | mypy --show-traceback test.py
test.py:3: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.560
Traceback (most recent call last):
File "/Users/trevorbaca/.virtualenvs/abjad3/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/trevorbaca/.virtualenvs/abja... | KeyError |
def find_module_path_and_all_py3(
module: str,
) -> Optional[Tuple[str, Optional[List[str]]]]:
"""Find module and determine __all__ for a Python 3 module.
Return None if the module is a C module. Return (module_path, __all__) if
it is a Python module. Raise CantImport if import failed.
"""
# TO... | def find_module_path_and_all_py3(
module: str,
) -> Optional[Tuple[str, Optional[List[str]]]]:
"""Find module and determine __all__ for a Python 3 module.
Return None if the module is a C module. Return (module_path, __all__) if
it is a Python module. Raise CantImport if import failed.
"""
# TO... | https://github.com/python/mypy/issues/6639 | Traceback (most recent call last):
File "/Users/peter/.local/share/virtualenvs/testpy-XO9km9Nb/bin/stubgen", line 10, in <module>
sys.exit(main())
File "mypy/stubgen.py", line 1191, in main
File "mypy/stubgen.py", line 1075, in generate_stubs
File "mypy/stubgen.py", line 899, in collect_build_targets
File "mypy/stubgen... | TypeError |
def add_unknown_symbol(
self,
name: str,
context: Context,
is_import: bool = False,
target_name: Optional[str] = None,
) -> None:
"""Add symbol that we don't know what it points to (due to error, for example)."""
var = Var(name)
if self.options.logical_deps and target_name is not None:
... | def add_unknown_symbol(
self,
name: str,
context: Context,
is_import: bool = False,
target_name: Optional[str] = None,
) -> None:
"""Add symbol that we don't know what it points to (due to error, for example)."""
var = Var(name)
if self.options.logical_deps and target_name is not None:
... | https://github.com/python/mypy/issues/6367 | test.py:4: error: Cannot find module named 'dill'
test.py:4: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
test.py:13: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.670
Traceback (most recent call last):
File "c:\miniconda3\envs\refa... | AssertionError |
def add_unknown_symbol(
self,
name: str,
context: Context,
is_import: bool = False,
target_name: Optional[str] = None,
) -> None:
var = Var(name)
if self.options.logical_deps and target_name is not None:
# This makes it possible to add logical fine-grained dependencies
# from... | def add_unknown_symbol(
self,
name: str,
context: Context,
is_import: bool = False,
target_name: Optional[str] = None,
) -> None:
var = Var(name)
if self.options.logical_deps and target_name is not None:
# This makes it possible to add logical fine-grained dependencies
# from... | https://github.com/python/mypy/issues/6367 | test.py:4: error: Cannot find module named 'dill'
test.py:4: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
test.py:13: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.670
Traceback (most recent call last):
File "c:\miniconda3\envs\refa... | AssertionError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.