Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import pluggy
hookspec = pluggy.HookspecMarker("eggsample")
@hookspec
def eggsample_add_ingredients(ingredients: tuple):
"""Have a look at the ingredients and offer your own.
:param ingredients: the ingredients, don't touch them!
:return: a list of ingredients
"""
@hookspec
def eggsample_prep_condiments(condiments: dict):
"""Reorganize the condiments tray to your heart's content.
import pytest
from pluggy import PluginValidationError, HookimplMarker, HookspecMarker
hookspec = HookspecMarker("example")
hookimpl = HookimplMarker("example")
def test_argmismatch(pm):
class Api:
@hookspec
def hello(self, arg):
"api hook 1"
pm.add_hookspecs(Api)
class Plugin:
@hookimpl
def hello(self, argwrong):
pass
import pytest
from pluggy import HookimplMarker, HookspecMarker, PluginValidationError
from pluggy.hooks import HookImpl
hookspec = HookspecMarker("example")
hookimpl = HookimplMarker("example")
@pytest.fixture
def hc(pm):
class Hooks:
@hookspec
def he_method1(self, arg):
pass
pm.add_hookspecs(Hooks)
return pm.hook.he_method1
@pytest.fixture
def addmeth(hc):
"""
# pylint: disable=unused-argument,invalid-name
import sys
import pluggy
import psutil
from .exception import (RunnerNoSuchRunner, RunnerMorethanOneRunnerEnabled,
RunnerTypeError)
RMNAME = "pyppl_runner"
# save all runners ever registered
RUNNERS = {}
# poll interval to check job status
DEFAULT_POLL_INTERVAL = 1
hookimpl = pluggy.HookimplMarker(RMNAME)
hookspec = pluggy.HookspecMarker(RMNAME)
@hookspec
def runner_init(proc):
"""@API
RUNNER API
Initiate runner
@params:
proc (Proc): The Proc instance
"""
@hookspec(firstresult=True)
def isrunning(job):
"""@API
RUNNER API
from pluggy import HookspecMarker
hookspec = HookspecMarker("devpiweb")
@hookspec
def devpiweb_get_status_info(request):
"""Called on every request to gather status information.
Returns a list of dictionaries with keys ``status`` and ``msg``, where
status is ``warn`` or ``fatal``.
"""
@hookspec
def devpiweb_indexer_backend():
""" return dict containing indexer backend info.
The following keys are defined:
"""
Hookspecs of the core plugins
"""
import pluggy
hookspec = pluggy.HookspecMarker('sirbot')
@hookspec
def plugins(loop):
"""
Hook for registering a plugin.
Args:
loop (asyncio.AbstractEventLoop): Event loop
Returns:
sirbot.core.plugin.Plugin: A plugin instance
"""
pass # pragma: no cover
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Plugin hooks for ``ProcessRun`` customization."""
import pluggy
hookspec = pluggy.HookspecMarker('renku')
@hookspec
def process_run_annotations(run):
"""Plugin Hook to add ``Annotation`` entry list to a ``ProcessRun``.
:param run: A ``ProcessRun`` object to get annotations for.
:returns: A list of ``renku.core.models.provenance.activities.Annotation``
objects.
"""
pass
@hookspec
def cmdline_tool_annotations(tool):
"""Plugin Hook to add ``Annotation`` entry list to a ``WorkflowTool``.
return constructed_url
Where `constructed_url` is obviously a dummy - it's the plugin writers responsibility
to construct an adequate url from the shorthand, factoring in any method, endpoint
and parameters given in it.
"""
# Built-in
from typing import Any, Dict, Mapping, Tuple, Type, Union
# Third-party
import pluggy
from requests import PreparedRequest, Response
from requests.auth import AuthBase
hookspec = pluggy.HookspecMarker("bitex")
@hookspec
def announce_plugin() -> Union[
Tuple[str, Type[AuthBase], Type[PreparedRequest], Type[Response]], None
]:
"""Announce plugin classes to :mod:`bitex`.
The function should return a tuple with the following items:
* the exchange name this plugin is for
* the auth class to use when generating authentication signatures for it
* the prepared request class to use when prepping for transmission
* the response class to use when generating a response from the exchange.
"""