text:
(function(/*! Brunch !*/) {
  'use strict';

  var globals = typeof window !== 'undefined' ? window : global;
  if (typeof globals.require === 'function') return;

  var modules = {};
  var cache = {};

  var has = function(object, name) {
    return ({}).hasOwnProperty.call(object, name);
  };

  var expand = function(root, name) {
    var results = [], parts, part;
    if (/^\.\.?(\/|$)/.test(name)) {
      parts = [root, name].join('/').split('/');
    } else {
      parts = name.split('/');
    }
    for (var i = 0, length = parts.length; i < length; i++) {
      part = parts[i];
      if (part === '..') {
        results.pop();
      } else if (part !== '.' && part !== '') {
        results.push(part);
      }
    }
    return results.join('/');
  };

  var dirname = function(path) {
    return path.split('/').slice(0, -1).join('/');
  };

  var localRequire = function(path) {
    return function(name) {
      var dir = dirname(path);
      var absolute = expand(dir, name);
      return globals.require(absolute);
    };
  };

  var initModule = function(name, definition) {
    var module = {id: name, exports: {}};
    definition(module.exports, localRequire(name), module);
    var exports = cache[name] = module.exports;
    return exports;
  };

  var require = function(name) {
    var path = expand(name, '.');

    if (has(cache, path)) return cache[path];
    if (has(modules, path)) return initModule(path, modules[path]);

    var dirIndex = expand(path, './index');
    if (has(cache, dirIndex)) return cache[dirIndex];
    if (has(modules, dirIndex)) return initModule(dirIndex, modules[dirIndex]);

    throw new Error('Cannot find module "' + name + '"');
  };

  var define = function(bundle, fn) {
    if (typeof bundle === 'object') {
      for (var key in bundle) {
        if (has(bundle, key)) {
          modules[key] = bundle[key];
        }
      }
    } else {
      modules[bundle] = fn;
    }
  };

  globals.require = require;
  globals.require.define = define;
  globals.require.register = define;
  globals.require.brunch = true;
})();

