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 # type: ignore
__call__
rv = self.app(
environ,
partial(_sentry_start_response, start_response, span),
)
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
def with_metaclass(meta, *bases):
# type: (Any, *Any) -> Any
class MetaClass(type):
__call__
span.op = "http.server"
span.transaction = "generic WSGI request"
with hub.start_span(span) as span:
try:
rv = self.app(
environ,
partial(_sentry_start_response, start_response, span),
)
except BaseException:
reraise(*_capture_exception(hub))
<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 # type: ignore
__call__
def __call__(self, environ, start_response):
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app` which can be
wrapped to applying middleware."""
return self.wsgi_app(environ, start_response)
def __repr__(self):
return "<%s %r>" % (self.__class__.__name__, self.name)
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:
handle_exception
# if we want to repropagate the exception, we can attempt to
# raise it with the whole traceback in case we can do that
# (the function was actually called from the except part)
# otherwise, we just raise the error again
if exc_value is e:
reraise(exc_type, exc_value, tb)
else:
raise e
self.log_exception((exc_type, exc_value, tb))
server_error = InternalServerError()
reraise
import collections.abc as collections_abc
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
implements_to_string = _identity
else:
iterkeys = lambda d: d.iterkeys()
wsgi_app
ctx = self.request_context(environ)
error = 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)
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, from_error_handler=False):
"""Given the return value from a view function this finalizes
the request by converting it into a response and invoking the
handle_user_exception
return self.handle_http_exception(e)
handler = self._find_error_handler(e)
if handler is None:
reraise(exc_type, exc_value, tb)
return handler(e)
def handle_exception(self, e):
"""Handle an exception that did not have an error handler
associated with it, or that was raised from an error handler.
reraise
import collections.abc as collections_abc
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
implements_to_string = _identity
else:
iterkeys = lambda d: d.iterkeys()
full_dispatch_request
self.try_trigger_before_first_request_functions()
try:
request_started.send(self)
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, from_error_handler=False):
dispatch_request
getattr(rule, "provide_automatic_options", False)
and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
return self.view_functions[rule.endpoint](**req.view_args)
def full_dispatch_request(self):
"""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):
archive_name = archive_name + '.' + 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
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.