示例#1
0
from prompt_toolkit.history import FileHistory
from prompt_toolkit.shortcuts import get_input
from ptpython.completer import PythonCompleter
from pygments import highlight
from pygments.formatters import Terminal256Formatter

if six.PY3:
    from pygments.lexers.python import (
        Python3Lexer as PythonLexer,
        Python3TracebackLexer as PythonTracebackLexer,
    )
else:
    from pygments.lexers.python import PythonLexer, PythonTracebackLexer


standardpaths.configure(application_name='ctypes-ejdb')


WINDOWS = (platform.system().lower() == 'windows')


def print_exc(with_color, chain=True):
    if six.PY3:
        rep = traceback.format_exc(chain=chain)
    else:
        rep = traceback.format_exc()
    if with_color:
        out = highlight(rep, PythonLexer(), Terminal256Formatter())
    else:
        out = rep
    print(out)
示例#2
0
from prompt_toolkit.history import FileHistory
from prompt_toolkit.shortcuts import get_input
from ptpython.completer import PythonCompleter
from pygments import highlight
from pygments.formatters import Terminal256Formatter

if six.PY3:
    from pygments.lexers.python import (
        Python3Lexer as PythonLexer,
        Python3TracebackLexer as PythonTracebackLexer,
    )
else:
    from pygments.lexers.python import PythonLexer, PythonTracebackLexer

standardpaths.configure(application_name='ctypes-ejdb')


def print_exc(chain=True):
    if six.PY3:
        rep = traceback.format_exc(chain=chain)
    else:
        rep = traceback.format_exc()
    out = highlight(rep, PythonTracebackLexer(), Terminal256Formatter())
    print(out)


def output(thing):
    rep = pprint.pformat(thing)
    out = highlight(rep, PythonLexer(), Terminal256Formatter())
    print(out)
示例#3
0
 def setup_class(cls):
     cls.enum_values = set([v for v in Location])
     cls.app = QCoreApplication(sys.argv)
     cls.app.setApplicationName('Yksom')
     cls.app.setOrganizationName('uranusjr')
     configure(application_name='Yksom', organization_name='uranusjr')
示例#4
0
curl --data '{"key":"super secret"}' http://localhost:6277/
{"master_key": "secret"}%
"""
import os
import logging
import json
import sys
import threading

import daemon
import daemon.pidfile
import standardpaths
import web

standardpaths.configure(application_name='bitwarden',
                        organization_name='birl.org')

logFile = os.path.join(standardpaths.get_writable_path('app_local_data'),
                       'agent.log')
lh = logging.FileHandler(logFile)
lh.setFormatter(
    logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
log = logging.getLogger(__name__)
log.addHandler(lh)
if os.getenv('DEBUG', False):
    # print("debug ls on")
    log.setLevel(logging.DEBUG)
# print("logging to:%s" % logFile)

pidPath = os.path.join(standardpaths.get_writable_path('app_local_data'),
                       'agent.pid')