window.require.register("initialize", function(exports, require, module) {
  var _ref, _ref1, _ref2, _ref3, _ref4;

  if ((_ref = this.CozyApp) == null) {
    this.CozyApp = {};
  }

  if ((_ref1 = CozyApp.Routers) == null) {
    CozyApp.Routers = {};
  }

  if ((_ref2 = CozyApp.Views) == null) {
    CozyApp.Views = {};
  }

  if ((_ref3 = CozyApp.Models) == null) {
    CozyApp.Models = {};
  }

  if ((_ref4 = CozyApp.Collections) == null) {
    CozyApp.Collections = {};
  }

  $(function() {
    var AppView;
    require('../lib/app_helpers');
    CozyApp.Views.appView = new (AppView = require('views/app_view'));
    CozyApp.Views.appView.render();
    return Backbone.history.start({
      pushState: true
    });
  });

});
window.require.register("lib/app_helpers", function(exports, require, module) {

  (function() {
    return (function() {
      var console, dummy, method, methods, _results;
      console = window.console = window.console || {};
      method = void 0;
      dummy = function() {};
      methods = 'assert,count,debug,dir,dirxml,error,exception,\
                   group,groupCollapsed,groupEnd,info,log,markTimeline,\
                   profile,profileEnd,time,timeEnd,trace,warn'.split(',');
      _results = [];
      while (method = methods.pop()) {
        _results.push(console[method] = console[method] || dummy);
      }
      return _results;
    })();
  })();

});
window.require.register("lib/view", function(exports, require, module) {
  var View,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  module.exports = View = (function(_super) {

    __extends(View, _super);

    function View() {
      View.__super__.constructor.apply(this, arguments);
    }

    View.prototype.tagName = 'section';

    View.prototype.template = function() {};

    View.prototype.initialize = function() {
      return this.render();
    };

    View.prototype.getRenderData = function() {
      var _ref;
      return {
        model: (_ref = this.model) != null ? _ref.toJSON() : void 0
      };
    };

    View.prototype.render = function() {
      this.beforeRender();
      this.$el.html(this.template({}));
      this.afterRender();
      return this;
    };

    View.prototype.beforeRender = function() {};

    View.prototype.afterRender = function() {};

    View.prototype.destroy = function() {
      this.undelegateEvents();
      this.$el.removeData().unbind();
      this.remove();
      return Backbone.View.prototype.remove.call(this);
    };

    return View;

  })(Backbone.View);

});
window.require.register("lib/view_collection", function(exports, require, module) {
  var View, ViewCollection, methods,
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  View = require('./view');

  ViewCollection = (function(_super) {

    __extends(ViewCollection, _super);

    function ViewCollection() {
      this.renderAll = __bind(this.renderAll, this);
      this.renderOne = __bind(this.renderOne, this);
      ViewCollection.__super__.constructor.apply(this, arguments);
    }

    ViewCollection.prototype.collection = new Backbone.Collection();

    ViewCollection.prototype.view = new View();

    ViewCollection.prototype.views = [];

    ViewCollection.prototype.length = function() {
      return this.views.length;
    };

    ViewCollection.prototype.add = function(views, options) {
      var view, _i, _len;
      if (options == null) {
        options = {};
      }
      views = _.isArray(views) ? views.slice() : [views];
      for (_i = 0, _len = views.length; _i < _len; _i++) {
        view = views[_i];
        if (!this.get(view.cid)) {
          this.views.push(view);
          if (!options.silent) {
            this.trigger('add', view, this);
          }
        }
      }
      return this;
    };

    ViewCollection.prototype.get = function(cid) {
      return this.find(function(view) {
        return view.cid === cid;
      }) || null;
    };

    ViewCollection.prototype.remove = function(views, options) {
      var view, _i, _len;
      if (options == null) {
        options = {};
      }
      views = _.isArray(views) ? views.slice() : [views];
      for (_i = 0, _len = views.length; _i < _len; _i++) {
        view = views[_i];
        this.destroy(view);
        if (!options.silent) {
          this.trigger('remove', view, this);
        }
      }
      return this;
    };

    ViewCollection.prototype.destroy = function(view, options) {
      var _views;
      if (view == null) {
        view = this;
      }
      if (options == null) {
        options = {};
      }
      _views = this.filter(_view)(function() {
        return view.cid !== _view.cid;
      });
      this.views = _views;
      view.undelegateEvents();
      view.$el.removeData().unbind();
      view.remove();
      Backbone.View.prototype.remove.call(view);
      if (!options.silent) {
        this.trigger('remove', view, this);
      }
      return this;
    };

    ViewCollection.prototype.reset = function(views, options) {
      var view, _i, _j, _len, _len1, _ref;
      if (options == null) {
        options = {};
      }
      views = _.isArray(views) ? views.slice() : [views];
      _ref = this.views;
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        view = _ref[_i];
        this.destroy(view, options);
      }
      if (views.length !== 0) {
        for (_j = 0, _len1 = views.length; _j < _len1; _j++) {
          view = views[_j];
          this.add(view, options);
        }
        if (!options.silent) {
          this.trigger('reset', view, this);
        }
      }
      return this;
    };

    ViewCollection.prototype.renderOne = function(model) {
      var view;
      view = new this.view(model);
      this.$el.append(view.render().el);
      this.add(view);
      return this;
    };

    ViewCollection.prototype.renderAll = function() {
      this.collection.each(this.renderOne);
      return this;
    };

    return ViewCollection;

  })(View);

  methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find', 'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex', 'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf', 'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy'];

  _.each(methods, function(method) {
    return ViewCollection.prototype[method] = function() {
      return _[method].apply(_, [this.views].concat(_.toArray(arguments)));
    };
  });

  module.exports = ViewCollection;

});
window.require.register("routers/app_router", function(exports, require, module) {
  var AppRouter,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  module.exports = AppRouter = (function(_super) {

    __extends(AppRouter, _super);

    function AppRouter() {
      AppRouter.__super__.constructor.apply(this, arguments);
    }

    AppRouter.prototype.routes = {
      '': function() {}
    };

    return AppRouter;

  })(Backbone.Router);

});
window.require.register("views/app_view", function(exports, require, module) {
  var AppRouter, AppView, View,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  View = require('../lib/view');

  AppRouter = require('../routers/app_router');

  module.exports = AppView = (function(_super) {

    __extends(AppView, _super);

    function AppView() {
      AppView.__super__.constructor.apply(this, arguments);
    }

    AppView.prototype.el = 'body.application';

    AppView.prototype.template = function() {
      return require('./templates/home');
    };

    AppView.prototype.initialize = function() {
      var url;
      this.router = CozyApp.Routers.AppRouter = new AppRouter();
      url = window.location.href.replace('http', 'ws');
      this.socket = new WebSocket(url, 'proto');
      this.socket.onopen = function() {
        return $('#test-socket').html('Test Socket Ready');
      };
      this.socket.onerror = function(err) {
        return console.log('Error', err);
      };
      return this.socket.onmessage = function(e) {
        return console.log('Server', e.data);
      };
    };

    AppView.prototype.events = {
      'click #test-socket': 'testSockets'
    };

    AppView.prototype.testSockets = function() {
      return this.socket.send("this is a test from the client");
    };

    return AppView;

  })(View);

});
window.require.register("views/templates/home", function(exports, require, module) {
  module.exports = function anonymous(locals, attrs, escape, rethrow, merge) {
  attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;
  var buf = [];
  with (locals || {}) {
  var interp;
  buf.push('

Cozy template

Welcome private side
Test Sockets
');
  }
  return buf.join("");
  };
});


text:
from __future__ import absolute_import

import responses
import six
import copy

from sentry.shared_integrations.exceptions import IntegrationError
from sentry.models import ExternalIssue
from sentry.utils.http import absolute_uri
from sentry.testutils.factories import DEFAULT_EVENT_DATA
from sentry.testutils.helpers.datetime import iso_format, before_now
from .testutils import GitLabTestCase

class GitlabIssuesTest(GitLabTestCase):
    def setUp(self):
        super(GitlabIssuesTest, self).setUp()
        min_ago = iso_format(before_now(minutes=1))
        event = self.store_event(
            data={
                "event_id": "a" * 32,
                "message": "message",
                "timestamp": min_ago,
                "stacktrace": copy.deepcopy(DEFAULT_EVENT_DATA["stacktrace"]),
            },
            project_id=self.project.id,
        )
        self.group = event.group

    def test_make_external_key(self):
        project_name = "getsentry/sentry"
        issue_iid = "7"
        external_key = "%s#%s" % (project_name, issue_iid)
        domain_name = self.installation.model.metadata["domain_name"]
        data = {"key": external_key}
        assert self.installation.make_external_key(data) == "%s:%s" % (domain_name, external_key)

    def test_get_issue_url(self):
        issue_id = "example.gitlab.com:project/project#7"
        assert (
            self.installation.get_issue_url(issue_id)
            == "https://example.gitlab.com/project/project/issues/7"
        )

    @responses.activate
    def test_get_create_issue_config(self):
        group_description = (
            u"Sentry Issue: [%s](%s)\n\n"
            "```\nStacktrace (most recent call first):\n\n"
            '  File "sentry/models/foo.py", line 29, in build_msg\n'
            "    string_max_length=self.string_max_length)\n\nmessage\n```"
        ) % (
            self.group.qualified_short_id,
            absolute_uri(self.group.get_absolute_url(params={"referrer": "gitlab_integration"})),
        )
        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/groups/%s/projects"
            % self.installation.model.metadata["group_id"],
            json=[
                {"name_with_namespace": "getsentry / sentry", "id": 1},
                {"name_with_namespace": "getsentry / hello", "id": 22},
            ],
        )
        assert self.installation.get_create_issue_config(self.group, self.user) == [
            {
                "url": "/extensions/gitlab/search/baz/%d/" % self.installation.model.id,
                "name": "project",
                "required": True,
                "type": "select",
                "label": "GitLab Project",
                "choices": [(1, u"getsentry / sentry"), (22, u"getsentry / hello")],
                "defaultValue": 1,
            },
            {
                "name": "title",
                "label": "Title",
                "default": self.group.get_latest_event().title,
                "type": "string",
                "required": True,
            },
            {
                "name": "description",
                "label": "Description",
                "default": group_description,
                "type": "textarea",
                "autosize": True,
                "maxRows": 10,
            },
        ]

    @responses.activate
    def test_get_link_issue_config(self):
        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/groups/%s/projects"
            % self.installation.model.metadata["group_id"],
            json=[
                {"name_with_namespace": "getsentry / sentry", "id": 1},
                {"name_with_namespace": "getsentry / hello", "id": 22},
            ],
        )
        autocomplete_url = "/extensions/gitlab/search/baz/%d/" % self.installation.model.id
        assert self.installation.get_link_issue_config(self.group) == [
            {
                "name": "project",
                "label": "GitLab Project",
                "type": "select",
                "default": 1,
                "choices": [(1, u"getsentry / sentry"), (22, u"getsentry / hello")],
                "url": autocomplete_url,
                "updatesForm": True,
                "required": True,
            },
            {
                "name": "externalIssue",
                "label": "Issue",
                "default": "",
                "type": "select",
                "url": autocomplete_url,
                "required": True,
            },
            {
                "name": "comment",
                "label": "Comment",
                "default": u"Sentry issue: [{issue_id}]({url})".format(
                    url=absolute_uri(
                        self.group.get_absolute_url(params={"referrer": "gitlab_integration"})
                    ),
                    issue_id=self.group.qualified_short_id,
                ),
                "type": "textarea",
                "required": False,
                "help": ("Leave blank if you don't want to " "add a comment to the GitLab issue."),
            },
        ]

    @responses.activate
    def test_create_issue(self):
        issue_iid = "1"
        project_id = "10"
        project_name = "getsentry/sentry"
        key = "%s#%s" % (project_name, issue_iid)
        responses.add(
            responses.POST,
            u"https://example.gitlab.com/api/v4/projects/%s/issues" % project_id,
            json={
                "id": 8,
                "iid": issue_iid,
                "title": "hello",
                "description": "This is the description",
                "web_url": "https://example.gitlab.com/%s/issues/%s" % (project_name, issue_iid),
            },
        )
        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/projects/%s" % project_id,
            json={"path_with_namespace": project_name, "id": 10},
        )
        form_data = {
            "project": project_id,
            "title": "hello",
            "description": "This is the description",
        }

        assert self.installation.create_issue(form_data) == {
            "key": key,
            "description": "This is the description",
            "title": "hello",
            "url": "https://example.gitlab.com/%s/issues/%s" % (project_name, issue_iid),
            "project": project_id,
            "metadata": {"display_name": key},
        }

    @responses.activate
    def test_get_issue(self):
        project_id = "12"
        project_name = "getsentry/sentry"
        issue_iid = "13"
        key = "%s#%s" % (project_name, issue_iid)
        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/projects/%s/issues/%s" % (project_id, issue_iid),
            json={
                "id": 18,
                "iid": issue_iid,
                "title": "hello",
                "description": "This is the description",
                "web_url": "https://example.gitlab.com/%s/issues/%s" % (project_name, issue_iid),
            },
        )
        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/projects/%s" % project_id,
            json={"id": project_id, "path_with_namespace": project_name},
        )

        assert self.installation.get_issue(issue_id="%s#%s" % (project_id, issue_iid), data={}) == {
            "key": key,
            "description": "This is the description",
            "title": "hello",
            "url": "https://example.gitlab.com/%s/issues/%s" % (project_name, issue_iid),
            "project": project_id,
            "metadata": {"display_name": key},
        }

    @responses.activate
    def test_create_issue_default_project_in_group_api_call(self):
        group_description = (
            u"Sentry Issue: [%s](%s)\n\n"
            "```\nStacktrace (most recent call first):\n\n"
            '  File "sentry/models/foo.py", line 29, in build_msg\n'
            "    string_max_length=self.string_max_length)\n\nmessage\n```"
        ) % (
            self.group.qualified_short_id,
            absolute_uri(self.group.get_absolute_url(params={"referrer": "gitlab_integration"})),
        )
        project_id = 10
        project_name = "This_is / a_project"
        org_integration = self.installation.org_integration
        org_integration.config["project_issue_defaults"] = {
            six.text_type(self.group.project_id): {"project": project_id}
        }
        org_integration.save()

        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/groups/%s/projects"
            % self.installation.model.metadata["group_id"],
            json=[
                {"name_with_namespace": "getsentry / sentry", "id": 1},
                {"name_with_namespace": project_name, "id": project_id},
                {"name_with_namespace": "getsentry / hello", "id": 22},
            ],
        )
        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/projects/%s" % project_id,
            json={"path_with_namespace": project_name, "id": project_id},
        )
        assert self.installation.get_create_issue_config(self.group, self.user) == [
            {
                "url": "/extensions/gitlab/search/baz/%d/" % self.installation.model.id,
                "name": "project",
                "required": True,
                "choices": [
                    (1, u"getsentry / sentry"),
                    (10, u"This_is / a_project"),
                    (22, u"getsentry / hello"),
                ],
                "defaultValue": project_id,
                "type": "select",
                "label": "GitLab Project",
            },
            {
                "name": "title",
                "label": "Title",
                "default": self.group.get_latest_event().title,
                "type": "string",
                "required": True,
            },
            {
                "name": "description",
                "label": "Description",
                "default": group_description,
                "type": "textarea",
                "autosize": True,
                "maxRows": 10,
            },
        ]

    @responses.activate
    def test_create_issue_default_project_not_in_api_call(self):
        group_description = (
            u"Sentry Issue: [%s](%s)\n\n"
            "```\nStacktrace (most recent call first):\n\n"
            '  File "sentry/models/foo.py", line 29, in build_msg\n'
            "    string_max_length=self.string_max_length)\n\nmessage\n```"
        ) % (
            self.group.qualified_short_id,
            absolute_uri(self.group.get_absolute_url(params={"referrer": "gitlab_integration"})),
        )
        project_id = 10
        project_name = "This_is / a_project"
        org_integration = self.installation.org_integration
        org_integration.config["project_issue_defaults"] = {
            six.text_type(self.group.project_id): {"project": project_id}
        }
        org_integration.save()

        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/groups/%s/projects"
            % self.installation.model.metadata["group_id"],
            json=[
                {"name_with_namespace": "getsentry / sentry", "id": 1},
                {"name_with_namespace": "getsentry / hello", "id": 22},
            ],
        )
        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/projects/%s" % project_id,
            json={"name_with_namespace": project_name, "id": project_id},
        )
        assert self.installation.get_create_issue_config(self.group, self.user) == [
            {
                "url": "/extensions/gitlab/search/baz/%d/" % self.installation.model.id,
                "name": "project",
                "required": True,
                "choices": [
                    (10, u"This_is / a_project"),
                    (1, u"getsentry / sentry"),
                    (22, u"getsentry / hello"),
                ],
                "defaultValue": project_id,
                "type": "select",
                "label": "GitLab Project",
            },
            {
                "name": "title",
                "label": "Title",
                "default": self.group.get_latest_event().title,
                "type": "string",
                "required": True,
            },
            {
                "name": "description",
                "label": "Description",
                "default": group_description,
                "type": "textarea",
                "autosize": True,
                "maxRows": 10,
            },
        ]

    @responses.activate
    def test_create_issue_no_projects(self):
        group_description = (
            u"Sentry Issue: [%s](%s)\n\n"
            "```\nStacktrace (most recent call first):\n\n"
            '  File "sentry/models/foo.py", line 29, in build_msg\n'
            "    string_max_length=self.string_max_length)\n\nmessage\n```"
        ) % (
            self.group.qualified_short_id,
            absolute_uri(self.group.get_absolute_url(params={"referrer": "gitlab_integration"})),
        )

        responses.add(
            responses.GET,
            u"https://example.gitlab.com/api/v4/groups/%s/projects"
            % self.installation.model.metadata["group_id"],
            json=[],
        )
        assert self.installation.get_create_issue_config(self.group, self.user) == [
            {
                "url": "/extensions/gitlab/search/baz/%d/" % self.installation.model.id,
                "name": "project",
                "required": True,
                "choices": [],
                "defaultValue": "",
                "type": "select",
                "label": "GitLab Project",
            },
            {
                "name": "title",
                "label": "Title",
                "default": self.group.get_latest_event().title,
                "type": "string",
                "required": True,
            },
            {
                "name": "description",
                "label": "Description",
                "default": group_description,
                "type": "textarea",
                "autosize": True,
                "maxRows": 10,
            },
        ]

    @responses.activate
    def test_after_link_issue(self):
        responses.add(
            responses.POST,
            u"https://example.gitlab.com/api/v4/projects/2/issues/321/notes",
            json=[],
        )
        data = {"externalIssue": "2#321", "comment": "This is not good."}
        external_issue = ExternalIssue.objects.create(
            organization_id=self.organization.id, integration_id=self.integration.id, key="2#321"
        )
        self.installation.after_link_issue(external_issue, data=data)

    def test_after_link_issue_required_fields(self):
        data = {"externalIssue": "2#231", "comment": "This is not good."}
        external_issue = ExternalIssue.objects.create(
            organization_id=self.organization.id, integration_id=self.integration.id, key="#"
        )
        with self.assertRaises(IntegrationError):
            self.installation.after_link_issue(external_issue, data=data)

    @responses.activate
    def test_after_link_issue_failure(self):
        responses.add(
            responses.POST,
            u"https://example.gitlab.com/api/v4/projects/2/issues/321/notes",
            status=502,
        )
        data = {"externalIssue": "2#321", "comment": "This is not good."}
        external_issue = ExternalIssue.objects.create(
            organization_id=self.organization.id, integration_id=self.integration.id, key="2#321"
        )
        with self.assertRaises(IntegrationError):
            self.installation.after_link_issue(external_issue, data=data)

