From 18387bdc957110ba0f7586d24145aa1f09fb04d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Efeish?= Date: Mon, 10 Jun 2024 20:47:41 +0000 Subject: [PATCH] minor update --- .devcontainer/Dockerfile | 12 + .devcontainer/container.example.env | 2 + .devcontainer/devcontainer.json | 40 +++ .devcontainer/postcreate.sh | 15 + .github/workflows/actions.yml | 30 ++ docs/__pycache__.html | 219 +++++++++++++ docs/index.html | 231 ++++++++++++++ docs/modules.html | 225 +++++++++++++ docs/modules/create_issue.html | 478 ++++++++++++++++++++++++++++ docs/modules/notification.html | 355 +++++++++++++++++++++ docs/modules/template.html | 338 ++++++++++++++++++++ docs/search.js | 36 +++ docs2/index.html | 227 +++++++++++++ docs2/search.js | 36 +++ docs2/src.html | 219 +++++++++++++ src/WebhookEventServer.py | 0 16 files changed, 2463 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/container.example.env create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/postcreate.sh create mode 100644 .github/workflows/actions.yml create mode 100644 docs/__pycache__.html create mode 100644 docs/index.html create mode 100644 docs/modules.html create mode 100644 docs/modules/create_issue.html create mode 100644 docs/modules/notification.html create mode 100644 docs/modules/template.html create mode 100644 docs/search.js create mode 100644 docs2/index.html create mode 100644 docs2/search.js create mode 100644 docs2/src.html mode change 100644 => 100755 src/WebhookEventServer.py diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..853149c --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,12 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu/.devcontainer/base.Dockerfile + +# [Choice] Ubuntu version: bionic, focal +ARG VARIANT="focal" +FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} + +RUN apt-get update && apt-get upgrade --yes \ + && apt-get install curl git-lfs python3-pip awscli gnupg2 --yes \ + && curl -fsSL https://get.pulumi.com | bash \ + && mv ~/.pulumi/bin/* /usr/bin \ + && mkdir -p /root/.aws \ + && export EDITOR=/usr/bin/vi diff --git a/.devcontainer/container.example.env b/.devcontainer/container.example.env new file mode 100644 index 0000000..fc8d5a9 --- /dev/null +++ b/.devcontainer/container.example.env @@ -0,0 +1,2 @@ +export AWS_ACCESS_KEY_ID= +export AWS_SECRET_ACCESS_KEY= diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..9214874 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu +{ + "name": "Ubuntu", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick an Ubuntu version: focal, bionic + "args": { "VARIANT": "focal" } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python" + ], + + "mounts": [ + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/root/.aws,type=bind,consistency=cached" + ], + + /* + "remoteEnv": { + "AWS_ACCESS_KEY_ID": "${containerEnv:AWS_ACCESS_KEY_ID}Identity", + "AWS_SECRET_ACCESS_KEY": "${containerEnv:AWS_SECRET_ACCESS_KEY}Key" + }, + */ + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "/workspaces/Apple-ACI-AWSInfra/.devcontainer/postcreate.sh", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode" +} diff --git a/.devcontainer/postcreate.sh b/.devcontainer/postcreate.sh new file mode 100755 index 0000000..645f9e7 --- /dev/null +++ b/.devcontainer/postcreate.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +if [ -f '/workspaces/Apple-ACI-AWSInfra/.devcontainer/container.env' ]; then + echo "Adding container.env to /root/.bashrc" + echo "" >> /root/.bashrc + cat /workspaces/Apple-ACI-AWSInfra/.devcontainer/container.env >> /root/.bashrc +else + echo "container.env not found, ignoring" +fi + +pushd ghes-cluster + pip install -r requirements.txt +popd \ No newline at end of file diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..765a361 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,30 @@ +name: Python-docs-action +on: + push: + branches: + - master + +env: + VERSION: 1.0 + ENV: alpha + +jobs: + build-terraform-validate: + runs-on: ubuntu-latest + + steps: + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 #install the python needed + + - name: Install 'Pdoc' + run: pip3 install pdoc + + - name: Generate API Docs + run: pdoc --html + \ No newline at end of file diff --git a/docs/__pycache__.html b/docs/__pycache__.html new file mode 100644 index 0000000..a667b06 --- /dev/null +++ b/docs/__pycache__.html @@ -0,0 +1,219 @@ + + + + + + + __pycache__ API documentation + + + + + + + + +
+
+

