How to use the autohooks.settings.Mode.PIPENV function in autohooks

To help you get started, we’ve selected a few autohooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_effective_mode(self):
        self.assertEqual(Mode.PIPENV.get_effective_mode(), Mode.PIPENV)
        self.assertEqual(Mode.PYTHONPATH.get_effective_mode(), Mode.PYTHONPATH)
        self.assertEqual(Mode.POETRY.get_effective_mode(), Mode.POETRY)
        self.assertEqual(Mode.UNDEFINED.get_effective_mode(), Mode.PYTHONPATH)
        self.assertEqual(Mode.UNKNOWN.get_effective_mode(), Mode.PYTHONPATH)
github greenbone / autohooks / tests / test_settings.py View on Github external
def test_string_conversion(self):
        self.assertEqual(str(Mode.PIPENV), 'pipenv')
        self.assertEqual(str(Mode.PYTHONPATH), 'pythonpath')
        self.assertEqual(str(Mode.POETRY), 'poetry')
        self.assertEqual(str(Mode.UNKNOWN), 'unknown')
        self.assertEqual(str(Mode.UNDEFINED), 'undefined')
github greenbone / autohooks / tests / test_install.py View on Github external
def test_install(self):
        hooks = get_autohooks_pre_commit_hook(mode=Mode.PIPENV)
        pre_commmit_hook_path = get_pre_commit_hook_path()

        self.assertFalse(pre_commmit_hook_path.exists())

        install_pre_commit_hook(hooks, pre_commmit_hook_path)

        self.assertTrue(pre_commmit_hook_path.exists())
github greenbone / autohooks / autohooks / hooks.py View on Github external
def read_mode(self) -> Mode:
        lines = self.pre_commit_hook.split('\n')
        if len(lines) < 1 or len(lines[0]) == 0:
            return Mode.UNDEFINED

        shebang = lines[0][2:]

        if shebang == PYTHON3_SHEBANG:
            return Mode.PYTHONPATH
        if shebang == POETRY_SHEBANG:
            return Mode.POETRY
        if shebang == PIPENV_SHEBANG:
            return Mode.PIPENV

        return Mode.UNKNOWN
github greenbone / autohooks / autohooks / settings.py View on Github external
def get_effective_mode(self):
        # pylint: disable=comparison-with-callable
        if self.value == Mode.PIPENV.value:
            return Mode.PIPENV
        if self.value == Mode.POETRY.value:
            return Mode.POETRY
        return Mode.PYTHONPATH
github greenbone / autohooks / autohooks / settings.py View on Github external
def get_effective_mode(self):
        # pylint: disable=comparison-with-callable
        if self.value == Mode.PIPENV.value:
            return Mode.PIPENV
        if self.value == Mode.POETRY.value:
            return Mode.POETRY
        return Mode.PYTHONPATH