Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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.
# Import oslotest before importing test submodules to setup six.moves for mock
import oslotest
try:
import eventlet
except ImportError:
pass
else:
# Ensure that eventlet monkey patching is enabled before loading the qpid
# module, otherwise qpid will hang
eventlet.monkey_patch()
import six
import eventlet
from github import Github
from st2reactor.sensor.base import PollingSensor
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=True,
time=True)
DATE_FORMAT_STRING = '%Y-%m-%d %H:%M:%S'
# Default Github API url
DEFAULT_API_URL = 'https://api.github.com'
class GithubRepositorySensor(PollingSensor):
def __init__(self, sensor_service, config=None, poll_interval=None):
super(GithubRepositorySensor, self).__init__(sensor_service=sensor_service,
from monero_glue.misc.bip import bip32
from monero_glue.protocol_base import messages
from monero_glue.xmr import crypto, monero, wallet
from monero_glue.xmr.core import mnemonic
from monero_poc.utils import cli, misc
from monero_serialize import xmrserialize
import coloredlogs
import eventlet
from eventlet import wsgi
from flask import Flask, abort, jsonify, request
logger = logging.getLogger(__name__)
coloredlogs.CHROOT_FILES = []
coloredlogs.install(level=logging.WARNING, use_chroot=False)
eventlet.monkey_patch(socket=True)
class TokenInterface(iface.TokenInterface):
def __init__(self, server=None):
self.server = server
self.tsx_waiter = misc.CliPrompt(pre_wait_hook=server.update_prompt)
self.ki_sync_waiter = misc.CliPrompt(pre_wait_hook=server.update_prompt)
self.tsx_data = None
self.confirmed_result = False
def get_tx_data(self):
return self.tsx_data
@property
def in_confirmation(self):
return self.tsx_waiter.in_confirmation
import os
import sys
from oslo.config import cfg
from st2common import log as logging
from st2common.models.db import db_setup
from st2common.models.db import db_teardown
from st2actions import config
from st2actions import history
LOG = logging.getLogger(__name__)
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=False if '--use-debugger' in sys.argv else True,
time=True)
def _setup():
# Parse args to setup config.
config.parse_args()
# Setup logging.
logging.setup(cfg.CONF.history.logging)
# All other setup which requires config to be parsed and logging to be correctly setup.
username = cfg.CONF.database.username if hasattr(cfg.CONF.database, 'username') else None
def monkey_patch():
eventlet.monkey_patch()
if os.name != 'nt':
p_c_e = importutils.import_module('pyroute2.config.asyncio')
p_c_e.asyncio_config()
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
import eventlet
if __name__ == "__main__":
eventlet.monkey_patch()
import sys
import traceback
from oslo_config import cfg
from oslo_log import log as logging
from tricircle.common.i18n import _LE
from tricircle.common.nova_lib import conductor_rpcapi
from tricircle.common.nova_lib import db_api as nova_db_api
from tricircle.common.nova_lib import exception as nova_exception
from tricircle.common.nova_lib import objects as nova_objects
from tricircle.common.nova_lib import objects_base
from tricircle.common.nova_lib import quota
from tricircle.common.nova_lib import rpc as nova_rpc
from tricircle.dispatcher import service
import eventlet
eventlet.monkey_patch() # for flask_socketio message queue support
from app import create_app
from app.routes import routes, handlers
from flask_socketio import SocketIO
app = create_app(blueprints=[routes])
socketio = SocketIO(app, message_queue='redis://localhost:6379')
# have to do this manually
for msg, funcs in handlers.items():
for ns, func in funcs.items():
socketio.on(msg, namespace=ns)(func)
socketio.run(app, host='0.0.0.0', port=5000, debug=True)
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
#
import eventlet
eventlet.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active
"""Heroshi URL server implementation main module."""
__all__ = ['Manager']
import datetime
import dateutil.parser
import eventlet, eventlet.pools, eventlet.queue
from eventlet import greenthread, spawn, sleep, Queue
eventlet.monkey_patch(all=False, socket=True, select=True, psycopg=True)
try:
import yajl as json
except ImportError:
import json
from heroshi import TIME_FORMAT, get_logger, log_exceptions
log = get_logger("manager")
from heroshi.conf import settings
from heroshi.data import Cache
from heroshi.misc import reraise_errors
from heroshi.profile import Profile
from heroshi.storage.postgres import StorageConnection
class Manager(object):
"""Class encapsulating Heroshi URL server state."""
def main():
eventlet.monkey_patch()
cfg.CONF.register_opts(OPTS)
cfg.CONF.register_opts(AGENT_OPTS, "AGENT")
cfg.CONF(project='neutron')
common_config.register_agent_state_opts_helper(cfg.CONF)
common_config.register_root_helper(cfg.CONF)
logging_config.setup_logging(cfg.CONF)
# Create a CalicoMetadataProxy.
metadata_proxy = CalicoMetadataProxy(cfg.CONF.AGENT.root_helper)
# Now just sleep.
LOG.info(_("Agent initialized successfully, now running... "))
while True:
time.sleep(cfg.CONF.AGENT.polling_interval)