expose all the API methods on the main module using a default instance
325750
function mixin (target, source, options) {
        options = options || {};
        options.skip = options.skip || [];
        for (let key in source) {
            if (typeof source[key] === 'function' && key.indexOf('_') !== 0 && options.skip.indexOf(key) === -1) {
                target[key] = source[key].bind(source);
            }
        }
    }
1045377
def init_app(self, app, decorators=None):
        
        self.decorators = decorators or self.decorators
        self.app = app

        self.load_config(app)
        # self.load_apispec(app)
        if self.template_file is not None:
            self.template = self.load_swagger_file(self.template_file)
        self.register_views(app)
        self.add_headers(app)

        if self.parse:
            if RequestParser is None:
                raise RuntimeError('Please install flask_restful')
            self.parsers = {}
            self.schemas = {}
            self.format_checker = jsonschema.FormatChecker()
            self.parse_request(app)

        self._configured = True
        app.swag = self
746758
def _use_framework(module):
    
    import txaio
    for method_name in __all__:
        if method_name in ['use_twisted', 'use_asyncio']:
            continue
        setattr(txaio, method_name,
                getattr(module, method_name))
385544
def cleanroom
      exposed = exposed_methods.keys
      parent = self.name || 'Anonymous'

      Class.new(Object) do
        class << self
          def class_eval
            raise Cleanroom::InaccessibleError.new(:class_eval, self)
          end

          def instance_eval
            raise Cleanroom::InaccessibleError.new(:instance_eval, self)
          end
        end

        define_method(:initialize) do |instance|
          define_singleton_method(:__instance__) do
            unless caller[0].include?(__FILE__)
              raise Cleanroom::InaccessibleError.new(:__instance__, self)
            end

            instance
          end
        end

        exposed.each do |exposed_method|
          define_method(exposed_method) do |*args, &block|
            __instance__.public_send(exposed_method, *args, &block)
          end
        end

        define_method(:class_eval) do
          raise Cleanroom::InaccessibleError.new(:class_eval, self)
        end

        define_method(:inspect) do
          "#<#{parent} (Cleanroom)>"
        end
        alias_method :to_s, :inspect
      end
    end
861996
def main(argv=sys.argv):
    # type: (List[str]) -> int
    """"""
    parser = optparse.OptionParser(
        usage="""\
usage: %prog [options] -o <output_path> <module_path> [exclude_pattern, ...]

Look recursively in <module_path> for Python modules and packages and create
one reST file with automodule directives per package in the <output_path>.

The <exclude_pattern>s can be file and/or directory patterns that will be
excluded from generation.

Note: By default this script will not overwrite already created files.""")

    parser.add_option('-o', '--output-dir', action='store', dest='destdir',
                      help='Directory to place all output', default='api')
    parser.add_option('-s', '--source-dir', action='store', dest='srcdir',
                      help='Documentation source directory', default=BASEDIR)
    parser.add_option('-n', '--docname', action='store', dest='docname',
                      help='Index document name', default='api')
    parser.add_option('-l', '--follow-links', action='store_true',
                      dest='followlinks', default=False,
                      help='Follow symbolic links. Powerful when combined '
                      'with collective.recipe.omelette.')
    parser.add_option('-P', '--private', action='store_true',
                      dest='includeprivate',
                      help='Include "_private" modules')
    parser.add_option('--implicit-namespaces', action='store_true',
                      dest='implicit_namespaces',
                      help='Interpret module paths according to PEP-0420 '
                           'implicit namespaces specification')
    parser.add_option('--version', action='store_true', dest='show_version',
                      help='Show version information and exit')
    parser.add_option('--clean', action='store_true', dest='cleanup',
                      help='Clean up generated files and exit')
    group = parser.add_option_group('Extension options')
    for ext in EXTENSIONS:
        group.add_option('--ext-' + ext, action='store_true',
                         dest='ext_' + ext, default=False,
                         help='enable %s extension' % ext)

    (opts, args) = parser.parse_args(argv[1:])

    # Make this more explicitly the current directory.
    if not opts.srcdir:
        opts.srcdir = '.'

    if opts.show_version:
        print('Sphinx (sphinx-apidoc) %s' % __display_version__)
        return 0

    if opts.cleanup:
        print("Removing generated API docs from '{}'...".format(opts.srcdir))
        return cleanup_api_docs(opts)

    if not args:
        parser.error('A package path is required.')

    opts.rootpath, opts.excludes = args[0], args[1:]
    return generate_api_docs(opts)
1309839
def inspect
      keys = methods - Object.methods - Pipes::Context.instance_methods
      fields = keys.map { |key| "#{key}=#{public_send(key).inspect}" }
      fields << "@error=#{@error.inspect}"
      object_id_hex = '%x' % (object_id << 1)
      "#<Pipes::Context:0x00#{object_id_hex} #{fields.join(', ')}>"
    end
568560
def module_methods_in(klass)
      klass.included_modules.each_with_object([]) do |mod, accumulator|
        if mod.to_s =~ /#{klass}/
          mod.instance_methods(false).each do |method|
            accumulator << method
          end
        end
        accumulator
      end
    end
