summaryrefslogtreecommitdiff
path: root/tools/simulator.py
diff options
context:
space:
mode:
authorHervé Beraud <hberaud@redhat.com>2020-08-21 15:12:08 +0200
committerHervé Beraud <hberaud@redhat.com>2020-09-22 12:35:37 +0200
commita997f09e5bd9ce98cc57f1a5380453ff167e47ca (patch)
treeee280ba8adc343c65c2c81abe7343b5f5bd9b876 /tools/simulator.py
parent4bae96d7f7f7f99f1a3d8836c98340644925b2e2 (diff)
downloadoslo-messaging-a997f09e5bd9ce98cc57f1a5380453ff167e47ca.tar.gz
Adding pre-commit
Introduced changes: - pre-commit config and rules - Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks. - Applying fixes for pre-commit compliance in all code. Also commit hash will be used instead of version tags in pre-commit to prevend arbitrary code from running in developer's machines. pre-commit will be used to: - trailing whitespace; - Replaces or checks mixed line ending (mixed-line-ending); - Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker); - Checks that non-binary executables have a proper shebang (check-executables-have-shebangs); - Check for files that contain merge conflict strings (check-merge-conflict); - Check for debugger imports and py37+ breakpoint() calls in python source (debug-statements); - Attempts to load all yaml files to verify syntax (check-yaml); - Run flake8 checks (flake8) (local) For further details about tests please refer to: https://github.com/pre-commit/pre-commit-hooks Change-Id: Ibd0c3d64fdc5c293d9d676d33eab828d9fde971f Co-authored-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
Diffstat (limited to 'tools/simulator.py')
-rwxr-xr-xtools/simulator.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/simulator.py b/tools/simulator.py
index ab2529b..8b37f50 100755
--- a/tools/simulator.py
+++ b/tools/simulator.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
# 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
@@ -10,8 +11,12 @@
# License for the specific language governing permissions and limitations
# under the License.
-import eventlet # noqa
-eventlet.monkey_patch() # noqa
+try:
+ # Avoid https://github.com/PyCQA/pycodestyle/issues/472
+ import eventlet
+ eventlet.monkey_patch()
+except ImportError:
+ raise
import argparse
import bisect