If installed this causes Django's queries to be captured.
517459
def install_sql_hook():
    # type: () -> None
    """"""
    try:
        from django.db.backends.utils import CursorWrapper  # type: ignore
    except ImportError:
        from django.db.backends.util import CursorWrapper  # type: ignore

    try:
        real_execute = CursorWrapper.execute
        real_executemany = CursorWrapper.executemany
    except AttributeError:
        # This won't work on Django versions < 1.6
        return

    def record_many_sql(sql, param_list, cursor):
        for params in param_list:
            record_sql(sql, params, cursor)

    def execute(self, sql, params=None):
        try:
            return real_execute(self, sql, params)
        finally:
            record_sql(sql, params, self.cursor)

    def executemany(self, sql, param_list):
        try:
            return real_executemany(self, sql, param_list)
        finally:
            record_many_sql(sql, param_list, self.cursor)

    CursorWrapper.execute = execute
    CursorWrapper.executemany = executemany
    ignore_logger("django.db.backends")
125632
def check_db_connection():
    '''
    
    '''
    # mysql is lazily connected to in django.
    # connection.connection is None means
    # you have not connected to mysql before
    if connection.connection and not connection.is_usable():
        # destroy the default mysql connection
        # after this line, when you use ORM methods
        # django will reconnect to the default mysql
        logger.debug('deleted default connection')
        del connections._connections.default
733631
def autodiscover():
    '''
    
    '''
    from .compat import importlib

    # Bail out if autodiscover didn't finish loading from a previous call so
    # that we avoid running autodiscover again when the URLconf is loaded by
    # the exception handler to resolve the handler500 view.  This prevents an
    # autofixtures.py module with errors from re-registering models and raising a
    # spurious AlreadyRegistered exception (see #8245).
    global LOADING
    if LOADING:
        return
    LOADING = True
    app_paths = {}

    # For each app, we need to look for an autofixture.py inside that app's
    # package. We can't use os.path here -- recall that modules may be
    # imported different ways (think zip files) -- so we need to get
    # the app's __path__ and look for autofixture.py on that path.

    # Step 1: find out the app's __path__ Import errors here will (and
    # should) bubble up, but a missing __path__ (which is legal, but weird)
    # fails silently -- apps that do weird things with __path__ might
    # need to roll their own autofixture registration.

    import imp
    try:
        from django.apps import apps

        for app_config in apps.get_app_configs():
            app_paths[app_config.name] = [app_config.path]

    except ImportError:
        # Django < 1.7
        from django.conf import settings

        for app in settings.INSTALLED_APPS:
            mod = importlib.import_module(app)
            try:
                app_paths[app] = mod.__path__
            except AttributeError:
                continue

    for app, app_path in app_paths.items():
        # Step 2: use imp.find_module to find the app's autofixtures.py. For some
        # reason imp.find_module raises ImportError if the app can't be found
        # but doesn't actually try to import the module. So skip this app if
        # its autofixtures.py doesn't exist
        try:
            file, _, _ = imp.find_module('autofixtures', app_path)
        except ImportError:
            continue
        else:
            if file:
                file.close()

        # Step 3: import the app's autofixtures file. If this has errors we want them
        # to bubble up.
        try:
            importlib.import_module("%s.autofixtures" % app)
        except Exception as e:
            warnings.warn(u'Error while importing %s.autofixtures: %r' %
                (app, e))

    for app, app_path in app_paths.items():
        try:
            file, _, _ = imp.find_module('tests', app_path)
        except ImportError:
            continue
        else:
            if file:
                file.close()

        try:
            importlib.import_module("%s.tests" % app)
        except Exception as e:
            warnings.warn(u'Error while importing %s.tests: %r' %
                (app, e))

    # autodiscover was successful, reset loading flag.
    LOADING = False
715315
public function is_included() {
		$queried_object = get_queried_object();

		if ( ! empty( $queried_object->taxonomy ) && $queried_object->taxonomy == $this->get_subtype() ) {
			return true;
		}

		return false;
	}
715266
function() {
			var self = this;
	
			self.loadedSearches = {};
			self.userOptions = {};
			self.renderCache = {};
			self.options = self.sifter.items = {};
			self.lastQuery = null;
			self.trigger('option_clear');
			self.clear();
		}
719729
protected function processInstall()
    {
        if (!$this->isError()) {

            $settings = $this->getSubmitted();
            $this->install->connectDb($settings['database']);
            $result = $this->install->process($settings, $this->current_route);

            if ($result['severity'] === 'success') {
                $this->line($result['message']);
            } else {
                $this->error($result['message']);
            }
        }
    }
1016161
def hooks(self, project):
        

        return self.get_queryset().filter(
            Q(project=None) |
            Q(project=project)
        ).distinct('url')
625124
public void removeIt()
    {
        if (m_queryRecord != null)
            if (this.getOwner() != null)
                m_queryRecord.removeRecord(this.getOwner());
        m_queryRecord = null;
    }
827854
def _pretend_to_run(self, migration, method):
        
        self._note("")
        names = []
        for query in self._get_queries(migration, method):
            name = migration.__class__.__name__
            bindings = None

            if isinstance(query, tuple):
                query, bindings = query

            query = highlight(query, SqlLexer(), CommandFormatter()).strip()

            if bindings:
                query = (query, bindings)

            if name not in names:
                self._note("[<info>{}</info>]".format(name))
                names.append(name)

            self._note(query)
