gurudesh/pytracebugs huggingface dataset:
# Buggy code
def _hide_frame(ax):
    """Helper to hide axis frame for topomaps."""
    ax.set_xticks([])
    ax.set_yticks([])
    ax.set_frame_on(False)


# Traceback (ValueError)
n [15]: Traceback (most recent call last):
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 291, in mouseReleaseEvent
FigureCanvasBase.button_release_event(self, x, y, button)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 1891, in button_release_event
self.callbacks.process(s, event)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py", line 533, in process
proxy(*args, **kwargs)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py", line 408, in __call__
return mtd(*args, **kwargs)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/widgets.py", line 1250, in release
self.onselect(vmin, vmax)
File "/tsi/doctorants/mainak/mne-python/mne/viz/evoked.py", line 90, in _butterfly_onselect
layout=None)
File "/tsi/doctorants/mainak/mne-python/mne/viz/topomap.py", line 49, in _prepare_topo_plot
picks, pos = _pair_grad_sensors(info, layout)
File "/tsi/doctorants/mainak/mne-python/mne/channels/layout.py", line 689, in _pair_grad_sensors
raise ValueError("No 'grad' channel pairs found.")
ValueError: No 'grad' channel pairs found.

# Fixed code
def _hide_frame(ax):
    """Helper to hide axis frame for topomaps."""
    ax.get_yticks()
    ax.xaxis.set_ticks([])
    ax.yaxis.set_ticks([])
    ax.set_frame_on(False)
# Buggy code
def _fake_click(fig, ax, point, xform="ax", button=1):
    """Helper to fake a click at a relative point within axes."""
    if xform == "ax":
        x, y = ax.transAxes.transform_point(point)
    elif xform == "data":
        x, y = ax.transData.transform_point(point)
    else:
        raise ValueError("unknown transform")
    try:
        fig.canvas.button_press_event(x, y, button, False, None)
    except Exception:  # for old MPL
        fig.canvas.button_press_event(x, y, button, False)


# Traceback (ValueError)
n [15]: Traceback (most recent call last):
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 291, in mouseReleaseEvent
FigureCanvasBase.button_release_event(self, x, y, button)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 1891, in button_release_event
self.callbacks.process(s, event)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py", line 533, in process
proxy(*args, **kwargs)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py", line 408, in __call__
return mtd(*args, **kwargs)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/widgets.py", line 1250, in release
self.onselect(vmin, vmax)
File "/tsi/doctorants/mainak/mne-python/mne/viz/evoked.py", line 90, in _butterfly_onselect
layout=None)
File "/tsi/doctorants/mainak/mne-python/mne/viz/topomap.py", line 49, in _prepare_topo_plot
picks, pos = _pair_grad_sensors(info, layout)
File "/tsi/doctorants/mainak/mne-python/mne/channels/layout.py", line 689, in _pair_grad_sensors
raise ValueError("No 'grad' channel pairs found.")
ValueError: No 'grad' channel pairs found.

# Fixed code
def _fake_click(fig, ax, point, xform="ax", button=1, kind="press"):
    """Helper to fake a click at a relative point within axes."""
    if xform == "ax":
        x, y = ax.transAxes.transform_point(point)
    elif xform == "data":
        x, y = ax.transData.transform_point(point)
    else:
        raise ValueError("unknown transform")
    if kind == "press":
        func = partial(fig.canvas.button_press_event, x=x, y=y, button=button)
    elif kind == "release":
        func = partial(fig.canvas.button_release_event, x=x, y=y, button=button)
    elif kind == "motion":
        func = partial(fig.canvas.motion_notify_event, x=x, y=y)
    try:
        func(guiEvent=None)
    except Exception:  # for old MPL
        func()
# Buggy code
def __init__(self, imdata, **kwargs):
    """Display the image for clicking."""
    from matplotlib.pyplot import figure

    self.coords = []
    self.imdata = imdata
    self.fig = figure()
    self.ax = self.fig.add_subplot(111)
    self.ymax = self.imdata.shape[0]
    self.xmax = self.imdata.shape[1]
    self.im = self.ax.imshow(
        imdata,
        aspect="auto",
        extent=(0, self.xmax, 0, self.ymax),
        picker=True,
        **kwargs,
    )
    self.ax.axis("off")
    self.fig.canvas.mpl_connect("pick_event", self.onclick)
    plt_show()


# Traceback (ValueError)
n [15]: Traceback (most recent call last):
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 291, in mouseReleaseEvent
FigureCanvasBase.button_release_event(self, x, y, button)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 1891, in button_release_event
self.callbacks.process(s, event)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py", line 533, in process
proxy(*args, **kwargs)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/cbook.py", line 408, in __call__
return mtd(*args, **kwargs)
File "/tsi/doctorants/mainak/anaconda/lib/python2.7/site-packages/matplotlib/widgets.py", line 1250, in release
self.onselect(vmin, vmax)
File "/tsi/doctorants/mainak/mne-python/mne/viz/evoked.py", line 90, in _butterfly_onselect
layout=None)
File "/tsi/doctorants/mainak/mne-python/mne/viz/topomap.py", line 49, in _prepare_topo_plot
picks, pos = _pair_grad_sensors(info, layout)
File "/tsi/doctorants/mainak/mne-python/mne/channels/layout.py", line 689, in _pair_grad_sensors
raise ValueError("No 'grad' channel pairs found.")
ValueError: No 'grad' channel pairs found.

# Fixed code
def __init__(self, cbar, mappable):
    import matplotlib.pyplot as plt

    self.cbar = cbar
    self.mappable = mappable
    self.press = None
    self.cycle = sorted([i for i in dir(plt.cm) if hasattr(getattr(plt.cm, i), "N")])
    self.index = self.cycle.index(cbar.get_cmap().name)
    self.lims = (self.cbar.norm.vmin, self.cbar.norm.vmax)
    self.connect()
