forked from pryorda/vmware_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flake8, adding precommit, and various fixes
- Loading branch information
Daniel Pryor
committed
Jun 27, 2018
1 parent
251e5ca
commit 7d79dde
Showing
9 changed files
with
405 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v1.3.0 | ||
hooks: | ||
# Git state | ||
- id: check-merge-conflict | ||
stages: [commit] | ||
- id: check-added-large-files | ||
stages: [commit] | ||
# Sensitive information | ||
- id: detect-private-key | ||
stages: [commit] | ||
- id: detect-aws-credentials | ||
stages: [commit] | ||
# Generic file state | ||
- id: trailing-whitespace | ||
stages: [commit] | ||
- id: mixed-line-ending | ||
stages: [commit] | ||
- id: end-of-file-fixer | ||
stages: [commit] | ||
exclude: .*\.tfvars$ # terraform fmt separates everything with blank lines leaving a trailing line at the end | ||
- id: check-executables-have-shebangs | ||
stages: [commit] | ||
# Language syntax/formatting | ||
- id: check-yaml | ||
stages: [commit] | ||
- id: check-json | ||
stages: [commit] | ||
- id: pretty-format-json | ||
stages: [commit] | ||
args: | ||
- --autofix | ||
- id: flake8 | ||
stages: [commit] | ||
- repo: https://github.com/mattlqx/pre-commit-sign | ||
rev: v1.1.1 | ||
hooks: | ||
- id: sign-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.tabSize": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
prometheus-client==0.0.19 | ||
pytz | ||
pyvmomi>=6.5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__version__ = "0.1.2" | ||
__author__ = "Remi Verchere" | ||
__version__ = "0.2.0" | ||
__author__ = "Daniel Pryor" | ||
__license__ = "BSD 3-Clause License" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import threading | ||
|
||
|
||
class Threader(object): | ||
""" | ||
Takes method and data and threads it | ||
""" | ||
_thread = '' | ||
|
||
def thread_it(self, method, data): | ||
""" | ||
Thread any method and data will be used as args | ||
""" | ||
self._thread = threading.Thread(target=method, args=(data)) | ||
self._thread.start() | ||
if threading.active_count() >= 50: | ||
self.join() | ||
|
||
def join(self): | ||
""" | ||
join all threads and complete them | ||
""" | ||
try: | ||
self._thread.join() | ||
except RuntimeError: | ||
# Thread terminated. | ||
pass | ||
except ReferenceError: | ||
pass |
Oops, something went wrong.