+__pycache__

+ + + +
+
+ + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..0d6b38d --- /dev/null +++ b/docs/index.html @@ -0,0 +1,231 @@ + + + + + + + Module List – pdoc 8.0.0 + + + + + + + + + + +
+ + pdoc logo + + +
+
+
+ + \ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html new file mode 100644 index 0000000..62b0004 --- /dev/null +++ b/docs/modules.html @@ -0,0 +1,225 @@ + + + + + + + modules API documentation + + + + + + + + +
+
+

+modules

+ + + +
+
+ + \ No newline at end of file diff --git a/docs/modules/create_issue.html b/docs/modules/create_issue.html new file mode 100644 index 0000000..2ac0a6c --- /dev/null +++ b/docs/modules/create_issue.html @@ -0,0 +1,478 @@ + + + + + + + modules.create_issue API documentation + + + + + + + + +
+
+

+modules.create_issue

+ + +
+ View Source +
import json
+import requests
+
+global log
+
+
+# Required class name: 'command'
+class command():
+
+    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook action requires this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+    # Required name: 'execute'
+    # implementing a command pattern
+    def execute(self):
+        '''Create an issue on github.com using the given parameters.'''
+        global log
+        log.info("executing 'create_issue' module")
+
+        github_api_url = self.server_config['github_api']
+        repo_name = 'issue-repo'
+        repo_owner = self.server_config['organization']
+        repo_full_name = json.loads(self.payload)['repository']['full_name']
+        # GitHub API URL
+        url = '%s/repos/%s/%s/issues' % (github_api_url, repo_owner, repo_name)
+        headers = {'x-webhook-action': 'create_issue'}
+
+        # prepare issue payload
+        title = "Repository was removed"
+        body = "@jefeish The repository "+ repo_full_name +" was deleted"
+        assignees = ["jefeish"]
+        labels = ["bug"]
+        data = {
+                "title": title,
+                 "body": body,
+                 "assignees": assignees,
+                 "labels": labels
+            }
+
+        # create an issue in the repository
+        if 'proxies' in self.server_config:
+            log.debug(self.server_config['proxies'])
+            log.info("making the GitHub API call (with proxy)")
+            r = requests.post(url, proxies= self.server_config['proxies'], auth=(repo_owner, self.server_config['token']), data=json.dumps(data), headers=headers)
+        else:
+            log.debug("no proxies")
+            log.info("making the GitHub API call (without proxy)")
+            r = requests.post(url, auth=(repo_owner, self.server_config['token']), data=json.dumps(data), headers=headers)
+
+        if r.status_code == 201:
+            log.info("Created Issue '%s' in repository '%s'" % (title, repo_name))
+            log.debug("Response: %s" % r.content)
+        else:
+            log.error("Failed to create Issue: '%s'" % title)
+            log.error("Response: %s" % r.content)
+            log.error("Request Data: %s" % data)
+
+
+# For testing
+if __name__ == "__main__":
+
+    global log
+    server_config = {
+            'token': '...',
+            'github_api': 'https://api.github.com',
+            'owner': 'jefeish',
+            'organization': 'jchallenge1',
+        }
+
+    payload = '{"repository": {"full_name": "test"}}'
+
+    log = logging.getLogger(__name__)
+    hdlr = logging.StreamHandler()
+    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+    hdlr.setFormatter(formatter)
+    log.addHandler(hdlr)
+    log.setLevel(logging.DEBUG)
+    c = command(log, server_config, '', payload )
+    c.execute()
+
+ +
+ +
+
+
+ #   + + + class + command: +
+ +
+ View Source +
class command():
+
+    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook action requires this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+    # Required name: 'execute'
+    # implementing a command pattern
+    def execute(self):
+        '''Create an issue on github.com using the given parameters.'''
+        global log
+        log.info("executing 'create_issue' module")
+
+        github_api_url = self.server_config['github_api']
+        repo_name = 'issue-repo'
+        repo_owner = self.server_config['organization']
+        repo_full_name = json.loads(self.payload)['repository']['full_name']
+        # GitHub API URL
+        url = '%s/repos/%s/%s/issues' % (github_api_url, repo_owner, repo_name)
+        headers = {'x-webhook-action': 'create_issue'}
+
+        # prepare issue payload
+        title = "Repository was removed"
+        body = "@jefeish The repository "+ repo_full_name +" was deleted"
+        assignees = ["jefeish"]
+        labels = ["bug"]
+        data = {
+                "title": title,
+                 "body": body,
+                 "assignees": assignees,
+                 "labels": labels
+            }
+
+        # create an issue in the repository
+        if 'proxies' in self.server_config:
+            log.debug(self.server_config['proxies'])
+            log.info("making the GitHub API call (with proxy)")
+            r = requests.post(url, proxies= self.server_config['proxies'], auth=(repo_owner, self.server_config['token']), data=json.dumps(data), headers=headers)
+        else:
+            log.debug("no proxies")
+            log.info("making the GitHub API call (without proxy)")
+            r = requests.post(url, auth=(repo_owner, self.server_config['token']), data=json.dumps(data), headers=headers)
+
+        if r.status_code == 201:
+            log.info("Created Issue '%s' in repository '%s'" % (title, repo_name))
+            log.debug("Response: %s" % r.content)
+        else:
+            log.error("Failed to create Issue: '%s'" % title)
+            log.error("Response: %s" % r.content)
+            log.error("Request Data: %s" % data)
+
+ +
+ + + +
+
#   + + + command(logger, server_config, header, payload) +
+ +
+ View Source +
    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook action requires this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+ +