# Buggy code
def rehint(self):
    height, width = self._resize_max(
        original_height=self._pixbuf.get_height(),
        original_width=self._pixbuf.get_width(),
        max_height=self.native.get_allocated_height(),
        max_width=self.native.get_allocated_width(),
    )

    scaled_pixbuf = self._pixbuf.scale_simple(
        width, height, GdkPixbuf.InterpType.BILINEAR
    )
    self._image.set_from_pixbuf(scaled_pixbuf)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/samschott/.local/lib/python3.8/site-packages/toga_gtk/app.py", line 93, in gtk_startup
self.interface.startup()
File "/media/psf/Home/Python/toga/examples/imageview/imageview/app.py", line 18, in startup
imageview_from_path = toga.ImageView(image_from_path)
File "/home/samschott/.local/lib/python3.8/site-packages/toga/widgets/imageview.py", line 25, in __init__
self._impl = self.factory.ImageView(interface=self)
File "/home/samschott/.local/lib/python3.8/site-packages/toga_gtk/widgets/base.py", line 12, in __init__
self.interface.style.reapply()
File "/home/samschott/.local/lib/python3.8/site-packages/travertino/declaration.py", line 88, in reapply
self.apply(style, getattr(self, style))
File "/home/samschott/.local/lib/python3.8/site-packages/toga/style/pack.py", line 104, in apply
self._applicator.set_font(
File "/home/samschott/.local/lib/python3.8/site-packages/toga/style/applicator.py", line 25, in set_font
self.widget._impl.rehint()
File "/home/samschott/.local/lib/python3.8/site-packages/toga_gtk/widgets/imageview.py", line 20, in rehint
original_height=self._pixbuf.get_height(),
AttributeError: 'NoneType' object has no attribute 'get_height'

# Fixed code
def rehint(self):
    if self._pixbuf:
        height, width = self._resize_max(
            original_height=self._pixbuf.get_height(),
            original_width=self._pixbuf.get_width(),
            max_height=self.native.get_allocated_height(),
            max_width=self.native.get_allocated_width(),
        )

        dpr = self.native.get_scale_factor()

        scaled_pixbuf = self._pixbuf.scale_simple(
            width * dpr, height * dpr, GdkPixbuf.InterpType.BILINEAR
        )

        surface = Gdk.cairo_surface_create_from_pixbuf(
            scaled_pixbuf,
            0,
            self.native.get_window(),  # scale: 0 = same as window
        )
        self._image.set_from_surface(surface)
# Buggy code
def winforms_item_selection_changed(self, sender, e):
    # update selection interface property
    self.interface._selection = self._selected_rows()

    if e.IsSelected:
        self.interface.on_select(self.interface, row=self.interface.data[e.ItemIndex])


# Traceback (TypeError)
Traceback (most recent call last):
File "C:\\Users\\brcan\\Desktop\\snippets\\.venv\\lib\\site-packages\\toga_winforms\\widgets\\table.py", line 74, in _native_item_selection_changed
self.interface.on_select(self.interface, row=self.interface.data[e.ItemIndex])
TypeError : 'NoneType' object is not callable

# Fixed code
def winforms_item_selection_changed(self, sender, e):
    # update selection interface property
    self.interface._selection = self._selected_rows()

    if e.IsSelected and self.interface.on_select:
        self.interface.on_select(self.interface, row=self.interface.data[e.ItemIndex])
# Buggy code
def __init__(
    self,
    preprocess_net: nn.Module,
    action_shape: Sequence[int],
    hidden_sizes: Sequence[int] = (),
    max_action: float = 1.0,
    device: Union[str, int, torch.device] = "cpu",
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.device = device
    self.preprocess = preprocess_net
    self.output_dim = np.prod(action_shape)
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, self.output_dim, hidden_sizes)
    self._max = max_action


# Traceback (RuntimeError)
% python test/discrete/test_sac.py                                                                                                                               (git)-[master]-
tianshou/data/buffer.py:348: UserWarning: ListReplayBuffer will be replaced in version 0.4.0.
warnings.warn("ListReplayBuffer will be replaced in version 0.4.0.")
Epoch #1:   0%|                                                                                                                                         | 0/1000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "test/discrete/test_sac.py", line 121, in <module>
test_discrete_sac()
File "test/discrete/test_sac.py", line 104, in test_discrete_sac
result = offpolicy_trainer(
File "tianshou/trainer/offpolicy.py", line 92, in offpolicy_trainer
result = train_collector.collect(n_step=collect_per_step)
File "tianshou/data/collector.py", line 270, in collect
self.data.act = to_numpy(result.act)
File "tianshou/data/utils/converter.py", line 18, in to_numpy
return x.detach().cpu().numpy()
RuntimeError: CUDA error: an illegal memory access was encountered

# Fixed code
def __init__(
    self,
    preprocess_net: nn.Module,
    action_shape: Sequence[int],
    hidden_sizes: Sequence[int] = (),
    max_action: float = 1.0,
    device: Union[str, int, torch.device] = "cpu",
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.device = device
    self.preprocess = preprocess_net
    self.output_dim = np.prod(action_shape)
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, self.output_dim, hidden_sizes, device=self.device)
    self._max = max_action
# Buggy code
def __init__(
    self,
    preprocess_net: nn.Module,
    hidden_sizes: Sequence[int] = (),
    device: Union[str, int, torch.device] = "cpu",
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.device = device
    self.preprocess = preprocess_net
    self.output_dim = 1
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, 1, hidden_sizes)


# Traceback (RuntimeError)
% python test/discrete/test_sac.py                                                                                                                               (git)-[master]-
tianshou/data/buffer.py:348: UserWarning: ListReplayBuffer will be replaced in version 0.4.0.
warnings.warn("ListReplayBuffer will be replaced in version 0.4.0.")
Epoch #1:   0%|                                                                                                                                         | 0/1000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "test/discrete/test_sac.py", line 121, in <module>
test_discrete_sac()
File "test/discrete/test_sac.py", line 104, in test_discrete_sac
result = offpolicy_trainer(
File "tianshou/trainer/offpolicy.py", line 92, in offpolicy_trainer
result = train_collector.collect(n_step=collect_per_step)
File "tianshou/data/collector.py", line 270, in collect
self.data.act = to_numpy(result.act)
File "tianshou/data/utils/converter.py", line 18, in to_numpy
return x.detach().cpu().numpy()
RuntimeError: CUDA error: an illegal memory access was encountered

# Fixed code
def __init__(
    self,
    preprocess_net: nn.Module,
    hidden_sizes: Sequence[int] = (),
    device: Union[str, int, torch.device] = "cpu",
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.device = device
    self.preprocess = preprocess_net
    self.output_dim = 1
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, 1, hidden_sizes, device=self.device)
# Buggy code
def __init__(
    self,
    preprocess_net: nn.Module,
    action_shape: Sequence[int],
    hidden_sizes: Sequence[int] = (),
    max_action: float = 1.0,
    device: Union[str, int, torch.device] = "cpu",
    unbounded: bool = False,
    conditioned_sigma: bool = False,
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.preprocess = preprocess_net
    self.device = device
    self.output_dim = np.prod(action_shape)
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.mu = MLP(input_dim, self.output_dim, hidden_sizes)
    self._c_sigma = conditioned_sigma
    if conditioned_sigma:
        self.sigma = MLP(input_dim, self.output_dim, hidden_sizes)
    else:
        self.sigma_param = nn.Parameter(torch.zeros(self.output_dim, 1))
    self._max = max_action
    self._unbounded = unbounded


# Traceback (RuntimeError)
% python test/discrete/test_sac.py                                                                                                                               (git)-[master]-
tianshou/data/buffer.py:348: UserWarning: ListReplayBuffer will be replaced in version 0.4.0.
warnings.warn("ListReplayBuffer will be replaced in version 0.4.0.")
Epoch #1:   0%|                                                                                                                                         | 0/1000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "test/discrete/test_sac.py", line 121, in <module>
test_discrete_sac()
File "test/discrete/test_sac.py", line 104, in test_discrete_sac
result = offpolicy_trainer(
File "tianshou/trainer/offpolicy.py", line 92, in offpolicy_trainer
result = train_collector.collect(n_step=collect_per_step)
File "tianshou/data/collector.py", line 270, in collect
self.data.act = to_numpy(result.act)
File "tianshou/data/utils/converter.py", line 18, in to_numpy
return x.detach().cpu().numpy()
RuntimeError: CUDA error: an illegal memory access was encountered

# Fixed code
def __init__(
    self,
    preprocess_net: nn.Module,
    action_shape: Sequence[int],
    hidden_sizes: Sequence[int] = (),
    max_action: float = 1.0,
    device: Union[str, int, torch.device] = "cpu",
    unbounded: bool = False,
    conditioned_sigma: bool = False,
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.preprocess = preprocess_net
    self.device = device
    self.output_dim = np.prod(action_shape)
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.mu = MLP(input_dim, self.output_dim, hidden_sizes, device=self.device)
    self._c_sigma = conditioned_sigma
    if conditioned_sigma:
        self.sigma = MLP(input_dim, self.output_dim, hidden_sizes, device=self.device)
    else:
        self.sigma_param = nn.Parameter(torch.zeros(self.output_dim, 1))
    self._max = max_action
    self._unbounded = unbounded
# Buggy code
def __init__(
    self,
    preprocess_net: nn.Module,
    action_shape: Sequence[int],
    hidden_sizes: Sequence[int] = (),
    softmax_output: bool = True,
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.preprocess = preprocess_net
    self.output_dim = np.prod(action_shape)
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, self.output_dim, hidden_sizes)
    self.softmax_output = softmax_output


# Traceback (RuntimeError)
% python test/discrete/test_sac.py                                                                                                                               (git)-[master]-
tianshou/data/buffer.py:348: UserWarning: ListReplayBuffer will be replaced in version 0.4.0.
warnings.warn("ListReplayBuffer will be replaced in version 0.4.0.")
Epoch #1:   0%|                                                                                                                                         | 0/1000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "test/discrete/test_sac.py", line 121, in <module>
test_discrete_sac()
File "test/discrete/test_sac.py", line 104, in test_discrete_sac
result = offpolicy_trainer(
File "tianshou/trainer/offpolicy.py", line 92, in offpolicy_trainer
result = train_collector.collect(n_step=collect_per_step)
File "tianshou/data/collector.py", line 270, in collect
self.data.act = to_numpy(result.act)
File "tianshou/data/utils/converter.py", line 18, in to_numpy
return x.detach().cpu().numpy()
RuntimeError: CUDA error: an illegal memory access was encountered

# Fixed code
def __init__(
    self,
    preprocess_net: nn.Module,
    action_shape: Sequence[int],
    hidden_sizes: Sequence[int] = (),
    softmax_output: bool = True,
    preprocess_net_output_dim: Optional[int] = None,
    device: Union[str, int, torch.device] = "cpu",
) -> None:
    super().__init__()
    self.device = device
    self.preprocess = preprocess_net
    self.output_dim = np.prod(action_shape)
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, self.output_dim, hidden_sizes, device=self.device)
    self.softmax_output = softmax_output
# Buggy code
def __init__(
    self,
    preprocess_net: nn.Module,
    hidden_sizes: Sequence[int] = (),
    last_size: int = 1,
    preprocess_net_output_dim: Optional[int] = None,
) -> None:
    super().__init__()
    self.preprocess = preprocess_net
    self.output_dim = last_size
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, last_size, hidden_sizes)


# Traceback (RuntimeError)
% python test/discrete/test_sac.py                                                                                                                               (git)-[master]-
tianshou/data/buffer.py:348: UserWarning: ListReplayBuffer will be replaced in version 0.4.0.
warnings.warn("ListReplayBuffer will be replaced in version 0.4.0.")
Epoch #1:   0%|                                                                                                                                         | 0/1000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "test/discrete/test_sac.py", line 121, in <module>
test_discrete_sac()
File "test/discrete/test_sac.py", line 104, in test_discrete_sac
result = offpolicy_trainer(
File "tianshou/trainer/offpolicy.py", line 92, in offpolicy_trainer
result = train_collector.collect(n_step=collect_per_step)
File "tianshou/data/collector.py", line 270, in collect
self.data.act = to_numpy(result.act)
File "tianshou/data/utils/converter.py", line 18, in to_numpy
return x.detach().cpu().numpy()
RuntimeError: CUDA error: an illegal memory access was encountered

# Fixed code
def __init__(
    self,
    preprocess_net: nn.Module,
    hidden_sizes: Sequence[int] = (),
    last_size: int = 1,
    preprocess_net_output_dim: Optional[int] = None,
    device: Union[str, int, torch.device] = "cpu",
) -> None:
    super().__init__()
    self.device = device
    self.preprocess = preprocess_net
    self.output_dim = last_size
    input_dim = getattr(preprocess_net, "output_dim", preprocess_net_output_dim)
    self.last = MLP(input_dim, last_size, hidden_sizes, device=self.device)
# Buggy code
def post_process_fn(
    self, batch: Batch, buffer: ReplayBuffer, indice: np.ndarray
) -> None:
    """Post-process the data from the provided replay buffer.

    Typical usage is to update the sampling weight in prioritized
    experience replay. Used in :meth:`update`.
    """
    if isinstance(buffer, PrioritizedReplayBuffer) and hasattr(batch, "weight"):
        buffer.update_weight(indice, batch.weight)


# Traceback (TypeError)
Epoch #1:   0%|          | 0/1 [00:21<?, ?it/s]
Traceback (most recent call last):
File "D:/PycharmProjects/Stable-BaselineTrading/Tianshou/TD3.py", line 85, in <module>
save_fn=lambda p: torch.save(p.state_dict(), save_dir))
File "D:\PycharmProjects\Stable-BaselineTrading\Tianshou\Trainer\offpolicy.py", line 110, in offpolicy_trainer
losses = policy.update(batch_size, train_collector.buffer)
File "C:\Users\zkx74\Anaconda3\envs\RL\lib\site-packages\tianshou\policy\base.py", line 147, in update
result = self.learn(batch, *args, **kwargs)
File "C:\Users\zkx74\Anaconda3\envs\RL\lib\site-packages\tianshou\policy\modelfree\td3.py", line 123, in learn
critic1_loss = (td1.pow(2) * weight).mean()
File "C:\Users\zkx74\Anaconda3\envs\RL\lib\site-packages\torch\tensor.py", line 480, in __array__
return self.numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

# Fixed code
def post_process_fn(
    self, batch: Batch, buffer: ReplayBuffer, indice: np.ndarray
) -> None:
    """Post-process the data from the provided replay buffer.

    Typical usage is to update the sampling weight in prioritized
    experience replay. Used in :meth:`update`.
    """
    if hasattr(buffer, "update_weight") and hasattr(batch, "weight"):
        buffer.update_weight(indice, batch.weight)
# Buggy code
def __radd__(self, X):
    """Y.__radd__(X) <==> Y+X"""
    return add(X, self)


# Traceback (TypeError)
import chaospy as cp
cp.Uniform() + 1
<chaospy.dist.operators.Add at 0x7fb40405e400>
# but this fails
1 + cp.Uniform()
Traceback (most recent call last):
File "chaospy/src/chaospy/dist/backend.py", line 372, in __radd__
return add(X, self)
File "chaospy/src/chaospy/dist/operators.py", line 134, in add
return Add(A=A, B=B)
File "chaospy/src/chaospy/dist/operators.py", line 34, in __init__
_length=length, _advance=True)
File "chaospy/src/chaospy/dist/backend.py", line 115, in __init__
self.dependencies = self.G.run(self.length, "dep")[0]
File "chaospy/src/chaospy/dist/graph.py", line 266, in run
out = self(self.root)
File "chaospy/src/chaospy/dist/graph.py", line 158, in __call__
return self._call(*args, **kwargs)
File "chaospy/src/chaospy/dist/graph.py", line 526, in dep_call
out = dist._dep(self)
File "chaospy/src/chaospy/dist/backend.py", line 345, in _dep
if len(self)==1:
TypeError: only integer arrays with one element can be converted to an index

# Fixed code
def __radd__(self, X):
    """Y.__radd__(X) <==> Y+X"""
    return add(self, X)
# Buggy code
def __rmul__(self, X):
    """Y.__rmul__(X) <==> Y*X"""
    return mul(X, self)


# Traceback (TypeError)
import chaospy as cp
cp.Uniform() + 1
<chaospy.dist.operators.Add at 0x7fb40405e400>
# but this fails
1 + cp.Uniform()
Traceback (most recent call last):
File "chaospy/src/chaospy/dist/backend.py", line 372, in __radd__
return add(X, self)
File "chaospy/src/chaospy/dist/operators.py", line 134, in add
return Add(A=A, B=B)
File "chaospy/src/chaospy/dist/operators.py", line 34, in __init__
_length=length, _advance=True)
File "chaospy/src/chaospy/dist/backend.py", line 115, in __init__
self.dependencies = self.G.run(self.length, "dep")[0]
File "chaospy/src/chaospy/dist/graph.py", line 266, in run
out = self(self.root)
File "chaospy/src/chaospy/dist/graph.py", line 158, in __call__
return self._call(*args, **kwargs)
File "chaospy/src/chaospy/dist/graph.py", line 526, in dep_call
out = dist._dep(self)
File "chaospy/src/chaospy/dist/backend.py", line 345, in _dep
if len(self)==1:
TypeError: only integer arrays with one element can be converted to an index

# Fixed code
def __rmul__(self, X):
    """Y.__rmul__(X) <==> Y*X"""
    return mul(self, X)
# Buggy code
def notifications_hook(self, n):
    nonlocal known_devices
    assert n
    if n.devnumber == 0xFF:
        _notifications.process(receiver, n)
    elif n.sub_id == 0x41:  # allow for other protocols! (was and n.address == 0x04)
        kd, known_devices = (
            known_devices,
            None,
        )  # only process one connection notification
        if kd is not None:
            if n.devnumber not in kd:
                receiver.status.new_device = receiver.register_new_device(
                    n.devnumber, n
                )
            elif receiver.re_pairs:
                del receiver[
                    n.devnumber
                ]  # get rid of information on device re-paired away
                receiver.status.new_device = receiver.register_new_device(
                    n.devnumber, n
                )


# Traceback (IndexError)
solaar: error: Traceback (most recent call last):
File "/usr/share/solaar/lib/solaar/cli/__init__.py", line 175, in run
m.run(c, args, _find_receiver, _find_device)
File "/usr/share/solaar/lib/solaar/cli/pair.py", line 79, in run
receiver.handle.notifications_hook(n)
File "/usr/share/solaar/lib/solaar/cli/pair.py", line 59, in notifications_hook
receiver.status.new_device = receiver[n.devnumber]
File "/usr/share/solaar/lib/logitech_receiver/receiver.py", line 519, in __getitem__
raise IndexError(key)
IndexError: 0

# Fixed code
def notifications_hook(self, n):
    nonlocal known_devices
    assert n
    if n.devnumber == 0xFF:
        _notifications.process(receiver, n)
    elif n.sub_id == 0x41 and len(n.data) == _base._SHORT_MESSAGE_SIZE - 4:
        kd, known_devices = (
            known_devices,
            None,
        )  # only process one connection notification
        if kd is not None:
            if n.devnumber not in kd:
                receiver.status.new_device = receiver.register_new_device(
                    n.devnumber, n
                )
            elif receiver.re_pairs:
                del receiver[
                    n.devnumber
                ]  # get rid of information on device re-paired away
                receiver.status.new_device = receiver.register_new_device(
                    n.devnumber, n
                )
# Buggy code
def __call__(self, device):
    assert not hasattr(self, "_value")
    assert self.device_kind is None or device.kind in self.device_kind
    p = device.protocol
    if p == 1.0:
        # HID++ 1.0 devices do not support features
        assert self._rw.kind == RegisterRW.kind
    elif p >= 2.0:
        # HID++ 2.0 devices do not support registers
        assert self._rw.kind == FeatureRW.kind

    o = _copy(self)
    o._value = None
    o._device = device
    return o


# Traceback (AssertionError)
Traceback (most recent call last):
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/listener.py", line 185, in run
self._notifications_callback(n)
File "/home/user/upstream/hw/Solaar/lib/solaar/listener.py", line 207, in _notifications_handler
_notifications.process(dev, n)
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/notifications.py", line 54, in process
return _process_device_notification(device, status, notification)
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/notifications.py", line 97, in _process_device_notification
return _process_hidpp10_notification(device, status, n)
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/notifications.py", line 174, in _process_hidpp10_notification
status.changed(active=link_established)
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/status.py", line 265, in changed
for s in d.settings:
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/receiver.py", line 254, in settings
_check_feature_settings(self, self._settings)
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/settings_templates.py", line 268, in check_feature_settings
check_feature(_SMOOTH_SCROLL[0], _F.HI_RES_SCROLLING)
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/settings_templates.py", line 266, in check_feature
already_known.append(feature(device))
File "/home/user/upstream/hw/Solaar/lib/logitech_receiver/settings.py", line 63, in __call__
assert self.device_kind is None or self.device_kind == device.kind
AssertionError

# Fixed code
def __call__(self, device):
    assert not hasattr(self, "_value")
    # combined keyboards and touchpads (e.g., K400) break this assertion so don't use it
    # assert self.device_kind is None or device.kind in self.device_kind
    p = device.protocol
    if p == 1.0:
        # HID++ 1.0 devices do not support features
        assert self._rw.kind == RegisterRW.kind
    elif p >= 2.0:
        # HID++ 2.0 devices do not support registers
        assert self._rw.kind == FeatureRW.kind

    o = _copy(self)
    o._value = None
    o._device = device
    return o
# Buggy code
def __init__(self, **kwargs):
    def _readable_name(n):
        if not isinstance(n, str) and not isinstance(n, unicode):
            raise TypeError("expected string, got " + type(n))
        if n == n.upper():
            n.lstrip("_")
        return n.replace("__", "/").replace("_", " ")

    values = {k: NamedInt(v, _readable_name(k)) for (k, v) in kwargs.items()}
    self.__dict__ = values
    self._values = sorted(list(values.values()))
    self._indexed = {int(v): v for v in self._values}
    self._fallback = None


# Traceback (ValueError)
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(*self.__args, **self.__kwargs)
File "/opt/extras.ubuntu.com/solaar/share/solaar/lib/solaar/ui/config_panel.py", line 36, in _process_apply_queue
value = setting.write(value)
File "/opt/extras.ubuntu.com/solaar/share/solaar/lib/logitech/unifying_receiver/settings.py", line 58, in write
data_bytes = self._validator.prepare_write(value)
File "/opt/extras.ubuntu.com/solaar/share/solaar/lib/logitech/unifying_receiver/settings.py", line 164, in prepare_write
raise ValueError("invalid choice " + repr(value))
ValueError: invalid choice ' 1500'

# Fixed code
def __init__(self, **kwargs):
    def _readable_name(n):
        if not isinstance(n, str) and not isinstance(n, unicode):
            raise TypeError("expected string, got " + type(n))
        if n == n.upper():
            n = n.lstrip("_")
        return n.replace("__", "/").replace("_", " ")

    values = {k: NamedInt(v, _readable_name(k)) for (k, v) in kwargs.items()}
    self.__dict__ = values
    self._values = sorted(list(values.values()))
    self._indexed = {int(v): v for v in self._values}
    self._fallback = None
# Buggy code
def _readable_name(n):
    if not isinstance(n, str) and not isinstance(n, unicode):
        raise TypeError("expected string, got " + type(n))
    if n == n.upper():
        n.lstrip("_")
    return n.replace("__", "/").replace("_", " ")


# Traceback (ValueError)
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(*self.__args, **self.__kwargs)
File "/opt/extras.ubuntu.com/solaar/share/solaar/lib/solaar/ui/config_panel.py", line 36, in _process_apply_queue
value = setting.write(value)
File "/opt/extras.ubuntu.com/solaar/share/solaar/lib/logitech/unifying_receiver/settings.py", line 58, in write
data_bytes = self._validator.prepare_write(value)
File "/opt/extras.ubuntu.com/solaar/share/solaar/lib/logitech/unifying_receiver/settings.py", line 164, in prepare_write
raise ValueError("invalid choice " + repr(value))
ValueError: invalid choice ' 1500'

# Fixed code
def _readable_name(n):
    if not isinstance(n, str) and not isinstance(n, unicode):
        raise TypeError("expected string, got " + type(n))
    if n == n.upper():
        n = n.lstrip("_")
    return n.replace("__", "/").replace("_", " ")
# Buggy code
def safe_update_index(path):
    chunk_id = path.rsplit("/", 1)[-1]
    if len(chunk_id) != STRLEN_CHUNKID:
        return
    for c in chunk_id:
        if c not in hexdigits:
            return
    try:
        self.update_index(path)
        self.successes += 1
        self.logger.debug("Updated %s", path)
    except OioNetworkException as exc:
        self.errors += 1
        self.logger.warn("ERROR while updating %s: %s", path, exc)
    except Exception:
        self.errors += 1
        self.logger.exception("ERROR while updating %s", path)
    self.total_since_last_reported += 1


# Traceback (VolumeException)
11573 7F920C7A0730 log ERROR ERROR while updating /var/lib/oio/sds/OPENIO/rawx-0/7BD/7BDE49669C6616A0656097C6544923F1BB0EE711A23D9D18B7D23071997AB9F7
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/oio/blob/indexer.py", line 65, in safe_update_index
self.update_index(path)
File "/usr/lib/python2.7/dist-packages/oio/blob/indexer.py", line 132, in update_index
**data)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 298, in chunk_push
json=body, headers=headers)
File "/usr/lib/python2.7/dist-packages/oio/common/utils.py", line 586, in ensure_headers_wrapper
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/common/utils.py", line 596, in ensure_request_id_wrapper
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 273, in _rdir_request
uri = self._make_uri(action, volume)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 264, in _make_uri
rdir_host = self._get_rdir_addr(volume_id)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 261, in _get_rdir_addr
raise VolumeException('No rdir assigned to volume %s' % volume_id)
VolumeException: No rdir assigned to volume 172.18.0.1:6004

# Fixed code
def safe_update_index(path):
    chunk_id = path.rsplit("/", 1)[-1]
    if len(chunk_id) != STRLEN_CHUNKID:
        return
    for c in chunk_id:
        if c not in hexdigits:
            return
    try:
        self.update_index(path)
        self.successes += 1
        self.logger.debug("Updated %s", path)
    except OioNetworkException as exc:
        self.errors += 1
        self.logger.warn("ERROR while updating %s: %s", path, exc)
    except VolumeException as exc:
        self.errors += 1
        self.logger.error("Cannot index %s: %s", path, exc)
        # All chunks of this volume are indexed in the same service,
        # no need to try another chunk, it will generate the same
        # error. Let the upper level retry later.
        raise
    except Exception:
        self.errors += 1
        self.logger.exception("ERROR while updating %s", path)
    self.total_since_last_reported += 1
# Buggy code
def run(self, *args, **kwargs):
    time.sleep(random() * self.interval)
    while True:
        pre = time.time()
        try:
            self.index_pass()
        except Exception as e:
            self.logger.exception("ERROR during indexing: %s" % e)
        else:
            self.passes += 1
        elapsed = (time.time() - pre) or 0.000001
        if elapsed < self.interval:
            time.sleep(self.interval - elapsed)


# Traceback (VolumeException)
11573 7F920C7A0730 log ERROR ERROR while updating /var/lib/oio/sds/OPENIO/rawx-0/7BD/7BDE49669C6616A0656097C6544923F1BB0EE711A23D9D18B7D23071997AB9F7
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/oio/blob/indexer.py", line 65, in safe_update_index
self.update_index(path)
File "/usr/lib/python2.7/dist-packages/oio/blob/indexer.py", line 132, in update_index
**data)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 298, in chunk_push
json=body, headers=headers)
File "/usr/lib/python2.7/dist-packages/oio/common/utils.py", line 586, in ensure_headers_wrapper
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/common/utils.py", line 596, in ensure_request_id_wrapper
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 273, in _rdir_request
uri = self._make_uri(action, volume)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 264, in _make_uri
rdir_host = self._get_rdir_addr(volume_id)
File "/usr/lib/python2.7/dist-packages/oio/rdir/client.py", line 261, in _get_rdir_addr
raise VolumeException('No rdir assigned to volume %s' % volume_id)
VolumeException: No rdir assigned to volume 172.18.0.1:6004