685761
function initAppHandlers (cfg = {}) {
	_.each(handlers, (handler, name) => App[name] = _.partial(handler, _, (_.isFunction(cfg[name])) ? cfg[name] : _.noop));
}
1061163
def acts_as_api
      class_eval do
        include ActsAsApi::Base::InstanceMethods
        extend ActsAsApi::Base::ClassMethods
      end

      if block_given?
        yield ActsAsApi::Config
      end
    end
944836
def main(global_config, **settings):
    """"""
    initialize_sentry_integration()
    config = Configurator(settings=settings)
    declare_api_routes(config)
    declare_type_info(config)

    # allowing the pyramid templates to render rss and xml
    config.include('pyramid_jinja2')
    config.add_jinja2_renderer('.rss')
    config.add_jinja2_renderer('.xml')

    mandatory_settings = ['exports-directories', 'exports-allowable-types']
    for setting in mandatory_settings:
        if not settings.get(setting, None):
            raise ValueError('Missing {} config setting.'.format(setting))

    config.scan(ignore='.tests')
    config.include('cnxarchive.events.main')

    config.add_tween('cnxarchive.tweens.conditional_http_tween_factory')

    return config.make_wsgi_app()
244528
def get_api(self):
        
        return {'class': type(self._object).__name__, 'methods': list(self._function_map.keys())}
1065104
def init():
    ''''''
    # Load values from config file
    config_file = os.path.realpath(os.path.join(os.getcwd(), 'swaggery.ini'))
    config = configparser.RawConfigParser(allow_no_value=True)
    config.read(config_file)
    log_level = config.get('application', 'logging_level').upper()
    api_dirs = list(config['apis'])
    do_checks = config.get('application',
                           'disable_boot_checks').lower() == 'false'
    # Set logging level
    log.setLevel(getattr(logging, log_level))
    log.debug('Log level set to {}'.format(log_level))
    # Bootstrap application
    log.debug('Exploring directories: {}'.format(api_dirs))
    application = Swaggery(api_dirs=api_dirs, do_checks=do_checks)
    return application
1058923
def bind(self, instance, auto=False):
        
        methods = [
            (m, cls.__dict__[m])
            for cls in inspect.getmro(type(instance))
            for m in cls.__dict__ if inspect.isfunction(cls.__dict__[m])
            ]

        try:
            deps_of_endpoints = [(method_ptr, self.entrypoint_deps(method_ptr))
                                 for (method_name, method_ptr) in methods]

            for (method_ptr, method_deps) in deps_of_endpoints:
                if len(method_deps) > 0:
                    method_ptr(instance, **method_deps)
        except KeyError:
            pass

        if auto and instance not in self.current_scope.get_auto_bind_list():
            self.current_scope.auto_bind(instance)

        return instance
1163437
def _create_api_method(cls, name, api_method):
    
    def _api_method(self, **kwargs):
        # lookup the command
        command = api_method['name']
        if kwargs:
            return self._make_request(command, kwargs)
        else:
            kwargs = {}
            return self._make_request(command, kwargs)
    _api_method.__doc__ = api_method['description']
    _api_method.__doc__ += _add_params_docstring(api_method['params'])
    _api_method.__name__ = str(name)
    setattr(cls, _api_method.__name__, _api_method)
1271329
def apply_module_defaults(args)
      args[:port] = args[:server].to_s.end_with?(JAMFCLOUD_DOMAIN) ? JAMFCLOUD_PORT : SSL_PORT if args[:no_port_specified]
      args[:timeout] ||= DFT_TIMEOUT
      args[:open_timeout] ||= DFT_OPEN_TIMEOUT
      args[:ssl_version] ||= DFT_SSL_VERSION
      args
    end
334884
def decorate_class_method(func, classkey=None, skipmain=False):
    
    #import utool as ut
    global __CLASSTYPE_ATTRIBUTES__
    assert classkey is not None, 'must specify classkey'
    #if not (skipmain and ut.get_caller_modname() == '__main__'):
    __CLASSTYPE_ATTRIBUTES__[classkey].append(func)
    return func
357444
def as_view(cls, view_type, *init_args, **init_kwargs):
        
        global _method

        new_cls = type(
            cls.__name__ + '_' + _BridgeMixin.__name__ + '_restless',
            (_BridgeMixin, cls._request_handler_base_,),
            dict(
                __resource_cls__=cls,
                __resource_args__=init_args,
                __resource_kwargs__=init_kwargs,
                __resource_view_type__=view_type)
        )

        """
        Add required http-methods to the newly created class
        We need to scan through MRO to find what functions users declared,
        and then add corresponding http-methods used by Tornado.
        """
        bases = inspect.getmro(cls)
        bases = bases[0:bases.index(Resource)-1]
        for k, v in cls.http_methods[view_type].items():
            if any(v in base_cls.__dict__ for base_cls in bases):
                setattr(new_cls, k.lower(), _method)

        return new_cls