IndexError: list index out of range
sentry_patched_wsgi_app
def sentry_patched_wsgi_app(self, environ, start_response):
# type: (Any, Dict[str, str], Callable[..., Any]) -> _ScopedResponse
if Hub.current.get_integration(FlaskIntegration) is None:
return old_app(self, environ, start_response)
return SentryWsgiMiddleware(lambda *a, **kw: old_app(self, *a, **kw))(
environ, start_response
)
Flask.__call__ = sentry_patched_wsgi_app
__call__
partial(
_sentry_start_response, start_response, transaction
),
)
except BaseException:
reraise(*_capture_exception(hub))
finally:
_wsgi_middleware_applied.set(False)
return _ScopedResponse(hub, rv)
reraise
def reraise(tp, value, tb=None):
# type: (Optional[Type[BaseException]], Optional[BaseException], Optional[Any]) -> None
assert value is not None
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
# contextlib.contextmanager already can be used as decorator in Python 3.2+
contextmanager = contextlib.contextmanager
__call__
with hub.start_transaction(
transaction, custom_sampling_context={"wsgi_environ": environ}
):
try:
rv = self.app(
environ,
partial(
_sentry_start_response, start_response, transaction
),
)
<lambda>
def sentry_patched_wsgi_app(self, environ, start_response):
# type: (Any, Dict[str, str], Callable[..., Any]) -> _ScopedResponse
if Hub.current.get_integration(FlaskIntegration) is None:
return old_app(self, environ, start_response)
return SentryWsgiMiddleware(lambda *a, **kw: old_app(self, *a, **kw))(
environ, start_response
)
Flask.__call__ = sentry_patched_wsgi_app
__call__
def __call__(self, environ: dict, start_response: t.Callable) -> t.Any:
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app`, which can be
wrapped to apply middleware.
"""
return self.wsgi_app(environ, start_response)
wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
wsgi_app
ctx = self.request_context(environ)
error: BaseException | None = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
full_dispatch_request
request_started.send(self, _async_wrapper=self.ensure_sync)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
self,
rv: ft.ResponseReturnValue | HTTPException,
full_dispatch_request
try:
request_started.send(self, _async_wrapper=self.ensure_sync)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
dispatch_request
and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
view_args: dict[str, t.Any] = req.view_args # type: ignore[assignment]
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
def full_dispatch_request(self) -> Response:
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
convert
path, dirs, files = walked[0]
conversion_input = os.path.join(path, files[0])
else:
conversion_input = conversion_input + '/' + archive_name + '/'
hepdata_converter.convert(conversion_input,
conversion_output,
kwargs.get('options', {}))
if not os.path.isdir(conversion_output):
output_format = output_format[:-1] if output_format == 'yoda1' else output_format
convert
# if no output was specified create proxy output to which writer can insert data
_output = output
if not _output:
_output = StringIO()
writer.write(parser.parse(input), _output)
# if no output was specified return output
if not output:
return _output.getvalue()
write
self._prepare_outputs(data_out, outputs)
output = outputs[0]
for i in range(len(self.tables)):
table = self.tables[i]
self._write_table(output, table)
if data_out != output and hasattr(data_out, 'write'):
output.Flush()
output.ReOpen('read')
file_size = output.GetSize()
_write_table
if self.hepdata_doi:
table_doi = 'doi:' + self.hepdata_doi + '/t' + str(table.index)
else:
table_doi = table.name
f = ObjectFactory(self.class_list, table.independent_variables, table.dependent_variables)
for graph in f.get_next_object():
graph.SetTitle(table_doi)
graph.Write()
def _prepare_outputs(self, data_out, outputs):
""" Open a ROOT file with option 'RECREATE' to create a new file (the file will
get_next_object
# but go for best fit of "core" objects eg. TGraph)
if not class_wrapper.core_object and auxiliary_object_created:
continue
objects = class_wrapper.match_and_create(self.map[dependent_variable_index],
self.dependent_variables[dependent_variable_index],
dependent_variable_index)
if objects and not class_wrapper.core_object:
auxiliary_object_created = True
match_and_create
return True
@classmethod
def match_and_create(cls, independent_variables_map, dependent_variable, dependent_variable_index):
if cls.match(independent_variables_map, dependent_variable):
return cls(independent_variables_map, dependent_variable, dependent_variable_index).create_objects()
return []
def calculate_total_errors(self):
is_number_list = self.is_number_var(self.dependent_variable)
for independent_variable in self.independent_variable_map:
create_objects
return False
return True
return False
def create_objects(self):
self.calculate_total_errors()
if len(self.xval[0]):
graph = ROOTModule.TGraphAsymmErrors(len(self.xval[0]),
array.array('d', self.xval[0]),
array.array('d', self.yval),
calculate_total_errors
self.xerr_minus.append(xerr_minus)
xerr_plus = []
self.xerr_plus.append(xerr_plus)
xval = []
self.xval.append(xval)
ArrayWriter.calculate_total_errors(independent_variable, is_number_list,
xerr_minus, xerr_plus, xval)
ArrayWriter.calculate_total_errors(self.dependent_variable, is_number_list,
self.yerr_minus, self.yerr_plus, self.yval, self.err_breakdown)
calculate_total_errors
@staticmethod
def calculate_total_errors(variable, is_number_list, min_errs, max_errs, values, err_breakdown={}):
i_numeric = -1 # bin number excluding non-numeric y values
for i, entry in enumerate(variable['values']):
if not is_number_list[i]:
continue # skip non-numeric y values
else:
i_numeric += 1
if 'value' in entry:
values.append(entry['value'])
IndexError: list index out of range
This is the Copy/Paste friendly version of the traceback.
The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.