##// END OF EJS Templates
black: reformat source
black: reformat source

File last commit:

r153:32f4b641
r153:32f4b641
Show More
__init__.py
49 lines | 1.5 KiB | text/x-python | PythonLexer
project: add missing lib directory
r2 # -*- coding: utf-8 -*-
license: change the license to Apache 2.0
r112 # Copyright 2010 - 2017 RhodeCode GmbH and the AppEnlight project authors
project: add missing lib directory
r2 #
license: change the license to Apache 2.0
r112 # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
project: add missing lib directory
r2 #
license: change the license to Apache 2.0
r112 # http://www.apache.org/licenses/LICENSE-2.0
project: add missing lib directory
r2 #
license: change the license to Apache 2.0
r112 # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
project: add missing lib directory
r2
"""Miscellaneous support packages for {{project}}.
"""
import random
import string
import importlib
from appenlight_client.exceptions import get_current_traceback
def generate_random_string(chars=10):
black: reformat source
r153 return "".join(random.sample(string.ascii_letters * 2 + string.digits, chars))
project: add missing lib directory
r2
def to_integer_safe(input):
try:
return int(input)
black: reformat source
r153 except (TypeError, ValueError):
project: add missing lib directory
r2 return None
celery: decouple report notifications from alerts
r21
project: add missing lib directory
r2 def print_traceback(log):
black: reformat source
r153 traceback = get_current_traceback(
skip=1, show_hidden_frames=True, ignore_system_exceptions=True
)
project: add missing lib directory
r2 exception_text = traceback.exception
log.error(exception_text)
log.error(traceback.plaintext)
del traceback
celery: decouple report notifications from alerts
r21
project: add missing lib directory
r2 def get_callable(import_string):
black: reformat source
r153 import_module, indexer_callable = import_string.split(":")
return getattr(importlib.import_module(import_module), indexer_callable)