# Fixed code
def run(self, *args, **kwargs):
    time.sleep(random() * self.interval)
    while True:
        pre = time.time()
        try:
            self.index_pass()
        except VolumeException as exc:
            self.logger.error("Cannot index chunks, will retry later: %s", exc)
        except Exception as exc:
            self.logger.exception("ERROR during indexing: %s", exc)
        else:
            self.passes += 1
        elapsed = (time.time() - pre) or 0.000001
        if elapsed < self.interval:
            time.sleep(self.interval - elapsed)
# Buggy code
def object_locate(self, account, container, obj, version=None, **kwargs):
    """
    Get a description of the object along with the list of its chunks.

    :param account: name of the account in which the object is stored
    :param container: name of the container in which the object is stored
    :param obj: name of the object to query
    :param version: version of the object to query
    :returns: a tuple with object metadata `dict` as first element
        and chunk `list` as second element
    """
    obj_meta, chunks = self.container.content_locate(
        account, container, obj, version=version, **kwargs
    )
    return obj_meta, chunks


# Traceback (KeyError)
Checking object "account=AUTH_demo, container=testing, obj=magic"
Checking container "account=AUTH_demo, container=testing, obj=magic"
Checking account "account=AUTH_demo, container=testing, obj=magic"
Exception object "account=AUTH_demo, container=testing, obj=magic": ('reqid=None', 'Connection aborted.', HTTPException('got more than 100 headers',))
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/eventlet/greenpool.py", line 82, in _spawn_n_impl
func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/oio/crawler/integrity.py", line 244, in check_obj
self.check_obj_policy(target.copy(), meta, results)
File "/usr/lib/python2.7/site-packages/oio/crawler/integrity.py", line 185, in check_obj_policy
stg_met = STORAGE_METHODS.load(obj_meta['chunk_method'])
KeyError: 'chunk_method'

