Files
vscode/extensions/copilot/test/simulation/fixtures/notebook/errors.ipynb
T
kieferrmandcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> 333d9a4053 Hello Copilot
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-27 11:35:20 +02:00

27 KiB

In [1]:
import pandas as pd
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pandas as pd

ModuleNotFoundError: No module named 'pandas'
In [6]:
import numpy as np

A = np.array([1, 0, 1, 0, 1, 0], dtype=bool)
B = np.array([1, 1, 1, 0, 1, 1], dtype=bool)
A or B
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 2 line 5
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a> A = np.array([1, 0, 1, 0, 1, 0], dtype=bool)
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a> B = np.array([1, 1, 1, 0, 1, 1], dtype=bool)
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W1sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a> A or B

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
In [13]:
import tensorflow as tf
tf.reshape([1, 2, 3], (2,))
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 3 line 2
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W4sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> import tensorflow as tf
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W4sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a> tf.reshape([1, 2, 3], (2,))

File /workspaces/vscode-copilot/.venv/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py:153, in filter_traceback.<locals>.error_handler(*args, **kwargs)
    151 except Exception as e:
    152   filtered_tb = _process_traceback_frames(e.__traceback__)
--> 153   raise e.with_traceback(filtered_tb) from None
    154 finally:
    155   del filtered_tb

File /workspaces/vscode-copilot/.venv/lib/python3.9/site-packages/tensorflow/python/eager/execute.py:53, in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     51 try:
     52   ctx.ensure_initialized()
---> 53   tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
     54                                       inputs, attrs, num_outputs)
     55 except core._NotOkStatusException as e:
     56   if name is not None:

InvalidArgumentError: {{function_node __wrapped__Reshape_device_/job:localhost/replica:0/task:0/device:CPU:0}} Input to reshape is a tensor with 3 values, but the requested shape has 2 [Op:Reshape]
In [3]:
import tensorflow as tf
model = tf.keras.Sequential([
  tf.keras.layers.Dense(1)
])
model.build(input_shape=(None, 1))
model.summary()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 4 line 5
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W3sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> import tensorflow as tf
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W3sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a> model = tf.keras.Sequential([
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W3sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a>   tf.keras.layers.Dense(1)
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W3sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a> ])
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W3sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a> model.summary()

File /workspaces/vscode-copilot/.venv/lib/python3.9/site-packages/keras/src/engine/training.py:3403, in Model.summary(self, line_length, positions, print_fn, expand_nested, show_trainable, layer_range)
   3372 """Prints a string summary of the network.
   3373 
   3374 Args:
   (...)
   3400     ValueError: if `summary()` is called before the model is built.
   3401 """
   3402 if not self.built:
-> 3403     raise ValueError(
   3404         "This model has not yet been built. "
   3405         "Build the model first by calling `build()` or by calling "
   3406         "the model on a batch of data."
   3407     )
   3408 layer_utils.print_summary(
   3409     self,
   3410     line_length=line_length,
   (...)
   3415     layer_range=layer_range,
   3416 )

ValueError: This model has not yet been built. Build the model first by calling `build()` or by calling the model on a batch of data.
In [2]:
import numpy as np

vals1 = np.array([1, None, 3, 4])
vals1.sum()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 5 line 3
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W4sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> import numpy as np
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W4sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a> vals1 = np.array([1, None, 3, 4])
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W4sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a> vals1.sum()

File /workspaces/vscode-copilot/.venv/lib/python3.9/site-packages/numpy/core/_methods.py:49, in _sum(a, axis, dtype, out, keepdims, initial, where)
     47 def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
     48          initial=_NoValue, where=True):
---> 49     return umr_sum(a, axis, dtype, out, keepdims, initial, where)

TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
In [5]:
a_var = 1

def a_func():
    a_var = a_var + 1
    print(a_var, '[ a_var inside a_func() ]')
    return a_var

print(a_var, '[ a_var outside a_func() ]')
a_func()
1 [ a_var outside a_func() ]
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 6 line 9
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=5'>6</a>     return a_var
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=7'>8</a> print(a_var, '[ a_var outside a_func() ]')
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=8'>9</a> a_func()

/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 6 line 4
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a> def a_func():
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a>     a_var = a_var + 1
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a>     print(a_var, '[ a_var inside a_func() ]')
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=5'>6</a>     return a_var

UnboundLocalError: local variable 'a_var' referenced before assignment
In [9]:
kid_ages = [2, 7, 5, 6, 3]

max = 0
max_value = max_val
print(max_value)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 7 line 4
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> kid_ages = [2, 7, 5, 6, 3]
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a> max = 0
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a> max_value = max(kid_ages)
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a> print(max_value)

TypeError: 'int' object is not callable
In [10]:
class Foo(object):
    def __init__(self, data):
        self.data = data

    @property
    def x(self):
        return self.data

foo = Foo(23)
foo.x = 42
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 8 line 1
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X13sdnNjb2RlLXJlbW90ZQ%3D%3D?line=6'>7</a>         return self.data
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X13sdnNjb2RlLXJlbW90ZQ%3D%3D?line=8'>9</a> foo = Foo(23)
---> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X13sdnNjb2RlLXJlbW90ZQ%3D%3D?line=9'>10</a> foo.x = 42

AttributeError: can't set attribute
In [13]:
import pandas as pd

ind = pd.Index([2, 3, 5, 7, 11])
ind[1] = 0
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 9 line 4
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X14sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> import pandas as pd
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X14sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'>3</a> ind = pd.Index([2, 3, 5, 7, 11])
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X14sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a> ind[1] = 0

File /workspaces/vscode-copilot/.venv/lib/python3.9/site-packages/pandas/core/indexes/base.py:5347, in Index.__setitem__(self, key, value)
   5345 @final
   5346 def __setitem__(self, key, value) -> None:
-> 5347     raise TypeError("Index does not support mutable operations")

TypeError: Index does not support mutable operations
In [18]:
g = 'abc'
next(g)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 10 line 2
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X16sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> g = 'abc'
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X16sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a> next(g)

TypeError: 'str' object is not an iterator
In [21]:
'3.14' + 3
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 11 line 1
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X21sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> '3.14' + 3

TypeError: can only concatenate str (not "int") to str
In [1]:
array([1, 2, 3, 4, 5])
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 12 line 1
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X22sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> array([1, 2, 3, 4, 5])

NameError: name 'array' is not defined
In [4]:
foo = ['hello', 'world']
foo+'bar'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb Cell 13 line 2
      <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X23sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a> foo = ['hello', 'world']
----> <a href='vscode-notebook-cell://codespaces%2Bsuper-duper-engine-q7qwgj4x7xh9v/workspaces/vscode-copilot/test/simulation/fixtures/notebook/errors.ipynb#X23sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a> foo+'bar'

TypeError: can only concatenate list (not "str") to list