+ + + +
+
+
#   + + + def + execute(self): +
+ +
+ View Source +
    def execute(self):
+        '''Create an issue on github.com using the given parameters.'''
+        global log
+        log.info("executing 'create_issue' module")
+
+        github_api_url = self.server_config['github_api']
+        repo_name = 'issue-repo'
+        repo_owner = self.server_config['organization']
+        repo_full_name = json.loads(self.payload)['repository']['full_name']
+        # GitHub API URL
+        url = '%s/repos/%s/%s/issues' % (github_api_url, repo_owner, repo_name)
+        headers = {'x-webhook-action': 'create_issue'}
+
+        # prepare issue payload
+        title = "Repository was removed"
+        body = "@jefeish The repository "+ repo_full_name +" was deleted"
+        assignees = ["jefeish"]
+        labels = ["bug"]
+        data = {
+                "title": title,
+                 "body": body,
+                 "assignees": assignees,
+                 "labels": labels
+            }
+
+        # create an issue in the repository
+        if 'proxies' in self.server_config:
+            log.debug(self.server_config['proxies'])
+            log.info("making the GitHub API call (with proxy)")
+            r = requests.post(url, proxies= self.server_config['proxies'], auth=(repo_owner, self.server_config['token']), data=json.dumps(data), headers=headers)
+        else:
+            log.debug("no proxies")
+            log.info("making the GitHub API call (without proxy)")
+            r = requests.post(url, auth=(repo_owner, self.server_config['token']), data=json.dumps(data), headers=headers)
+
+        if r.status_code == 201:
+            log.info("Created Issue '%s' in repository '%s'" % (title, repo_name))
+            log.debug("Response: %s" % r.content)
+        else:
+            log.error("Failed to create Issue: '%s'" % title)
+            log.error("Response: %s" % r.content)
+            log.error("Request Data: %s" % data)
+
+ +
+ +

Create an issue on github.com using the given parameters.

+
+ + +
+
+
+ + \ No newline at end of file diff --git a/docs/modules/notification.html b/docs/modules/notification.html new file mode 100644 index 0000000..2539d02 --- /dev/null +++ b/docs/modules/notification.html @@ -0,0 +1,355 @@ + + + + + + + modules.notification API documentation + + + + + + + + +
+
+

+modules.notification