Report
Accounts checked  : 1

Containers checked: 1

Objects checked   : 0
Exceptions        : 1

Chunks checked    : 0

# Fixed code
def object_locate(
    self, account, container, obj, version=None, properties=True, **kwargs
):
    """
    Get a description of the object along with the list of its chunks.

    :param account: name of the account in which the object is stored
    :param container: name of the container in which the object is stored
    :param obj: name of the object to query
    :param version: version of the object to query
    :param properties: should the request return object properties
        along with content description
    :type properties: `bool`

    :returns: a tuple with object metadata `dict` as first element
        and chunk `list` as second element
    """
    obj_meta, chunks = self.container.content_locate(
        account, container, obj, version=version, properties=properties, **kwargs
    )
    return obj_meta, chunks
# Buggy code
def take_action(self, parsed_args):
    import os

    self.log.debug("take_action(%s)", parsed_args)

    account = self.app.client_manager.get_account()
    container = parsed_args.container
    objs = self.app.client_manager.storage.object_list(account, container)

    for obj in objs["objects"]:
        obj_name = obj["name"]
        _, stream = self.app.client_manager.storage.object_fetch(
            account, container, obj_name
        )

        if not os.path.exists(os.path.dirname(obj_name)):
            if len(os.path.dirname(obj_name)) > 0:
                os.makedirs(os.path.dirname(obj_name))
        with open(obj_name, "wb") as f:
            for chunk in stream:
                f.write(chunk)