88623
def autodiscover(site=None):
    
    # Bail out if autodiscover didn't finish loading from a previous call so
    # that we avoid running autodiscover again when the URLconf is loaded by
    # the exception handler to resolve the handler500 view.  This prevents an
    # admin.py module with errors from re-registering models and raising a
    # spurious AlreadyRegistered exception (see #8245).
    global LOADING
    if LOADING:
        return
    LOADING = True

    if site:
        orig_site = globals()['site']
        globals()['site'] = locals()['site']

    import imp
    from django.utils.importlib import import_module
    from django.conf import settings

    for app in settings.INSTALLED_APPS:
        # For each app, we need to look for an api.py inside that app's
        # package. We can't use os.path here -- recall that modules may be
        # imported different ways (think zip files) -- so we need to get
        # the app's __path__ and look for admin.py on that path.

        # Step 1: find out the app's __path__ Import errors here will (and
        # should) bubble up, but a missing __path__ (which is legal, but weird)
        # fails silently -- apps that do weird things with __path__ might
        # need to roll their own admin registration.
        try:
            app_path = import_module(app).__path__
        except (AttributeError, ImportError):
            continue

        # Step 2: use imp.find_module to find the app's admin.py. For some
        # reason imp.find_module raises ImportError if the app can't be found
        # but doesn't actually try to import the module. So skip this app if
        # its admin.py doesn't exist
        try:
            imp.find_module('nexus_modules', app_path)
        except ImportError:
            continue

        # Step 3: import the app's admin file. If this has errors we want them
        # to bubble up.
        import_module("%s.nexus_modules" % app)
    # # load builtins
    # from gargoyle.builtins import *

    if site:
        globals()['site'] = orig_site

    # autodiscover was successful, reset loading flag.
    LOADING = False
770233
public function afterRegistry()
    {
        parent::afterRegistry();

        $this->saveLabel = $this->_('Insert survey');
        $this->tracker   = $this->loader->getTracker();
    }
1004784
def as_view(cls, **initkwargs):
        
        if isinstance(getattr(cls, 'queryset', None), models.query.QuerySet):
            def force_evaluation():
                raise RuntimeError(
                    'Do not evaluate the `.queryset` attribute directly, '
                    'as the result will be cached and reused between requests. '
                    'Use `.all()` or call `.get_queryset()` instead.'
                )
            cls.queryset._fetch_all = force_evaluation
            cls.queryset._result_iter = force_evaluation  # Django <= 1.5

        view = super(RestView, cls).as_view(**initkwargs)
        view.cls = cls

        # Note: session based authentication is explicitly CSRF validated,
        # all other authentication is CSRF exempt.
        return csrf_exempt(view)
948
def post_setup_plugins(parser_result):
    
    if not isinstance(parser_result, dict):
        parser_result = vars(parser_result)
    plugins.run_post_inits(parser_result)
1318799
def autodiscover():
    
    import os
    import sys
    import copy
    from django.utils.module_loading import module_has_submodule
    from modeltranslation.translator import translator
    from modeltranslation.settings import TRANSLATION_FILES, DEBUG

    from importlib import import_module
    from django.apps import apps
    mods = [(app_config.name, app_config.module) for app_config in apps.get_app_configs()]

    for (app, mod) in mods:
        # Attempt to import the app's translation module.
        module = '%s.translation' % app
        before_import_registry = copy.copy(translator._registry)
        try:
            import_module(module)
        except:
            # Reset the model registry to the state before the last import as
            # this import will have to reoccur on the next request and this
            # could raise NotRegistered and AlreadyRegistered exceptions
            translator._registry = before_import_registry

            # Decide whether to bubble up this error. If the app just
            # doesn't have an translation module, we can ignore the error
            # attempting to import it, otherwise we want it to bubble up.
            if module_has_submodule(mod, 'translation'):
                raise

    for module in TRANSLATION_FILES:
        import_module(module)

    # In debug mode, print a list of registered models and pid to stdout.
    # Note: Differing model order is fine, we don't rely on a particular
    # order, as far as base classes are registered before subclasses.
    if DEBUG:
        try:
            if sys.argv[1] in ('runserver', 'runserver_plus'):
                models = translator.get_registered_models()
                names = ', '.join(m.__name__ for m in models)
                print('modeltranslation: Registered %d models for translation'
                      ' (%s) [pid: %d].' % (len(models), names, os.getpid()))
        except IndexError:
            pass
461541
def extract_queries(self, args, kwargs):
        '''
            
        '''
        return super(POSTGRESExtPillar, self).extract_queries(args, kwargs)
876985
public static void checkQuery(Query<?> query, Set<String> whitelist,
                                  Set<String> blacklist, InjectionManager manager) {
        ResourceInfo resource = manager.getInstance(ResourceInfo.class);
        Class<?> rc = resource.getResourceClass();
        Set<String> wl = null, bl = null;
        if (rc != null) {
            Filter filter = rc.getAnnotation(Filter.class);

            if (filter != null) {
                if (filter.whitelist().length > 0) {
                    wl = Sets.newLinkedHashSet();
                    Collections.addAll(wl, filter.whitelist());
                }
                if (filter.blacklist().length > 0) {
                    bl = Sets.newLinkedHashSet();
                    Collections.addAll(bl, filter.blacklist());
                }
            }
        }

        if (whitelist != null) {
            if (wl == null) {
                wl = Sets.newLinkedHashSet();
            }
            wl.addAll(whitelist);
        }

        if (blacklist != null) {
            if (bl == null) {
                bl = Sets.newLinkedHashSet();
            }
            bl.addAll(blacklist);
        }
        checkQuery((SpiQuery) query, wl, bl, manager.getInstance(Application.Mode.class).isProd());
    }
456000
def install():
        

        @monkeypatch_method(BaseDatabaseWrapper)
        def cursor(original, self, *args, **kwargs):
            result = original(*args, **kwargs)
            return _DetailedTracingCursorWrapper(result, self)

        logger.debug("Monkey patched SQL")