+ + +
+ View Source +
import json
+import requests
+
+global log
+
+# Required class name: 'command'
+class command():
+
+    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook action requires this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+    # Required name: 'execute'
+    # implementing a command pattern
+    def execute(self):
+        '''Create a notification on github.com using the given parameters.'''
+        global log
+        log.info("executing 'create_notification' module")
+
+        github_api_url = self.server_config['github_api']
+        headers = {'x-webhook-action': 'create_notification'}
+        
+        # TODO - implement some notification code...
+
+ +
+ +
+
+
+ #   + + + class + command: +
+ +
+ View Source +
class command():
+
+    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook action requires this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+    # Required name: 'execute'
+    # implementing a command pattern
+    def execute(self):
+        '''Create a notification on github.com using the given parameters.'''
+        global log
+        log.info("executing 'create_notification' module")
+
+        github_api_url = self.server_config['github_api']
+        headers = {'x-webhook-action': 'create_notification'}
+        
+        # TODO - implement some notification code...
+
+ +
+ + + +
+
#   + + + command(logger, server_config, header, payload) +
+ +
+ View Source +
    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook action requires this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+ +
+ + + +
+
+
#   + + + def + execute(self): +
+ +
+ View Source +
    def execute(self):
+        '''Create a notification on github.com using the given parameters.'''
+        global log
+        log.info("executing 'create_notification' module")
+
+        github_api_url = self.server_config['github_api']
+        headers = {'x-webhook-action': 'create_notification'}
+        
+        # TODO - implement some notification code...
+
+ +
+ +

Create a notification on github.com using the given parameters.

+
+ + +
+
+
+ + \ No newline at end of file diff --git a/docs/modules/template.html b/docs/modules/template.html new file mode 100644 index 0000000..bb9c09f --- /dev/null +++ b/docs/modules/template.html @@ -0,0 +1,338 @@ + + + + + + + modules.template API documentation + + + + + + + + +
+
+

+modules.template

+ + +
+ View Source +
import json
+import requests
+
+global log
+
+# implementing a command pattern
+
+# Required class name: 'command'
+class command():
+
+    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook actions might require this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+    # Required function name: 'execute'
+    def execute(self):
+        global log
+        # TODO: implement the service
+        # Your code goes here !
+
+ +
+ +
+
+
+ #   + + + class + command: +
+ +
+ View Source +
class command():
+
+    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook actions might require this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+    # Required function name: 'execute'
+    def execute(self):
+        global log
+        # TODO: implement the service
+        # Your code goes here !
+
+ +
+ + + +
+
#   + + + command(logger, server_config, header, payload) +
+ +
+ View Source +
    def __init__(self, logger, server_config, header, payload):
+        global log
+        # webhook actions might require this
+        self.server_config = server_config
+        self.header = header
+        self.payload = payload
+        log = logger
+
+ +
+ + + +
+
+
#   + + + def + execute(self): +
+ +
+ View Source +
    def execute(self):