# Traceback (KeyError)
Checking object "account=AUTH_demo, container=testing, obj=magic"
Checking container "account=AUTH_demo, container=testing, obj=magic"
Checking account "account=AUTH_demo, container=testing, obj=magic"
Exception object "account=AUTH_demo, container=testing, obj=magic": ('reqid=None', 'Connection aborted.', HTTPException('got more than 100 headers',))
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/eventlet/greenpool.py", line 82, in _spawn_n_impl
func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/oio/crawler/integrity.py", line 244, in check_obj
self.check_obj_policy(target.copy(), meta, results)
File "/usr/lib/python2.7/site-packages/oio/crawler/integrity.py", line 185, in check_obj_policy
stg_met = STORAGE_METHODS.load(obj_meta['chunk_method'])
KeyError: 'chunk_method'

Report
Accounts checked  : 1

Containers checked: 1

Objects checked   : 0
Exceptions        : 1

Chunks checked    : 0

# Fixed code
def take_action(self, parsed_args):
    import os

    self.log.debug("take_action(%s)", parsed_args)

    account = self.app.client_manager.get_account()
    container = parsed_args.container
    objs = self.app.client_manager.storage.object_list(account, container)

    for obj in objs["objects"]:
        obj_name = obj["name"]
        _, stream = self.app.client_manager.storage.object_fetch(
            account, container, obj_name, properties=False
        )

        if not os.path.exists(os.path.dirname(obj_name)):
            if len(os.path.dirname(obj_name)) > 0:
                os.makedirs(os.path.dirname(obj_name))
        with open(obj_name, "wb") as f:
            for chunk in stream:
                f.write(chunk)