redpajama_set_name: RedPajamaGithub


text:
<?php
return array (
  'As owner you cannot revoke your membership!' => 'Como proprietário, você não pode revogar a sua inscrição!',
  'Could not request membership!' => 'Não foi possível solicitar a inscrição!',
  'Sorry, you are not allowed to leave this space!' => 'Desculpe, você não tem permissão para deixar este espaço!',
  'There is no pending invite!' => 'Não existe convite pendente!',
  'This action is only available for workspace members!' => 'Esta ação está disponível apenas para os membros do workspace!',
  'You are not allowed to join this space!' => 'Você não tem permissão para se entrar neste espaço!',
);


text:
import { CSSModule } from '../index';

export interface ListGroupItemTextProps {
  tag?: React.ReactType;
  className?: string;
  cssModule?: CSSModule;
}

declare const ListGroupItemText: React.StatelessComponent<ListGroupItemTextProps>;
export default ListGroupItemText;


text:
package com.approachingpi.user;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.ListIterator;
import java.util.Hashtable;
import java.util.Enumeration;

public class Permission {
    private int id = 0;
    private String key = "";
    private String desc = "";

    public Permission() {
        init();
    }

    public Permission(int id, String key, String desc) {
        init();
        setId(id);
        setKey(key);
        setDesc(desc);
    }

    private void init() {
    }

    public int getId() { return this.id; }
    public String getDesc() { return this.desc; }
    public String getKey() { return this.key; }

    public void setId(int in) { this.id = in; }
    public void setDesc(String in) { this.desc = (in == null)?"":in; }
    public void setKey(String in) { this.key = (in == null)?"":in; }
}


text:
#ifndef _mchpGfxLCC_H
    #define _mchpGfxLCC_H

    #if defined(__PIC32MX__)
        #include <plib.h>
        #define PMDIN1  PMDIN
    #endif

    #include "GraphicsConfig.h"
    #include "GenericTypeDefs.h"

    #ifdef USE_PALETTE
        #include "Graphics/Palette.h"
    #endif

    #ifndef DISP_HOR_RESOLUTION
        #error DISP_HOR_RESOLUTION must be defined in HardwareProfile.h
    #endif
    #ifndef DISP_VER_RESOLUTION
        #error DISP_VER_RESOLUTION must be defined in HardwareProfile.h
    #endif
    #ifndef COLOR_DEPTH
        #error COLOR_DEPTH must be defined in HardwareProfile.h
    #endif
    #ifndef DISP_ORIENTATION
        #error DISP_ORIENTATION must be defined in HardwareProfile.h
    #endif

/*********************************************************************
* Overview: Horizontal synchronization timing in pixels
*                  (from the glass datasheet).
*********************************************************************/

    #ifndef DISP_HOR_PULSE_WIDTH
        #error DISP_HOR_PULSE_WIDTH must be defined in HardwareProfile.h
    #endif
    #ifndef DISP_HOR_BACK_PORCH
        #error DISP_HOR_BACK_PORCH must be defined in HardwareProfile.h
    #endif
    #ifndef DISP_HOR_FRONT_PORCH
        #error DISP_HOR_FRONT_PORCH must be defined in HardwareProfile.h
    #endif

/*********************************************************************
* Overview: Vertical synchronization timing in lines
*                  (from the glass datasheet).
*********************************************************************/
    #ifndef DISP_VER_PULSE_WIDTH
        #error DISP_VER_PULSE_WIDTH must be defined in HardwareProfile.h
    #endif
    #ifndef DISP_VER_BACK_PORCH
        #error DISP_VER_BACK_PORCH must be defined in HardwareProfile.h
    #endif
    #ifndef DISP_VER_FRONT_PORCH
        #error DISP_VER_FRONT_PORCH must be defined in HardwareProfile.h
    #endif

/*********************************************************************
* PARAMETERS VALIDATION
*********************************************************************/
    #if (DISP_HOR_RESOLUTION % 8) != 0
        #error Horizontal resolution must be divisible by 8.
    #endif
    #if (DISP_ORIENTATION != 0) && (DISP_ORIENTATION != 180) && (DISP_ORIENTATION != 90) && (DISP_ORIENTATION != 270)
        #error The display orientation selected is not supported. It can be only 0,90,180 or 270.
    #endif

/*Macros for timing signals*/
#define DATA_ENABLE      LATDbits.LATD2
#define DATA_ENABLE_TRIS TRISDbits.TRISD2
#define HSYNC            LATBbits.LATB8
#define HSYNC_TRIS       TRISBbits.TRISB8
#define VSYNC            LATCbits.LATC3
#define VSYNC_TRIS       TRISCbits.TRISC3

/*Macros for LCD IO*/
#define BACKLIGHT      LATDbits.LATD3
#define BACKLIGHT_TRIS TRISDbits.TRISD3
#define LCD_RESET      LATCbits.LATC1
#define LCD_RESET_TRIS TRISCbits.TRISC1
#define LCD_CS         LATCbits.LATC2
#define LCD_CS_TRIS    TRISCbits.TRISC2
#define LCD_DC         LATBbits.LATB3
#define LCD_DC_TRIS    TRISBbits.TRISB3

/*Macros for External SRAM*/
#define SRAM_CS       LATFbits.LATF13
#define SRAM_TRIS     TRISFbits.TRISF13

#define ADDR15        LATAbits.LATA15
#define ADDR15_TRIS   TRISAbits.TRISA15
#define ADDR16        LATDbits.LATD8
#define ADDR16_TRIS   TRISDbits.TRISD8
#define ADDR17        LATEbits.LATE9
#define ADDR17_TRIS   TRISEbits.TRISE9
#define ADDR18        LATFbits.LATF12
#define ADDR18_TRIS   TRISFbits.TRISF12

#define PIXELCLOCK        LATDbits.LATD5
#define PIXELCLOCK_TRIS   TRISDbits.TRISD5

/*These define the size (in resolution) of the LCD being used*/
#define LINE_LENGTH              DISP_HOR_RESOLUTION
#define FRAME_HEIGHT             DISP_VER_RESOLUTION

#if defined(__32MX460F512L__) || defined (__32MX360F512L__)
#define MAX_DMA_TRANSFER 254
#else
#define MAX_DMA_TRANSFER 65536
#endif

#if(MAX_DMA_TRANSFER < LINE_LENGTH)
#define LEGACY_MODE
#endif

/*This stabilizes the pixel refresh when drawing pixels*/
#ifdef LEGACY_MODE
#define PIXEL_DRAW_PER_DMA_TX          10
#else
#define PIXEL_DRAW_PER_DMA_TX          20
#endif

/*This defines the polarity of the pixel clock as defined in LCD specs*/
#ifdef DISP_INV_LSHIFT
#define PCLK_POLARITY PMP_READ_POL_LO
#else
#define PCLK_POLARITY PMP_READ_POL_HI
#endif

/*These define the size (in resolution) of the LCD being used*/
#define LINE_LENGTH              DISP_HOR_RESOLUTION
#define FRAME_HEIGHT             DISP_VER_RESOLUTION

#define VER_BLANK                 (DISP_VER_PULSE_WIDTH+DISP_VER_BACK_PORCH+DISP_VER_FRONT_PORCH)

#define  PMADDR_OVERFLOW               32768          /* Set for 2^15 because that is how many address lines are connected from the PIC32*/

#if defined (USE_PIP)
void SetPIPWindow(WORD left, WORD top, WORD hlength, WORD vlength, WORD pipx,WORD pipy);
#define PIP_BUFFER  (2)
#endif

#if defined (USE_LCC_SCROLLING)
extern WORD scroll,scrollLine,scrollPage;
#endif

#if defined (USE_DOUBLE_BUFFERING)

typedef struct
{
    WORD X;
    WORD Y;
    WORD W;
    WORD H;
} RectangleArea;

    #define GFX_BUFFER1 (0)
    #define GFX_BUFFER2 (1)

    #define GFX_MAX_INVALIDATE_AREAS 5
#endif

#endif // _mchpGfxLCC_H