+        global log
+        # TODO: implement the service
+        # Your code goes here !
+
+ +
+ + + +
+
+
+ + \ No newline at end of file diff --git a/docs/search.js b/docs/search.js new file mode 100644 index 0000000..c08a948 --- /dev/null +++ b/docs/search.js @@ -0,0 +1,36 @@ +window.pdocSearch = (function(){ +/** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.DocumentStore,this.index={},this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},t.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;n._fields=e.fields,n._ref=e.ref,n.documentStore=t.DocumentStore.load(e.documentStore),n.pipeline=t.Pipeline.load(e.pipeline),n.index={};for(var i in e.index)n.index[i]=t.InvertedIndex.load(e.index[i]);return n},t.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new t.InvertedIndex,this},t.Index.prototype.setRef=function(e){return this._ref=e,this},t.Index.prototype.saveDocument=function(e){return this.documentStore=new t.DocumentStore(e),this},t.Index.prototype.addDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.addDoc(i,e),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));this.documentStore.addFieldLength(i,n,o.length);var r={};o.forEach(function(e){e in r?r[e]+=1:r[e]=1},this);for(var s in r){var u=r[s];u=Math.sqrt(u),this.index[n].addToken(s,{ref:i,tf:u})}},this),n&&this.eventEmitter.emit("add",e,this)}},t.Index.prototype.removeDocByRef=function(e){if(e&&this.documentStore.isDocStored()!==!1&&this.documentStore.hasDoc(e)){var t=this.documentStore.getDoc(e);this.removeDoc(t,!1)}},t.Index.prototype.removeDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.hasDoc(i)&&(this.documentStore.removeDoc(i),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));o.forEach(function(e){this.index[n].removeToken(e,i)},this)},this),n&&this.eventEmitter.emit("remove",e,this))}},t.Index.prototype.updateDoc=function(e,t){var t=void 0===t?!0:t;this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},t.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var i=this.index[t].getDocFreq(e),o=1+Math.log(this.documentStore.length/(i+1));return this._idfCache[n]=o,o},t.Index.prototype.getFields=function(){return this._fields.slice()},t.Index.prototype.search=function(e,n){if(!e)return[];e="string"==typeof e?{any:e}:JSON.parse(JSON.stringify(e));var i=null;null!=n&&(i=JSON.stringify(n));for(var o=new t.Configuration(i,this.getFields()).get(),r={},s=Object.keys(e),u=0;u0&&t.push(e);for(var i in n)"docs"!==i&&"df"!==i&&this.expandToken(e+i,t,n[i]);return t},t.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},t.Configuration=function(e,n){var e=e||"";if(void 0==n||null==n)throw new Error("fields should not be null");this.config={};var i;try{i=JSON.parse(e),this.buildUserConfig(i,n)}catch(o){t.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(n)}},t.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},t.Configuration.prototype.buildUserConfig=function(e,n){var i="OR",o=!1;if(this.reset(),"bool"in e&&(i=e.bool||i),"expand"in e&&(o=e.expand||o),"fields"in e)for(var r in e.fields)if(n.indexOf(r)>-1){var s=e.fields[r],u=o;void 0!=s.expand&&(u=s.expand),this.config[r]={boost:s.boost||0===s.boost?s.boost:1,bool:s.bool||i,expand:u}}else t.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(i,o,n)},t.Configuration.prototype.addAllFields2UserConfig=function(e,t,n){n.forEach(function(n){this.config[n]={boost:1,bool:e,expand:t}},this)},t.Configuration.prototype.get=function(){return this.config},t.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){var e,t;for(e=0;e1;){if(r===e)return o;e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o]}return r===e?o:-1},lunr.SortedSet.prototype.locationFor=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;)e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o];return r>e?o:e>r?o+1:void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,i=0,o=this.length,r=e.length,s=this.elements,u=e.elements;;){if(n>o-1||i>r-1)break;s[n]!==u[i]?s[n]u[i]&&i++:(t.add(s[n]),n++,i++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,i;this.length>=e.length?(t=this,n=e):(t=e,n=this),i=t.clone();for(var o=0,r=n.toArray();o

\n"}, "modules.create_issue": {"fullname": "modules.create_issue", "modulename": "modules.create_issue", "qualname": "", "type": "module", "doc": "

\n"}, "modules.create_issue.command": {"fullname": "modules.create_issue.command", "modulename": "modules.create_issue", "qualname": "command", "type": "class", "doc": "

\n"}, "modules.create_issue.command.__init__": {"fullname": "modules.create_issue.command.__init__", "modulename": "modules.create_issue", "qualname": "command.__init__", "type": "function", "doc": "

\n", "parameters": ["self", "logger", "server_config", "header", "payload"], "funcdef": "def"}, "modules.create_issue.command.execute": {"fullname": "modules.create_issue.command.execute", "modulename": "modules.create_issue", "qualname": "command.execute", "type": "function", "doc": "

Create an issue on github.com using the given parameters.

\n", "parameters": ["self"], "funcdef": "def"}, "modules.notification": {"fullname": "modules.notification", "modulename": "modules.notification", "qualname": "", "type": "module", "doc": "

\n"}, "modules.notification.command": {"fullname": "modules.notification.command", "modulename": "modules.notification", "qualname": "command", "type": "class", "doc": "

\n"}, "modules.notification.command.__init__": {"fullname": "modules.notification.command.__init__", "modulename": "modules.notification", "qualname": "command.__init__", "type": "function", "doc": "

\n", "parameters": ["self", "logger", "server_config", "header", "payload"], "funcdef": "def"}, "modules.notification.command.execute": {"fullname": "modules.notification.command.execute", "modulename": "modules.notification", "qualname": "command.execute", "type": "function", "doc": "

Create a notification on github.com using the given parameters.

\n", "parameters": ["self"], "funcdef": "def"}, "modules.template": {"fullname": "modules.template", "modulename": "modules.template", "qualname": "", "type": "module", "doc": "

\n"}, "modules.template.command": {"fullname": "modules.template.command", "modulename": "modules.template", "qualname": "command", "type": "class", "doc": "

\n"}, "modules.template.command.__init__": {"fullname": "modules.template.command.__init__", "modulename": "modules.template", "qualname": "command.__init__", "type": "function", "doc": "

\n", "parameters": ["self", "logger", "server_config", "header", "payload"], "funcdef": "def"}, "modules.template.command.execute": {"fullname": "modules.template.command.execute", "modulename": "modules.template", "qualname": "command.execute", "type": "function", "doc": "

\n", "parameters": ["self"], "funcdef": "def"}}, "docInfo": {"modules": {"qualname": 0, "fullname": 1, "doc": 0}, "modules.create_issue": {"qualname": 0, "fullname": 2, "doc": 0}, "modules.create_issue.command": {"qualname": 1, "fullname": 3, "doc": 0}, "modules.create_issue.command.__init__": {"qualname": 2, "fullname": 4, "doc": 0}, "modules.create_issue.command.execute": {"qualname": 2, "fullname": 4, "doc": 7}, "modules.notification": {"qualname": 0, "fullname": 2, "doc": 0}, "modules.notification.command": {"qualname": 1, "fullname": 3, "doc": 0}, "modules.notification.command.__init__": {"qualname": 2, "fullname": 4, "doc": 0}, "modules.notification.command.execute": {"qualname": 2, "fullname": 4, "doc": 7}, "modules.template": {"qualname": 0, "fullname": 2, "doc": 0}, "modules.template.command": {"qualname": 1, "fullname": 3, "doc": 0}, "modules.template.command.__init__": {"qualname": 2, "fullname": 4, "doc": 0}, "modules.template.command.execute": {"qualname": 2, "fullname": 4, "doc": 0}}, "length": 13, "save": true}, "index": {"qualname": {"root": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"modules.create_issue.command": {"tf": 1}, "modules.create_issue.command.__init__": {"tf": 1}, "modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command": {"tf": 1}, "modules.notification.command.__init__": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}, "modules.template.command": {"tf": 1}, "modules.template.command.__init__": {"tf": 1}, "modules.template.command.execute": {"tf": 1}}, "df": 9}}}}}}}, "_": {"docs": {}, "df": 0, "_": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "_": {"docs": {}, "df": 0, "_": {"docs": {"modules.create_issue.command.__init__": {"tf": 1}, "modules.notification.command.__init__": {"tf": 1}, "modules.template.command.__init__": {"tf": 1}}, "df": 3}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}, "modules.template.command.execute": {"tf": 1}}, "df": 3}}}}}}}}, "fullname": {"root": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {"modules": {"tf": 1}, "modules.create_issue": {"tf": 1}, "modules.create_issue.command": {"tf": 1}, "modules.create_issue.command.__init__": {"tf": 1}, "modules.create_issue.command.execute": {"tf": 1}, "modules.notification": {"tf": 1}, "modules.notification.command": {"tf": 1}, "modules.notification.command.__init__": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}, "modules.template": {"tf": 1}, "modules.template.command": {"tf": 1}, "modules.template.command.__init__": {"tf": 1}, "modules.template.command.execute": {"tf": 1}}, "df": 13}}}}}, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "_": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "u": {"docs": {"modules.create_issue": {"tf": 1}, "modules.create_issue.command": {"tf": 1}, "modules.create_issue.command.__init__": {"tf": 1}, "modules.create_issue.command.execute": {"tf": 1}}, "df": 4}}}}}}}}}}, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"modules.create_issue.command": {"tf": 1}, "modules.create_issue.command.__init__": {"tf": 1}, "modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command": {"tf": 1}, "modules.notification.command.__init__": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}, "modules.template.command": {"tf": 1}, "modules.template.command.__init__": {"tf": 1}, "modules.template.command.execute": {"tf": 1}}, "df": 9}}}}}}}, "_": {"docs": {}, "df": 0, "_": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "_": {"docs": {}, "df": 0, "_": {"docs": {"modules.create_issue.command.__init__": {"tf": 1}, "modules.notification.command.__init__": {"tf": 1}, "modules.template.command.__init__": {"tf": 1}}, "df": 3}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}, "modules.template.command.execute": {"tf": 1}}, "df": 3}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {"modules.notification": {"tf": 1}, "modules.notification.command": {"tf": 1}, "modules.notification.command.__init__": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}}, "df": 4}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"modules.template": {"tf": 1}, "modules.template.command": {"tf": 1}, "modules.template.command.__init__": {"tf": 1}, "modules.template.command.execute": {"tf": 1}}, "df": 4}}}}}}}}}, "doc": {"root": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "m": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}}, "df": 2}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "u": {"docs": {"modules.create_issue.command.execute": {"tf": 1}}, "df": 1}}}}, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}}, "df": 2}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}}, "df": 2}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}}, "df": 2}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"modules.create_issue.command.execute": {"tf": 1}, "modules.notification.command.execute": {"tf": 1}}, "df": 2}}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {"modules.notification.command.execute": {"tf": 1}}, "df": 1}}}}}}}}, "pipeline": ["trimmer", "stopWordFilter", "stemmer"], "_isPrebuiltIndex": true}; + + // mirrored in build-search-index.js (part 1) + // Also split on html tags. this is a cheap heuristic, but good enough. + elasticlunr.tokenizer.setSeperator(/[\s\-.;&]+|<[^>]*>/); + + let searchIndex; + if (docs._isPrebuiltIndex) { + console.info("using precompiled search index"); + searchIndex = elasticlunr.Index.load(docs); + } else { + console.time("building search index"); + // mirrored in build-search-index.js (part 2) + searchIndex = elasticlunr(function () { + this.addField("qualname"); + this.addField("fullname"); + this.addField("doc"); + this.setRef("fullname"); + }); + for (let doc of docs) { + searchIndex.addDoc(doc); + } + console.timeEnd("building search index"); + } + + return (term) => searchIndex.search(term, { + fields: { + qualname: {boost: 4}, + fullname: {boost: 2}, + doc: {boost: 1}, + }, + expand: true + }); +})(); \ No newline at end of file diff --git a/docs2/index.html b/docs2/index.html new file mode 100644 index 0000000..66afbdd --- /dev/null +++ b/docs2/index.html @@ -0,0 +1,227 @@ + + + + + + + Module List – pdoc 8.0.0 + + + + + + + + + + +
+ + pdoc logo + + +
+
+
+ + \ No newline at end of file diff --git a/docs2/search.js b/docs2/search.js new file mode 100644 index 0000000..878882e --- /dev/null +++ b/docs2/search.js @@ -0,0 +1,36 @@ +window.pdocSearch = (function(){ +/** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.DocumentStore,this.index={},this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},t.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;n._fields=e.fields,n._ref=e.ref,n.documentStore=t.DocumentStore.load(e.documentStore),n.pipeline=t.Pipeline.load(e.pipeline),n.index={};for(var i in e.index)n.index[i]=t.InvertedIndex.load(e.index[i]);return n},t.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new t.InvertedIndex,this},t.Index.prototype.setRef=function(e){return this._ref=e,this},t.Index.prototype.saveDocument=function(e){return this.documentStore=new t.DocumentStore(e),this},t.Index.prototype.addDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.addDoc(i,e),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));this.documentStore.addFieldLength(i,n,o.length);var r={};o.forEach(function(e){e in r?r[e]+=1:r[e]=1},this);for(var s in r){var u=r[s];u=Math.sqrt(u),this.index[n].addToken(s,{ref:i,tf:u})}},this),n&&this.eventEmitter.emit("add",e,this)}},t.Index.prototype.removeDocByRef=function(e){if(e&&this.documentStore.isDocStored()!==!1&&this.documentStore.hasDoc(e)){var t=this.documentStore.getDoc(e);this.removeDoc(t,!1)}},t.Index.prototype.removeDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.hasDoc(i)&&(this.documentStore.removeDoc(i),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));o.forEach(function(e){this.index[n].removeToken(e,i)},this)},this),n&&this.eventEmitter.emit("remove",e,this))}},t.Index.prototype.updateDoc=function(e,t){var t=void 0===t?!0:t;this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},t.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var i=this.index[t].getDocFreq(e),o=1+Math.log(this.documentStore.length/(i+1));return this._idfCache[n]=o,o},t.Index.prototype.getFields=function(){return this._fields.slice()},t.Index.prototype.search=function(e,n){if(!e)return[];e="string"==typeof e?{any:e}:JSON.parse(JSON.stringify(e));var i=null;null!=n&&(i=JSON.stringify(n));for(var o=new t.Configuration(i,this.getFields()).get(),r={},s=Object.keys(e),u=0;u0&&t.push(e);for(var i in n)"docs"!==i&&"df"!==i&&this.expandToken(e+i,t,n[i]);return t},t.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},t.Configuration=function(e,n){var e=e||"";if(void 0==n||null==n)throw new Error("fields should not be null");this.config={};var i;try{i=JSON.parse(e),this.buildUserConfig(i,n)}catch(o){t.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(n)}},t.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},t.Configuration.prototype.buildUserConfig=function(e,n){var i="OR",o=!1;if(this.reset(),"bool"in e&&(i=e.bool||i),"expand"in e&&(o=e.expand||o),"fields"in e)for(var r in e.fields)if(n.indexOf(r)>-1){var s=e.fields[r],u=o;void 0!=s.expand&&(u=s.expand),this.config[r]={boost:s.boost||0===s.boost?s.boost:1,bool:s.bool||i,expand:u}}else t.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(i,o,n)},t.Configuration.prototype.addAllFields2UserConfig=function(e,t,n){n.forEach(function(n){this.config[n]={boost:1,bool:e,expand:t}},this)},t.Configuration.prototype.get=function(){return this.config},t.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){var e,t;for(e=0;e1;){if(r===e)return o;e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o]}return r===e?o:-1},lunr.SortedSet.prototype.locationFor=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;)e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o];return r>e?o:e>r?o+1:void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,i=0,o=this.length,r=e.length,s=this.elements,u=e.elements;;){if(n>o-1||i>r-1)break;s[n]!==u[i]?s[n]u[i]&&i++:(t.add(s[n]),n++,i++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,i;this.length>=e.length?(t=this,n=e):(t=e,n=this),i=t.clone();for(var o=0,r=n.toArray();o

\n"}]; + + // mirrored in build-search-index.js (part 1) + // Also split on html tags. this is a cheap heuristic, but good enough. + elasticlunr.tokenizer.setSeperator(/[\s\-.;&]+|<[^>]*>/); + + let searchIndex; + if (docs._isPrebuiltIndex) { + console.info("using precompiled search index"); + searchIndex = elasticlunr.Index.load(docs); + } else { + console.time("building search index"); + // mirrored in build-search-index.js (part 2) + searchIndex = elasticlunr(function () { + this.addField("qualname"); + this.addField("fullname"); + this.addField("doc"); + this.setRef("fullname"); + }); + for (let doc of docs) { + searchIndex.addDoc(doc); + } + console.timeEnd("building search index"); + } + + return (term) => searchIndex.search(term, { + fields: { + qualname: {boost: 4}, + fullname: {boost: 2}, + doc: {boost: 1}, + }, + expand: true + }); +})(); \ No newline at end of file diff --git a/docs2/src.html b/docs2/src.html new file mode 100644 index 0000000..d90412a --- /dev/null +++ b/docs2/src.html @@ -0,0 +1,219 @@ + + + + + + + src API documentation + + + + + + + + +
+
+

+src

+ + + +
+
+ + \ No newline at end of file diff --git a/src/WebhookEventServer.py b/src/WebhookEventServer.py old mode 100644 new mode 100755