# Buggy code
def take_action(self, parsed_args):
    self.log.debug("take_action(%s)", parsed_args)
    super(SaveObject, self).take_action(parsed_args)

    container = parsed_args.container
    obj = parsed_args.object
    key_file = parsed_args.key_file
    if key_file and key_file[0] != "/":
        key_file = os.getcwd() + "/" + key_file
    filename = parsed_args.file
    if not filename:
        filename = obj
    if parsed_args.auto:
        container = self.flatns_manager(obj)

    meta, stream = self.app.client_manager.storage.object_fetch(
        self.app.client_manager.get_account(), container, obj, key_file=key_file
    )
    if not os.path.exists(os.path.dirname(filename)):
        if len(os.path.dirname(filename)) > 0:
            os.makedirs(os.path.dirname(filename))
    with open(filename, "wb") as ofile:
        for chunk in stream:
            ofile.write(chunk)


# Traceback (KeyError)
Checking object "account=AUTH_demo, container=testing, obj=magic"
Checking container "account=AUTH_demo, container=testing, obj=magic"
Checking account "account=AUTH_demo, container=testing, obj=magic"
Exception object "account=AUTH_demo, container=testing, obj=magic": ('reqid=None', 'Connection aborted.', HTTPException('got more than 100 headers',))
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/eventlet/greenpool.py", line 82, in _spawn_n_impl
func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/oio/crawler/integrity.py", line 244, in check_obj
self.check_obj_policy(target.copy(), meta, results)
File "/usr/lib/python2.7/site-packages/oio/crawler/integrity.py", line 185, in check_obj_policy
stg_met = STORAGE_METHODS.load(obj_meta['chunk_method'])
KeyError: 'chunk_method'