text:
package com.siyuan.muzei.ample.utils;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class ObjectSerializer {

	public static String serialize(Serializable obj) throws IOException {
		if (obj == null) return "";
		try {
			ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
			ObjectOutputStream objectStream = new ObjectOutputStream(byteArrayOutputStream);
			objectStream.writeObject(obj);
			objectStream.flush();
			objectStream.close();
			return encodeBytes(byteArrayOutputStream.toByteArray());
		} catch (Exception e) {
			throw new IOException("Serialization error: " + e.getMessage(), e);
		}
	}

	public static Object deserialize(String str) throws IOException {
		if (str == null || str.length() == 0) return null;
		try {
			ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(decodeBytes(str));
			ObjectInputStream objectStream = new ObjectInputStream(byteArrayInputStream);
			return objectStream.readObject();
		} catch (Exception e) {
			throw new IOException("Deserialization error: " + e.getMessage(), e);
		}
	}

	static String encodeBytes(byte[] bytes) {
		StringBuffer strBuf = new StringBuffer();

		for (int i = 0; i < bytes.length; i++) {
			strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a')));
			strBuf.append((char) (((bytes[i]) & 0xF) + ((int) 'a')));
		}

		return strBuf.toString();
	}

	static byte[] decodeBytes(String str) {
		byte[] bytes = new byte[str.length() / 2];
		for (int i = 0; i < str.length(); i+=2) {
			char c = str.charAt(i);
			bytes[i/2] = (byte) ((c - 'a') << 4);
			c = str.charAt(i+1);
			bytes[i/2] += (c - 'a');
		}
		return bytes;
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
    <type>org.netbeans.modules.apisupport.project</type>
    <configuration>
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
            <code-name-base>chrriis.dj.nativeswing.swtcore.cocoa.macosx.x86</code-name-base>
            <suite-component/>
            <module-dependencies>
                <dependency>
                    <code-name-base>chrriis.dj.nativeswing.swtimpl</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>1.0</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.util.lookup</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>8.11.1</specification-version>
                    </run-dependency>
                </dependency>
            </module-dependencies>
            <public-packages/>
            <class-path-extension>
                <runtime-relative-path>ext/swt-3.7.2-cocoa-macosx.jar</runtime-relative-path>
                <binary-origin>release/modules/ext/swt-3.7.2-cocoa-macosx.jar</binary-origin>
            </class-path-extension>
            <class-path-extension>
                <runtime-relative-path>ext/DJNativeSwing-SWTCore.jar</runtime-relative-path>
                <binary-origin>release/modules/ext/DJNativeSwing-SWTCore.jar</binary-origin>
            </class-path-extension>
        </data>
    </configuration>
</project>


text:
#import "SNRAlbumsScrollView.h"

#import "NSWindow+SNRAdditions.h"

static NSString* const kImageBackground = @"crosshatch-bg";
static NSString* const kImageBackgroundDisabled = @"crosshatch-bg-inactive";

#define kGridViewLeftGradientStartingColor [NSColor colorWithDeviceWhite:0.f alpha:0.1f]
#define kGridViewLeftGradientEndingColor [NSColor clearColor]
#define kGridViewLeftGradientLength 3.f

@interface SNRAlbumsClipView : NSClipView
@end

@implementation SNRAlbumsClipView

- (void)drawRect:(NSRect)dirtyRect
{
    NSImage *bg = [NSImage imageNamed:[self.window drawAsActive] ? kImageBackground : kImageBackgroundDisabled];
    NSColor *color = [NSColor colorWithPatternImage:bg];
    [color set];
    NSRectFill(dirtyRect);
    [[NSColor redColor] set];
    NSRect fillRect = NSMakeRect(0.f, dirtyRect.origin.y, kGridViewLeftGradientLength, dirtyRect.size.height);
    NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:kGridViewLeftGradientStartingColor endingColor:kGridViewLeftGradientEndingColor];
    [gradient drawInRect:fillRect angle:0];
}

@end

@implementation SNRAlbumsScrollView {
    SNRAlbumsClipView *_clipView;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    if ((self = [super initWithCoder:aDecoder])) {
        id docView = [self documentView];
        _clipView = [[SNRAlbumsClipView alloc] initWithFrame:
                     [[self contentView] frame]];
        [self setContentView:_clipView];
        [self setDocumentView:docView];
        [[self horizontalScroller] setControlSize:NSSmallControlSize];
    }
    return self;
}
@end


text:
package styx.data.db;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static styx.data.AssertUtils.assertException;

import org.junit.Test;

public class RowTest {

    @Test
    public void testConstructorSimple() {
        Row row = new Row(Path.of(), "", 1, null);
        Row row2 = new Row(Path.of(), "", 1, "");
        assertNotNull(row.parent());
        assertNotNull(row.key());
        assertNull(row.value());
        assertNull(row2.value());
    }

    @Test
    public void testConstructorComplex() {
        Row row = new Row(Path.of(), "", 0, "x");
        assertNotNull(row.parent());
        assertNotNull(row.key());
        assertNotNull(row.value());
    }

    @Test
    public void testConstructorInvalid() {
        assertException(NullPointerException.class, "Invalid row: parent must not be null.", () -> new Row(null, "", 1, null));
        assertException(NullPointerException.class, "Invalid row: key must not be null.", () -> new Row(Path.of(), null, 1, null));
        assertException(IllegalArgumentException.class, "Invalid row: suffix == 0 expected.", () -> new Row(Path.of(), "", 1, "x"));
        assertException(IllegalArgumentException.class, "Invalid row: suffix > 0 expected.", () -> new Row(Path.of(), "", 0, ""));
    }

    @Test
    public void testEncodeDecode() {
        assertEncodeDecode(new Row(Path.of(1,2,3), "key", 0, "value"), "123\tkey\t\tvalue");
        assertEncodeDecode(new Row(Path.of(1,2,3), "key", 456, null), "123\tkey\t456\t");
        assertEncodeDecode(new Row(Path.of(1,2,3), "key", 456, ""), "123\tkey\t456\t");
    }

    @Test
    public void testDecodeInvalid() {
        assertException(IllegalArgumentException.class, "Line does not match pattern for row: xxxx", () -> Row.decode("xxxx"));
    }

    private void assertEncodeDecode(Row row, String encoded) {
        assertEquals(encoded, row.encode());
        assertEquals(row.toString(), Row.decode(encoded).toString());
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <title>MJPG-streamer</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="style.css" type="text/css" />

MJPG-Streamer Demo Pages

a ressource friendly streaming application

        Home
        Static
        Stream
        Java
        Javascript
        VideoLAN
        Control

Version info:

v0.1 (Okt 22, 2007)

Runtime info:

-

      Avg- : - ms (- fps)

Javascript

Display the stream with javascript

Hints

This example shows the stream by using java script. It works with most browsers. To see a simple example click here.

© The MJPG-streamer team | Design by Andreas Viklund


text:
from bokeh.models import HoverTool
from bokeh.charts import Line, Scatter, vplot, hplot, show, output_file, defaults
import pandas as pd
from bokeh.sampledata.degrees import xyvalues

defaults.width = 500
defaults.height = 300

xyvalues = xyvalues[['Biology', 'Business', 'Computer Science', "Year"]]
xyvalues = pd.melt(xyvalues, id_vars=['Year'],
                   value_vars=['Biology', 'Business', 'Computer Science'],
                   value_name='Count', var_name='Degree')

TOOLS='box_zoom,box_select,hover,crosshair,resize,reset'
output_file("hover_span.html", title="line.py example")

vline = Line(xyvalues, y='Count', color='Degree', title="Lines VLine", ylabel='measures',
             tools=TOOLS)

hline = Line(xyvalues, y='Count', color='Degree', title="Lines HLine",
             ylabel='measures', tools=TOOLS)

int_vline = Line(xyvalues, y='Count', color='Degree', title="Lines VLine Interp",
                 ylabel='measures', tools=TOOLS)

int_hline = Line(xyvalues, y='Count', color='Degree', title="Lines HLine Interp",
                 ylabel='measures', tools=TOOLS)

scatter_point = Scatter(xyvalues, x='Year', y='Count', color='Degree',
                        title="Scatter mouse", ylabel='measures', legend=True,
                        tools=TOOLS)
scatter = Scatter(xyvalues, x='Year', y='Count', color='Degree',
                  title="Scatter V Line", ylabel='measures', legend=True, tools=TOOLS)

int_point_line = Line(xyvalues, x='Year', y='Count', color='Degree',
                      title="Lines Mouse Interp.", ylabel='measures', tools=TOOLS)

point_line = Line(xyvalues, x='Year', y='Count', color='Degree',
                  title="Lines Mouse", ylabel='measures', tools=TOOLS)

hhover = hline.select(dict(type=HoverTool))
hhover.mode = 'hline'
hhover.line_policy = 'next'

vhover = vline.select(dict(type=HoverTool))
vhover.mode = 'vline'
vhover.line_policy = 'nearest'

int_hhover = int_hline.select(dict(type=HoverTool))
int_hhover.mode = 'hline'
int_hhover.line_policy = 'interp'

int_vhover = int_vline.select(dict(type=HoverTool))
int_vhover.mode = 'vline'
int_vhover.line_policy = 'interp'

iphover = int_point_line.select(dict(type=HoverTool))
iphover.mode = 'mouse'
iphover.line_policy = 'interp'

tphover = point_line.select(dict(type=HoverTool))
tphover.mode = 'mouse'

shover = scatter.select(dict(type=HoverTool))
shover.mode = 'vline'

shoverp = scatter_point.select(dict(type=HoverTool))
shoverp.mode = 'mouse'

TOOLTIPS = [
    ("y", "$~y"),
    ("x", "$~x"),
]

int_vhover.tooltips = int_hhover.tooltips = TOOLTIPS
tphover.tooltips = iphover.tooltips = TOOLTIPS
shover.tooltips = shoverp.tooltips = TOOLTIPS
vhover.tooltips = hhover.tooltips = TOOLTIPS

show(
    vplot(
        hplot(hline, vline),
        hplot(int_hline, int_vline),
        hplot(int_point_line, point_line),
        hplot(scatter_point, scatter),
    )
)


text:
class Browser;

// Implementation of ContentSettingBubbleModelDelegate which uses an instance of
// Browser in order to fulfil its duties.
class BrowserContentSettingBubbleModelDelegate
    : public ContentSettingBubbleModelDelegate {
 public:
  explicit BrowserContentSettingBubbleModelDelegate(Browser* browser);
  ~BrowserContentSettingBubbleModelDelegate() override;

  // ContentSettingBubbleModelDelegate implementation:
  void ShowCollectedCookiesDialog(content::WebContents* web_contents) override;
  void ShowContentSettingsPage(ContentSettingsType type) override;
  void ShowMediaSettingsPage() override;
  void ShowLearnMorePage(ContentSettingsType type) override;

 private:
  Browser* browser_;

  DISALLOW_COPY_AND_ASSIGN(BrowserContentSettingBubbleModelDelegate);
};

#endif  // CHROME_BROWSER_UI_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_DELEGATE_H_


text:
// Boost.Geometry - gis-projections (based on PROJ4)

// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.

// This file was modified by Oracle on 2017, 2018.
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.

// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// This file is converted from PROJ4, http://trac.osgeo.org/proj
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Boost.Geometry by Barend Gehrels

// Last updated version of proj: 5.0.0

// Original copyright notice:

// Purpose:  Stub projection for geocentric.  The transformation isn't
//           really done here since this code is 2D.  The real transformation
//           is handled by pj_transform.c.
// Author:   Frank Warmerdam, warmerdam@pobox.com
// Copyright (c) 2002, Frank Warmerdam

// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#ifndef BOOST_GEOMETRY_PROJECTIONS_GEOCENT_HPP
#define BOOST_GEOMETRY_PROJECTIONS_GEOCENT_HPP

#include <boost/geometry/srs/projections/impl/base_static.hpp>
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
#include <boost/geometry/srs/projections/impl/projects.hpp>
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>

namespace boost { namespace geometry
{

namespace srs { namespace par4
{
    struct geocent {}; // Geocentric

}} //namespace srs::par4

namespace projections
{
    #ifndef DOXYGEN_NO_DETAIL
    namespace detail { namespace geocent
    {

            // template class, using CRTP to implement forward/inverse
            template <typename T, typename Parameters>
            struct base_geocent_other
                : public base_t_fi<base_geocent_other<T, Parameters>, T, Parameters>
            {
                inline base_geocent_other(const Parameters& par)
                    : base_t_fi<base_geocent_other<T, Parameters>, T, Parameters>(*this, par)
                {}

                // FORWARD(forward)
                // Project coordinates from geographic (lon, lat) to cartesian (x, y)
                inline void fwd(T& lp_lon, T& lp_lat, T& xy_x, T& xy_y) const
                {
                        xy_x = lp_lon;
                        xy_y = lp_lat;
                }

                // INVERSE(inverse)
                // Project coordinates from cartesian (x, y) to geographic (lon, lat)
                inline void inv(T& xy_x, T& xy_y, T& lp_lon, T& lp_lat) const
                {
                        lp_lat = xy_y;
                        lp_lon = xy_x;
                }

                static inline std::string get_name()
                {
                    return "geocent_other";
                }

            };

            // Geocentric
            template <typename Parameters>
            inline void setup_geocent(Parameters& par)
            {
                par.is_geocent = 1;
                par.x0 = 0.0;
                par.y0 = 0.0;
            }

    }} // namespace detail::geocent
    #endif // doxygen

    /*!
        \brief Geocentric projection
        \ingroup projections
        \tparam Geographic latlong point type
        \tparam Cartesian xy point type
        \tparam Parameters parameter type
        \par Example
        \image html ex_geocent.gif
    */
    template <typename T, typename Parameters>
    struct geocent_other : public detail::geocent::base_geocent_other<T, Parameters>
    {
        inline geocent_other(const Parameters& par) : detail::geocent::base_geocent_other<T, Parameters>(par)
        {
            detail::geocent::setup_geocent(this->m_par);
        }
    };

    #ifndef DOXYGEN_NO_DETAIL
    namespace detail
    {

        // Static projection
        BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::geocent, geocent_other, geocent_other)

        // Factory entry(s)
        template <typename T, typename Parameters>
        class geocent_entry : public detail::factory_entry<T, Parameters>
        {
            public :
                virtual base_v<T, Parameters>* create_new(const Parameters& par) const
                {
                    return new base_v_fi<geocent_other<T, Parameters>, T, Parameters>(par);
                }
        };

        template <typename T, typename Parameters>
        inline void geocent_init(detail::base_factory<T, Parameters>& factory)
        {
            factory.add_to_factory("geocent", new geocent_entry<T, Parameters>);
        }

    } // namespace detail
    #endif // doxygen

} // namespace projections

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_PROJECTIONS_GEOCENT_HPP


text:
import json
import logging
import requests

from tornado.options import options

from model import TextMessage

class IFTTT(object):
    def __init__(self, key):
        self.key = key
        self.logger = logging.getLogger("ifttt")

    def url(self, event):
        return 'https://maker.ifttt.com/trigger/{0}/with/key/{1}'.format(event, self.key)

    def event(self, event, value1="", value2="", value3=""):
        try:
            requests.post(url=self.url(event),
                          headers={"Content-Type": "application/json; charset=utf-8"},
                          data=json.dumps({
                              "value3": value3,
                              "value2": value2,
                              "value1": value1
                          })
            )
        except requests.exceptions.RequestException:
            self.logger.error("HTTP Request failed")

    def sms_callback(self, sms):
        self.event("sms_received", sms.number, sms.text, sms.time.strftime("%Y-%m-%d %H:%M:%S"))

def init_handles(gsm):
    gsm.add_sms_callback(TextMessage.save_sms)

    # ifttt
    if options.ifttt_key:
        ifttt = IFTTT(options.ifttt_key)
        gsm.add_sms_callback(ifttt.sms_callback)


text:
[![Build Status](https://travis-ci.org/antismap/micpyplayer.svg?branch=master)](https://travis-ci.org/antismap/micpyplayer)

# micpyplayer
Simple music player in python with ncurses and libvlc. This project is still in early stages.

## Installation

You need to install ncurses and libvlc.

### Fedora

Under Fedora, do

    sudo dnf install vlc python3-vlc vlc-devel ncurses-libs ncurses-devel

### Ubuntu

Under Ubuntu:

    sudo apt-get install libvlc-dev vlc

and the bindings with pip

    pip3 install python-vlc

## Usage
    ./micpyplayer.py <directory_path>
use the arrows to move up and down, right-arrow is for enter.

## Screenshots

![alt text](https://github.com/antismap/micpyplayer/blob/master/screenshots/screen1.jpg?raw=true)


text:
package org.apache.causeway.applib.services.publishing.spi;

import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.commons.having.HasEnabling;

/**
 * SPI to receive a summary of the number of entities that have changed as the
 * result of an interaction (action invocation or property edit).
 *
 *

 * One use case is for performance profiling: to determine the
 * "footprint" of an interaction, which will have a direct impact on
 * the response time of that interaction.
 *

 *
 *

 *     Only those entities that have publishing enabled (using
 *  * {@link DomainObject#entityChangePublishing()}) are included.
 *

 *
 * @since 2.0 {@index}
 */
public interface EntityChangesSubscriber extends HasEnabling {

    /**
     * Receives all changing entities (with publishing enabled using
     * {@link DomainObject#entityChangePublishing()}) as an instance of
     * {@link EntityChanges}.
     *
     *

     *     The callback is called at the end of the transaction, during the
     *     pre-commit phase.
     *

     */
    void onChanging(EntityChanges entityChanges);
}


text:
package org.ms2ms.data.ms;

import com.google.common.collect.Ordering;
import com.google.common.collect.SortedSetMultimap;
import com.google.common.collect.TreeMultimap;
import org.ms2ms.data.Binary;
import org.ms2ms.math.Histogram;
import org.ms2ms.utils.IOs;
import org.ms2ms.utils.Tools;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.*;

/** Representation of an individual component score in a composite scheme
 *
 * Created by yuw on 10/10/16.
 */
public class ScoreModel implements Binary
{
  public enum eType
  {
    exact("Exact"), open("Open"), all("ALL"), sim("Simulated"), y("y"), b("b"), bs("bootstrapped");

    private final String name;
    eType(String n) { this.name = n; }

    public String getName() { return name; }
  };

  private String                    mName;
  private EnumMap<eType, Histogram> mDecoys, mNorms, mBoth;
  private EnumMap<eType, Double>    mOffsets;
  private Double                    mBaseline,mCenter;
  private int                       mExactCounts=0, mOpenCounts=0,
                                    mFullTrypics=0, mPartialTryptics=0, mUncleaved0=0, mUncleaved1=0;
  private Integer                   mBootstrapSize=1000;
  private SortedSetMultimap<String, Double> mBootsrapped;

  public static float[] sTrypicity = {0f,0f,0f,0f,0.5f,1f,2f};

  // temp counts
  private int nPeaks=0;
  private double mCenterY=0d, mSigmaY=0d, mCenterB=0d, mSigmaB=0d, mNumHits=0;

  public ScoreModel() { super(); }
  public ScoreModel(String s) { super(); mName=s; }

  public Double getBaseline()      { return mBaseline; }
  public Double getCenter()        { return mCenter; }

  public Double getOffset(eType t) { return mOffsets.get(t); }
  public String getName() { return mName; }
  public Integer getBootstrapSize() { return mBootstrapSize; }

  public double getCenterY() { return mNumHits>0?mCenterY/mNumHits:0d; }
  public double getCenterB() { return mNumHits>0?mCenterB/mNumHits:0d; }
  public double getSigmaY( ) { return mNumHits>0 && mSigmaY>0?mSigmaY/mNumHits:1d; }
  public double getSigmaB( ) { return mNumHits>0 && mSigmaB>0?mSigmaB/mNumHits:1d; }

  public double getOffsetB() { return mCenterB / mSigmaB; }
  public double getOffsetY() { return mCenterY / mSigmaY; }

  public double toZvalY(double s) { return (s-mCenterY)/mSigmaY; }
  public double toZvalB(double s) { return (s-mCenterB)/mSigmaB; }

  public ScoreModel increCenterY(double s) { mCenterY+=s; return this; }
  public ScoreModel increCenterB(double s) { mCenterB+=s; return this; }
  public ScoreModel increSigmaY( double s) { mSigmaY +=s; return this; }
  public ScoreModel increSigmaB( double s) { mSigmaB +=s; return this; }

  public ScoreModel increHitCounts(boolean s) { if (s) mExactCounts++; else mOpenCounts++; return this; }
  public ScoreModel increTryptics( int s) { if (s==2) mFullTrypics++; else if (s==1) mPartialTryptics++; return this; }
  public ScoreModel increUncleaved(int     s) { if (s==0) mUncleaved0++; else mUncleaved1++; return this; }

  public double getTrypticFactor()   { return (mFullTrypics!=0 && mPartialTryptics!=0)?10d*Math.log10(mPartialTryptics/mFullTrypics):0; }
  public double getOpenMatchFactor() { return (mOpenCounts !=0 && mExactCounts    !=0)?10d*Math.log10(mOpenCounts/mExactCounts):0; }

  public int size(boolean decoy, eType t)
  {
    if ( decoy && mDecoys!=null && mDecoys.get(t)!=null && mDecoys.get(t).getData()!=null) return mDecoys.get(t).getData().size();
    if (!decoy && mNorms !=null &&  mNorms.get(t)!=null &&  mNorms.get(t).getData()!=null) return  mNorms.get(t).getData().size();
    return 0;
  }

  public Histogram get(Boolean decoy, eType t)
  {
    if (decoy==null &&          mBoth  !=null) return   mBoth.get(t);
    if (decoy!=null && decoy && mDecoys!=null) return mDecoys.get(t);
    if (decoy!=null &&!decoy && mNorms !=null) return  mNorms.get(t);
    return null;
  }
  public ScoreModel setCenter(double s) { mCenter=s; return this; }
  public ScoreModel setOffset(eType t, double s)
  {
    if (mOffsets==null) mOffsets = new EnumMap<>(eType.class);
    mOffsets.put(t, s);
    return this;
  }
  public void clear(eType... types)
  {
    if (Tools.isSet(types))
      for (eType t : types)
      {
        if (mDecoys!=null && mDecoys.get(t)!=null) mDecoys.get(t).clear();
        if (mNorms !=null && mNorms.get( t)!=null) mNorms.get( t).clear();
      }

    mExactCounts=mOpenCounts=mFullTrypics=mPartialTryptics=mUncleaved0=mUncleaved1=0;
  }
  public ScoreModel add(Histogram hist, Boolean decoy, eType t)
  {
    if (decoy==null)
    {
      if (mBoth==null) mBoth = new EnumMap<>(eType.class);
      mBoth.put(t, hist);
    }
    else
    {
      if      ( decoy && mDecoys==null) mDecoys = new EnumMap<>(eType.class);
      else if (!decoy && mNorms ==null) mNorms  = new EnumMap<>(eType.class);

      if (decoy) mDecoys.put(t, hist); else mNorms.put(t, hist);
    }
    return this;
  }
  public ScoreModel add(boolean decoy, eType t, double s, boolean distinct)
  {
    if      ( decoy && mDecoys==null) mDecoys = new EnumMap<>(eType.class);
    else if (!decoy && mNorms ==null) mNorms  = new EnumMap<>(eType.class);

    if      ( decoy && mDecoys.get(t)==null) mDecoys.put(t, new Histogram("decoy_"+t.toString()));
    else if (!decoy &&  mNorms.get(t)==null)  mNorms.put(t, new Histogram( "norm_"+t.toString()));

    if (decoy) mDecoys.get(t).add(s, distinct); else mNorms.get(t).add(s, distinct);

    return this;
  }

  public ScoreModel fitEval(int samples)
  {
    // prepare for the e-val calculation
    if (mDecoys!=null && mDecoys.get(eType.bs)!=null) mDecoys.get(eType.bs).fitEval(samples,2,0.95, false);
    if (mNorms !=null &&  mNorms.get(eType.bs)!=null)  mNorms.get(eType.bs).fitEval(samples,2,0.95, false);
    if (mBoth  !=null &&   mBoth.get(eType.bs)!=null)   mBoth.get(eType.bs).fitEval(samples*2,3, 0.95, false);

    return this;
  }
  // if y or b is absence, we'll allow it to extend up to 'extension' as in the algorithm itself
  public ScoreModel bootstrapping(int samples, double jitter, double extension, double trypicity, float mid)
  {
    mBootstrapSize=samples;
    add(bootstrapping(samples, jitter, trypicity, true,  eType.y, eType.b, mid), true,  eType.bs);
    add(bootstrapping(samples, jitter, trypicity, false, eType.y, eType.b, mid), false, eType.bs);
    // now do the combined dist
    add(bootstrapping(samples, jitter, trypicity, null,  eType.y, eType.b, mid), null,  eType.bs);

    return this;
  }
  // simulate for the null distribution.
  // WYU 20190130. starting point (0 to 1) of the distribution to sample from
  public Histogram bootstrapping(int samples, double jitter, double trypicity, Boolean decoy, eType C, eType N, float mid)
  {
    List<Double> Nc=new ArrayList<>(), Cc=new ArrayList<>();

    if (decoy==null&& mDecoys!=null && mNorms!=null)
    {
      // want both types together
      if (mDecoys.get(N)!=null) Nc.addAll(mDecoys.get(N).getData());
      if (mDecoys.get(C)!=null) Cc.addAll(mDecoys.get(C).getData());

      if (mNorms.get(N)!=null) Nc.addAll(mNorms.get(N).getData());
      if (mNorms.get(C)!=null) Cc.addAll(mNorms.get(C).getData());
    }
    if ((decoy!=null &&  decoy) && mDecoys!=null)
    {
      if (mDecoys.get(N)!=null) Nc.addAll(mDecoys.get(N).getData());
      if (mDecoys.get(C)!=null) Cc.addAll(mDecoys.get(C).getData());
    }
    if ((decoy!=null && !decoy) && mNorms!=null)
    {
      if (mNorms.get(N)!=null) Nc.addAll(mNorms.get(N).getData());
      if (mNorms.get(C)!=null) Cc.addAll(mNorms.get(C).getData());
    }
    // must have at least a value in each type
    if (Nc.size()==0) Nc.add(0d);
    if (Cc.size()==0) Cc.add(0d);

    // sort the scores
    Collections.sort(Nc); Collections.sort(Cc);

    // boot strap for the combined distribution
    Histogram combo = new Histogram("Bootstrapping estimation of the score distribution: "+decoy+"/"+N+"/"+C);
    Random      RND = new Random(System.nanoTime());
    int N0 = Math.round(mid * Nc.size()), C0 = Math.round(mid * Cc.size());
    for (int i=0; i<samples; i++)
    {
      double nt = Nc.get(N0+RND.nextInt(Nc.size()-N0)), ct = Cc.get(C0+RND.nextInt(Cc.size()-C0)),
            enz = sTrypicity[RND.nextInt(sTrypicity.length)]*trypicity;

      combo.add(nt+ct+RND.nextDouble()*jitter+enz);
    }
    combo.generate(25);
    Collections.sort(combo.getData(), Ordering.natural().reverse());
    Nc=(List )Tools.dispose(Nc);
    Cc=(List )Tools.dispose(Cc);

    return combo;
  }
  public ScoreModel addExactDecoy(double s) { return add(s, eType.exact); }
  public ScoreModel addOpenDecoy( double s) { return add(s, eType.open); }

  public ScoreModel add(double s, eType t)
  {
    if (mDecoys==null) mDecoys = new EnumMap<>(eType.class);
    if (mDecoys.get(t)==null) mDecoys.put(t, new Histogram(t.getName()));

    mDecoys.get(t).add(s);
    return this;
  }

  public void generate(eType... types)
  {
    if (mDecoys!=null && Tools.isSet(types))
      for (eType type : types)
      {
        Histogram H = mDecoys.get(type);
        if (H!=null) H=H.generate2pts(15, 0.5);
        if (H!=null) H=H.assessTruncated(0);
      }
  }
  public void generate(int steps, eType... types)
  {
    if (mDecoys!=null && Tools.isSet(types))
      for (eType type : types)
      {
        Histogram H = mDecoys.get(type);
        if (H!=null) H=H.generate(steps);
      }
  }
  public double score(double s, eType type)
  {
    return s-getOffset(type);
  }
  public ScoreModel model(eType main, eType open)
  {
    if (mDecoys!=null &&
        mDecoys.get(main)!=null && mDecoys.get(main).getData()!=null && mDecoys.get(main).getData().size()>1 &&
        mDecoys.get(open)!=null && mDecoys.get(open).getData()!=null && mDecoys.get(open).getData().size()>1)
    {
      setOffset(main, 0d).setOffset(open, 0d);
      setOffset(eType.open, 10d * Math.log10((double )mDecoys.get(open).getData().size()/(double )mDecoys.get(main).getData().size()));
    }
    else
    {
      setOffset(eType.open, 10d * Math.log10(getOffset(open)/Math.max(0.5, getOffset(main))));
      setOffset(main, 0d);
    }

    return this;
  }

  public StringBuffer toWiki(StringBuffer buf)
  {
    if (buf==null) buf = new StringBuffer();

    buf.append(getName()+"\n");
    for (eType t : mDecoys.keySet())
    {
      buf.append(t.toString()+"\n");
      buf = mDecoys.get(t).wikiHistogram(buf, true);
    }

    return buf;
  }
  public void dispose_intermediates(EnumMap<eType, Histogram> data)
  {
    if (Tools.isSet(data))
      for (eType t : data.keySet()) if (!t.equals(eType.bs)) data.get(t).dispose_data();
  }
  public void dispose(EnumMap<eType, Histogram>... data)
  {
    if (Tools.isSet(data))
      for (EnumMap<eType, Histogram> d : data)
        if (d!=null)
          for (eType t : d.keySet())
            if (d.get(t)!=null) d.get(t).dispose();
  }
  public void retainTops(String tag, EnumMap<eType, Histogram> data, eType t, int tops)
  {
    if (Tools.isSet(data) && data.get(t)!=null && data.get(t).getData()!=null && data.get(t).getData().size()>=tops)
      mBootsrapped.putAll(tag, data.get(t).getData().subList(0, tops));
  }
  public void dispose_intermediates()
  {
    // copy the necessary data before disposing the histogram
    mBootsrapped = TreeMultimap.create(Ordering.natural(), Ordering.natural().reverse());

    retainTops("Decoys", mDecoys, eType.bs, 25);
    retainTops("Norms",  mNorms,  eType.bs, 25);
    retainTops("Both",   mBoth,   eType.bs, 25);

    dispose(mDecoys, mNorms, mBoth);
  }
  public ScoreModel clone_intermediates(int tops)
  {
    ScoreModel cloned = new ScoreModel(getName());

    cloned.mBootsrapped = TreeMultimap.create(Ordering.natural(), Ordering.natural().reverse());

    cloned.retainTops("Decoys", mDecoys, eType.bs, tops);
    cloned.retainTops("Norms",  mNorms,  eType.bs, tops);
    cloned.retainTops("Both", mBoth, eType.bs, tops);

    return cloned;
  }

  @Override
  public void write(DataOutput ds) throws IOException
  {
    IOs.write(ds, mName);
    IOs.write(ds, mBaseline);
    IOs.write(ds, mCenter);
    IOs.write(ds, mBootstrapSize);
    IOs.writeStringDoubles(ds, mBootsrapped);

    write(ds, mDecoys);
    write(ds, mNorms);
    write(ds, mBoth);
    writeEnumDouble(ds, mOffsets);
  }

  @Override
  public void read(DataInput ds) throws IOException
  {
    mName          = IOs.read(ds, "");
    mBaseline      = IOs.read(ds, mBaseline);
    mCenter        = IOs.read(ds, 0d);
    mBootstrapSize = IOs.read(ds, 0);

    mBootsrapped   = (SortedSetMultimap )IOs.readStringDoubles(ds, TreeMultimap.create(Ordering.natural(), Ordering.natural().reverse()));

    mDecoys        = readEnumHistogram(ds);
    mNorms         = readEnumHistogram(ds);
    mBoth          = readEnumHistogram(ds);
    mOffsets       = readEnumDouble(   ds);
  }

  private void writeEnumDouble(DataOutput ds, EnumMap<eType, Double> data) throws IOException
  {
    IOs.write(ds, Tools.isSet(data) ? data.size() : 0);

    if (Tools.isSet(data))
      for (eType key : data.keySet())
      {
        IOs.write(ds, key.toString());
        IOs.write(ds, data.get(key));
      }
  }
  private EnumMap<eType, Double> readEnumDouble(DataInput ds) throws IOException
  {
    int n = IOs.read(ds, 0);
    if (n>0)
    {
      EnumMap<eType, Double> data = new EnumMap<>(eType.class);
      for (int i=0; i<n; i++)
        data.put(eType.valueOf(IOs.read(ds, "")), IOs.read(ds,0d));

      return data;
    }
    return null;
  }
  private <T extends Binary> void write(DataOutput ds, EnumMap<eType, T> data) throws IOException
  {
    IOs.write(ds, Tools.isSet(data) ? data.size() : 0);

    if (Tools.isSet(data))
      for (eType key : data.keySet())
      {
        IOs.write(ds, key.toString());
        IOs.write(ds, data.get(key));
      }
  }
  private EnumMap<eType, Histogram> readEnumHistogram(DataInput ds) throws IOException
  {
    int n = IOs.read(ds, 0);
    if (n>0)
    {
      EnumMap<eType, Histogram> data = new EnumMap<>(eType.class);
      for (int i=0; i<n; i++)
      {
        eType   key = eType.valueOf(IOs.read(ds, ""));
        Histogram H = new Histogram(); H.read(ds);
        data.put(key, H);
      }

      return data;
    }
    return null;
  }
}


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="molder">
        <note>
            Automatically created based on framefiles: ferment (45.5)
        </note>
        <roleset id="molder.01" name="crumble into dust" vncls="45.5">
            <roles>
                <role descr="cause, agent" n="0"></role>
                <role descr="patient, thing crumbled" n="1">
                    <vnrole vncls="45.5" vntheta="Patient"/>
                </role>
                <role descr="end state" n="2"></role>
            </roles>
            <example name="Intransitive" src="web usage" type="">
                <text>...talents and virtue will be admired by grateful posterity long after
                    this marble shall have moldered into dust.
                </text>
                <note/>
                <arg f="" n="1">this marble</arg>
                <rel f="">moldered</rel>
                <arg f="" n="2">into dust</arg>
            </example>

            <example name="Transitive" src="web usage" type="">
                <text>Humidity moldered the wallpaper.</text>
                <note/>
                <arg f="" n="0">Humidity</arg>
                <rel f="">moldered</rel>
                <arg f="" n="1">the wallpaper</arg>

            </example>
            <note>Edited by hwangd</note>
        </roleset>
    </predicate>
</frameset>


text:
package org.uberfire.ext.wires.bpmn.client.commands;

import java.util.List;

/**
 * Command to mutate Elements
 */
public interface Command {

    /**
     * Apply the command
     * @return
     */
    List<Result> apply();

    /**
     * Undo the changes the command made to the model
     * @return
     */
    List<Result> undo();

}


text:
import _ from 'lodash'
import React, {PureComponent} from 'react'
import {connect} from 'react-redux'

import config from '../../config'
import {scrollTop} from '../../utils'

import Empty from '../../components/empty'
import Paginator from '../../components/paginator'

import CategoryTable from './table'
import * as actions from './redux'

const defaultLimit = config.getAppConfig('limit')

class CategoryList extends PureComponent {
  constructor(props) {
    super(props)
    this.go = this.go.bind(this)
  }

  componentDidMount() {
    this.props.getCategoryList({
      params: {
        offset: 0,
        limit: defaultLimit + 1,
        category_type: this.props.type,
      },
    })
  }

  go(offset) {
    scrollTop()

    let actualLimit = defaultLimit
    let actualOffset = offset

    if (offset === 0) { // first page
      actualLimit += 1
    } else if (offset + defaultLimit >= this.props.meta.total_count) { // last page
      actualLimit += 1
      actualOffset -= 1
    } else {
      actualLimit += 2
      actualOffset -= 1
    }

    const newParams = {
      ...this.props.params,
      limit: actualLimit,
      offset: actualOffset,
    }

    this.props.getCategoryList({
      params: newParams,
    })
  }

  render() {
    const {
      objects,
      meta,
      category_status_dirty,
      category_priorities,

      changePriority,
      reloadCategoryList,
      updateCategoryStatus,
      type,
    } = this.props

    if (objects === null) return null

    if (_.result(objects, 'length') === 0) {
      return (
        <Empty />
      )
    }

    let offset = meta.offset
    if (meta.offset !== 0) {
      offset += 1
    }

    const hasPrev = (offset - defaultLimit >= 0)
    const hasNext = (offset + defaultLimit < meta.total_count)

    const newMeta = {
      ...meta,
      offset,
      limit: defaultLimit,
    }

    return (

        <CategoryTable
          type={type}
          category_status_dirty={category_status_dirty}
          priorities={category_priorities}
          items={objects}
          hasPrev={hasPrev}
          hasNext={hasNext}
          onChangePriority={changePriority}
          reloadCategoryList={reloadCategoryList}
          onUpdateCategoryStatus={updateCategoryStatus}
        />

          <Paginator
            {...newMeta}
            go={this.go}
          />

    )
  }
}

export default connect(
  state => ({
    ...state.category_list,
    category_priorities: state.category_priorities,
    category_status_dirty: state.category_status_dirty,
  }),
  actions
)(CategoryList)


text:
/*global define */
define(['lib/stapes'], function (Stapes) {
    'use strict';
    return Stapes.subclass(/** @lends USB.prototype */{

        /**
         * @class USB
         * @abstract
         */
        constructor: function () {
        },

        /**
         * Gets the list of available devices
         * @param {object} deviceInfo - Device info object
         * @param {number} deviceInfo.vid - Device vendor id
         * @param {number} deviceInfo.pid - Device product id
         * @param {function} [onSuccess] - Callback to call on success
         * @param {function} [onError] - Callback to call on error
         */
        getDevices: function (deviceInfo, onSuccess, onError) {
        },

        /**
         * Opens a connection to usb device
         * @param {Object} device - Device object
         * @param {function} [onSuccess] - Callback to call on success
         * @param {function} [onError] - Callback to call on error
         * @abstract
         */
        open: function (device, onSuccess, onError) {
        },

        /**
         * Close the current connection
         * @param {function} [onSuccess] - Callback to call on success
         * @abstract
         */
        close: function (onSuccess) {
        },

        /**
         * Read data from the usb device using control transfer
         * @param {object} request - Request object.
         * @param {function} [onSuccess] - Callback to call on success
         * @param {function} [onError] - Callback to call on error
         * @abstract
         */
        control_read: function (request, onSuccess, onError) {
        },

        /**
         * Writes data to the usb device using control transfer
         * @param {object} request - Request object.
         * @param {function} [onSuccess] - Callback to call if data was sent successfully
         * @param {function} [onError] - Callback to call on error
         * @abstract
         */
        control_write: function (request, onSuccess, onError) {
        }
    }, true);
});


text:
package org.apache.flink.table.planner.plan.nodes.calcite

import org.apache.flink.table.api.TableConfig
import org.apache.flink.table.catalog.{CatalogManager, FunctionCatalog}
import org.apache.flink.table.module.ModuleManager
import org.apache.flink.table.planner.calcite.{FlinkRelBuilder, FlinkTypeFactory, FlinkTypeSystem}
import org.apache.flink.table.planner.delegation.PlannerContext
import org.apache.flink.table.planner.plan.metadata.MockMetaTable
import org.apache.flink.table.planner.plan.stats.FlinkStatistic
import org.apache.flink.table.planner.plan.`trait`.FlinkRelDistributionTraitDef
import org.apache.flink.table.types.logical.LogicalType
import org.apache.flink.table.utils.CatalogManagerMocks

import org.apache.calcite.jdbc.CalciteSchema
import org.apache.calcite.plan.{Convention, ConventionTraitDef, RelOptCluster, RelTraitSet}
import org.apache.calcite.rel.hint.RelHint
import org.apache.calcite.rel.logical.LogicalTableScan
import org.apache.calcite.rel.RelCollationTraitDef
import org.apache.calcite.rex.RexBuilder
import org.apache.calcite.schema.SchemaPlus
import org.junit.Before

import java.util

/**
 * A base class for rel node test.
 * TODO refactor the metadata test to extract the common logic for all related tests.
 */
class RelNodeTestBase {
  val tableConfig = new TableConfig()
  val rootSchema: SchemaPlus = CalciteSchema.createRootSchema(true, false).plus()
  val catalogManager: CatalogManager = CatalogManagerMocks.createEmptyCatalogManager()
  val moduleManager = new ModuleManager

  val plannerContext: PlannerContext = new PlannerContext(
    tableConfig,
    new FunctionCatalog(tableConfig, catalogManager, moduleManager),
    catalogManager,
    CalciteSchema.from(rootSchema),
    util.Arrays.asList(
      ConventionTraitDef.INSTANCE,
      FlinkRelDistributionTraitDef.INSTANCE,
      RelCollationTraitDef.INSTANCE
      )
    )

  val typeFactory: FlinkTypeFactory = plannerContext.getTypeFactory
  var relBuilder: FlinkRelBuilder = _
  var rexBuilder: RexBuilder = _
  var cluster: RelOptCluster = _
  var logicalTraits: RelTraitSet = _

  @Before
  def setUp(): Unit = {
    relBuilder = plannerContext.createRelBuilder("default_catalog", "default_database")
    rexBuilder = relBuilder.getRexBuilder
    cluster = relBuilder.getCluster
    logicalTraits = cluster.traitSetOf(Convention.NONE)
  }

  /**
   * Build a [[LogicalTableScan]] based on a [[MockMetaTable]] using given field names and types.
    @param fieldNames String array
   * @param fieldTypes [[LogicalType]] array
   * @return a [[LogicalTableScan]]
   */
  def buildLogicalTableScan(
      fieldNames: Array[String],
      fieldTypes: Array[LogicalType]): LogicalTableScan = {
    val flinkTypeFactory = new FlinkTypeFactory(new FlinkTypeSystem)
    val rowType = flinkTypeFactory.buildRelNodeRowType(fieldNames, fieldTypes)
    val table = new MockMetaTable(rowType, FlinkStatistic.UNKNOWN)
    LogicalTableScan.create(cluster, table, new util.ArrayList[RelHint]())
  }
}


text:
package tests.restd;

import org.junit.Test;
import tests.ApiTestCase;

public class SkipModelOperationTest extends ApiTestCase {

    @Test
    public void testSkipFindOperationIfExists() {
        get("/restd/model3/1").assertStatusEquals(501);
    }

    @Test
    public void testSkipCreateOperationIfExists() {
        post("/restd/model3").assertStatusEquals(501);
    }

    @Test
    public void testSkipUpdateOperationIfExists() {
        patch("/restd/model3/1").assertStatusEquals(501);
    }

    @Test
    public void testSkipDeleteOperationIfExists() {
        delete("/restd/model3/1").assertStatusEquals(501);
    }

    @Test
    public void testSkipQueryOperationIfExists() {
        get("/restd/model3").assertStatusEquals(501);
    }
}


text:
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../driver.html">

<script>
(function(scope) {
var MoreRouting = scope.MoreRouting = scope.MoreRouting || {};
MoreRouting.HashDriver = HashDriver;

/**
 * TODO(nevir): Docs.
 */
function HashDriver() {
  MoreRouting.Driver.apply(this, arguments);
  this._bindEvents();
  this._read();
}
HashDriver.prototype = Object.create(MoreRouting.Driver.prototype);

// By default, we prefer hashbang; but you can prefix with any string you wish.
HashDriver.prototype.prefix = '!/';

HashDriver.prototype.urlForParts = function urlForParts(parts) {
  return '#' + MoreRouting.Driver.prototype.urlForParts.call(this, parts);
};

HashDriver.prototype.navigateToUrl = function navigateToUrl(url) {
  window.location.hash = url;
};

HashDriver.prototype._bindEvents = function _bindEvents() {
  window.addEventListener('hashchange', this._read.bind(this));
};

HashDriver.prototype._read = function _read() {
  this.setCurrentPath(window.location.hash.substr(1) || this.prefix);
};

})(window);
</script>


text:
[![Build Status](https://travis-ci.org/socialwifi/flask-jsonapi.svg?branch=master)](https://travis-ci.org/socialwifi/flask-jsonapi)
[![Documentation Status](https://readthedocs.org/projects/flask-jsonapi/badge/?version=latest)](http://flask-jsonapi.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/socialwifi/flask-jsonapi/badge.svg)](https://coveralls.io/github/socialwifi/flask-jsonapi)
[![Latest Version](https://img.shields.io/pypi/v/flask-jsonapi.svg)](https://pypi.python.org/pypi/flask-jsonapi/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/flask-jsonapi.svg)](https://pypi.python.org/pypi/flask-jsonapi/)
[![Wheel Status](https://img.shields.io/pypi/wheel/flask-jsonapi.svg)](https://pypi.python.org/pypi/flask-jsonapi/)
[![License](https://img.shields.io/pypi/l/flask-jsonapi.svg)](https://github.com/socialwifi/flask-jsonapi/blob/master/LICENSE)

JSONAPI 1.0 server implementation for Flask.

## Installation

This package requires at least python 3.5. To install run: `pip install flask-jsonapi`. You can install SQLAlchemy support
with: `pip install flask-jsonapi[sqlalchemy]`.

## Documentation

Full documentation is available at: https://flask-jsonapi.readthedocs.io/.

## Simple example

Let's create a working example of a minimal Flask application. It will expose a single resource `Article` as a REST
endpoint with fetch/create/update/delete operations. For persistence layer, it will use an in-memory SQLite database
with SQLAlchemy for storage.

### Configuration

```python
import flask
import sqlalchemy
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_jsonapi import Schema, fields

import flask_jsonapi
from flask_jsonapi.resource_repositories import sqlalchemy_repositories

db_engine = sqlalchemy.create_engine('sqlite:///')
session = scoped_session(sessionmaker(bind=db_engine))
Base = declarative_base()
Base.query = session.query_property()

class Article(Base):
    __tablename__ = 'articles'
    id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
    title = sqlalchemy.Column(sqlalchemy.String)

Base.metadata.create_all(db_engine)

class ArticleRepository(sqlalchemy_repositories.SqlAlchemyModelRepository):
    model = Article
    instance_name = 'articles'
    session = session

class ArticleSchema(Schema):
    id = fields.Int()
    title = fields.Str()

    class Meta:
        type_ = 'articles'
        strict = True

class ArticleRepositoryViewSet(flask_jsonapi.resource_repository_views.ResourceRepositoryViewSet):
    schema = ArticleSchema
    repository = ArticleRepository()

app = flask.Flask(__name__)
api = flask_jsonapi.Api(app)
api.repository(ArticleRepositoryViewSet(), 'articles', '/articles/')
app.run(host='127.0.0.1', port=5000)
```

### Usage

Create a new `Article` with title "First article":
```bash
curl -H 'Content-Type: application/vnd.api+json' \
    -H 'Accept: application/vnd.api+json' \
    http://localhost:5000/articles/ \
    --data '{"data": {"attributes": {"title": "First article"}, "type": "articles"}}' \
    2>/dev/null | python -m json.tool
```

Result:
```json
{
    "data": {
        "type": "articles",
        "id": 1,
        "attributes": {
            "title": "First article"
        }
    },
    "jsonapi": {
        "version": "1.0"
    }
}
```

Get the list of `Articles`:
```bash
curl -H 'Accept: application/vnd.api+json' \
    http://localhost:5000/articles/ \
    2>/dev/null | python -m json.tool
```

Result:
```json
{
    "data": [
        {
            "type": "articles",
            "id": 1,
            "attributes": {
                "title": "First article"
            }
        }
    ],
    "jsonapi": {
        "version": "1.0"
    },
    "meta": {
        "count": 1
    }
}
```

## Running tests

```bash
virtualenv -p python3.6 ~/flask-jsonapi-virtualenv
. ~/flask-jsonapi-virtualenv/bin/activate
pip install -r base_requirements.txt
pip install -U pytest==3.0.5
pytest
```

## Credits

Some parts of this project were written based on [Flask-REST-JSONAPI](https://github.com/miLibris/flask-rest-jsonapi).


text:
import React, { Component } from 'react'
import PropTypes from 'prop-types'

export default class FooterBar extends Component {
  static propTypes = {
    onToggleAll: PropTypes.func,
    onDeleteCompleted: PropTypes.func
  }
  handleToggleAll () {
    if (this.props.onToggleAll) {
      this.props.onToggleAll()
    }
  }
  handleDeleteCompleted () {
    if (this.props.onDeleteCompleted) {
      this.props.onDeleteCompleted()
    }
  }
  render () {
    return (
      <footer>
        <button onClick={this.handleToggleAll.bind(this)}>complete all</button>
        {/*<button onClick={}>show active</button>*/}
        <button onClick={this.handleDeleteCompleted.bind(this)}>delete completed</button>
      </footer>
    )
  }
}


text:
namespace spotify
{
namespace json
{

using ScaleBiasWrapper = noise::module::Wrapper<noise::module::ScaleBias>;

codec::object_t<ScaleBiasWrapper> default_codec_t<ScaleBiasWrapper>::codec()
    {
        auto codec = codec::object<ScaleBiasWrapper>();
        codec.required("type", codec::eq<std::string>("ScaleBias"));
        codec.required("SourceModule", codec::ignore_t<int>());
        codec.optional("Scale",
                       [](const ScaleBiasWrapper& mw) {return mw.module->GetScale(); },
                       [](ScaleBiasWrapper& mw, double scale) {mw.module->SetScale(scale); });
        codec.optional("Bias",
                       [](const ScaleBiasWrapper& mw) {return mw.module->GetBias(); },
                       [](ScaleBiasWrapper& mw, double bias) {mw.module->SetBias(bias); });
        return codec;
    }

}
}


text:
package fr.lab.bbox.bboxapirunner.Application;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Spinner;

import fr.lab.bbox.bboxapirunner.R;

/**
 * Created by dinh on 01/07/16.
 */
public class ApplicationFragment extends Fragment {

    private FragmentManager mFragmentManager;
    private FragmentTransaction mFragmentTransaction;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.frag_application, container, false);

        Spinner spinner = (Spinner) view.findViewById(R.id.spinner_app);
        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parent, View view,
                                       int position, long id) {
                String item = parent.getItemAtPosition(position).toString();

                switch (item.toString()) {
                    case "Get application info":
                        mFragmentManager = getFragmentManager();
                        mFragmentTransaction = mFragmentManager.beginTransaction();
                        mFragmentTransaction.addToBackStack(null);
                        mFragmentTransaction.replace(R.id.container_app_parameter, new ApplicationGetAppInfoFragment()).commit();
                        break;
                    case "Get application list":
                        mFragmentManager = getFragmentManager();
                        mFragmentTransaction = mFragmentManager.beginTransaction();
                        mFragmentTransaction.addToBackStack(null);
                        mFragmentTransaction.replace(R.id.container_app_parameter, new ApplicationGetAppListFragment()).commit();
                        break;
                    case "Get application icon":
                        mFragmentManager = getFragmentManager();
                        mFragmentTransaction = mFragmentManager.beginTransaction();
                        mFragmentTransaction.addToBackStack(null);
                        mFragmentTransaction.replace(R.id.container_app_parameter, new ApplicationGetAppIconFragment()).commit();
                        break;
                    case "Start application":
                        mFragmentManager = getFragmentManager();
                        mFragmentTransaction = mFragmentManager.beginTransaction();
                        mFragmentTransaction.addToBackStack(null);
                        mFragmentTransaction.replace(R.id.container_app_parameter, new ApplicationStartAppFragment()).commit();
                        break;
                    case "Stop application":
                        mFragmentManager = getFragmentManager();
                        mFragmentTransaction = mFragmentManager.beginTransaction();
                        mFragmentTransaction.addToBackStack(null);
                        mFragmentTransaction.replace(R.id.container_app_parameter, new ApplicationStopAppFragment()).commit();
                        break;
                    case "Register (for notification)":
                        mFragmentManager = getFragmentManager();
                        mFragmentTransaction = mFragmentManager.beginTransaction();
                        mFragmentTransaction.addToBackStack(null);
                        mFragmentTransaction.replace(R.id.container_app_parameter, new ApplicationRegisterFragment()).commit();
                        break;
                    default:
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        return view;
    }

}