Report
Accounts checked  : 1

Containers checked: 1

Objects checked   : 0
Exceptions        : 1

Chunks checked    : 0

# Fixed code
def take_action(self, parsed_args):
    self.log.debug("take_action(%s)", parsed_args)
    super(SaveObject, self).take_action(parsed_args)

    container = parsed_args.container
    obj = parsed_args.object
    key_file = parsed_args.key_file
    if key_file and key_file[0] != "/":
        key_file = os.getcwd() + "/" + key_file
    filename = parsed_args.file
    if not filename:
        filename = obj
    if parsed_args.auto:
        container = self.flatns_manager(obj)

    _meta, stream = self.app.client_manager.storage.object_fetch(
        self.app.client_manager.get_account(),
        container,
        obj,
        key_file=key_file,
        properties=False,
    )
    if not os.path.exists(os.path.dirname(filename)):
        if len(os.path.dirname(filename)) > 0:
            os.makedirs(os.path.dirname(filename))
    with open(filename, "wb") as ofile:
        for chunk in stream:
            ofile.write(chunk)
# Buggy code
def init(self):
    eventlet.monkey_patch(os=False)
    self.tube = self.conf.get("tube", DEFAULT_TUBE)
    self.session = requests.Session()
    self.cs = ConscienceClient(self.conf)
    self.rdir = RdirClient(self.conf)
    self._acct_addr = None
    self.acct_update = 0
    self.graceful_timeout = 1
    self.acct_refresh_interval = int_value(self.conf.get("acct_refresh_interval"), 60)
    self.acct_update = true_value(self.conf.get("acct_update", True))
    self.rdir_update = true_value(self.conf.get("rdir_update", True))
    if "handlers_conf" not in self.conf:
        raise ValueError("'handlers_conf' path not defined in conf")
    self.handlers = loadhandlers(
        self.conf.get("handlers_conf"), evt_types, global_conf=self.conf, app=self
    )
    super(EventWorker, self).init()


# Traceback (LookupError)
Traceback (most recent call last):
File "/home/fvennetier/src/public_git/oio-sds/oio/event/agent.py", line 166, in spawn_worker
worker.init()
File "/home/fvennetier/src/public_git/oio-sds/oio/event/consumer.py", line 144, in init
app=self)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 72, in loadhandlers
for name in names
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 72, in <genexpr>
for name in names
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 78, in loadhandler
context = loader.get_context(HANDLER, name, global_conf)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 137, in get_context
obj_type, name=name)
File "/home/fvennetier/src/public_git/oio-sds/oio/event/loader.py", line 206, in find_config_section
'No section %r found in config %r' % (name, self.filename))
LookupError: No section 'account.services' found in config '/home/fvennetier/.oio/sds/conf/event-handlers.conf'

# Fixed code
def init(self):
    eventlet.monkey_patch(os=False)
    self.tube = self.conf.get("tube", DEFAULT_TUBE)
    self.session = requests.Session()
    self.cs = ConscienceClient(self.conf)
    self.rdir = RdirClient(self.conf)
    self._acct_addr = None
    self.acct_update = 0
    self.graceful_timeout = 1
    self.acct_refresh_interval = int_value(self.conf.get("acct_refresh_interval"), 60)
    self.acct_update = true_value(self.conf.get("acct_update", True))
    self.rdir_update = true_value(self.conf.get("rdir_update", True))
    if "handlers_conf" not in self.conf:
        raise ValueError("'handlers_conf' path not defined in conf")
    self.handlers = loadhandlers(
        self.conf.get("handlers_conf"), global_conf=self.conf, app=self
    )
    super(EventWorker, self).init()