Skip to content

Commit

Permalink
Pep8 (#151)
Browse files Browse the repository at this point in the history
* Format to code standards, addressed linter errors/warnings
  • Loading branch information
jmeixensperger authored Apr 4, 2019
1 parent 5cb93a6 commit 710da6e
Show file tree
Hide file tree
Showing 77 changed files with 2,315 additions and 2,274 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ stage/
local/
eventgen_wsgi.conf
*.log
dist
*.egg-info
**/*.tgz
.cache
Expand All @@ -27,3 +26,4 @@ _book
*.result
venv/*
*.log.*
splunk_eventgen-*/
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ image: setup_eventgen egg
rm splunk_eventgen/default/eventgen_engine.conf || true
docker build -f dockerfiles/Dockerfile . -t eventgen

test: egg image test_helper test_collection_cleanup
test: egg image test_helper run_tests test_collection_cleanup

test_helper:
docker run -d -t --net=host -v /var/run/docker.sock:/var/run/docker.sock --name ${EVENTGEN_TEST_IMAGE} eventgen:latest cat
Expand All @@ -41,15 +41,10 @@ test_helper:
@echo 'Installing test requirements'
docker exec -i ${EVENTGEN_TEST_IMAGE} /bin/sh -c "pip install -r $(shell pwd)/tests/requirements.txt" || true

run_tests:
@echo 'Running the super awesome tests'
docker exec -i ${EVENTGEN_TEST_IMAGE} /bin/sh -c "cd $(shell pwd); python tests/run_tests.py ${SMALL} ${MEDIUM} ${LARGE} ${XLARGE}" || true

echo 'Collecting results'
#TODO: Should be paramaterized or generalized so that we don't need to add this here
docker cp ${EVENTGEN_TEST_IMAGE}:$(shell pwd)/tests_results.xml tests_results.xml || echo "no tests_results.xml" || true

docker stop ${EVENTGEN_TEST_IMAGE} || true

test_collection_cleanup:
@echo 'Collecting results'
#TODO: Should be paramaterized or generalized so that we don't need to add this here
Expand Down
18 changes: 14 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
[flake8]
exclude = .git,.tox,__pycache__,env,venv,build,dist,docs
exclude = .git,.tox,__pycache__,env,venv,splunk_eventgen/lib/concurrent,splunk_eventgen/lib/requests_futures
max-line-length = 120
ignore = E121,E123,E126,E226,E24,E704,W503,W504,E722,E731,W605
# Includes default ignores, E722 (bare excepts), E731 (lambda usage), and W605 (escape sequences)

[metadata]
description-file = README.md
version-from-file: __init__.py

[yapf]
based_on_style = pep8
spaces_before_comment = 4
split_before_logical_operator = true
column_limit = 120
split_all_comma_separated_values = false
split_before_named_assigns = false
split_before_first_argument = false
split_before_expression_after_opening_paren = false
split_before_closing_bracket = false
each_dict_entry_on_separate_line = false

[isort]
# isort/yapf solutions to below files are not compatible
skip = splunk_eventgen/lib/concurrent,splunk_eventgen/lib/requests_futures
19 changes: 7 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/usr/bin/env python
# encoding: utf-8

from setuptools import setup
from setuptools import find_packages
import splunk_eventgen
from setuptools import find_packages, setup

import splunk_eventgen

VERSION = splunk_eventgen.__version__

try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
except (IOError, ImportError):
long_description = open('README.md').read()


Expand All @@ -27,12 +26,9 @@ def readme():
long_description=long_description,
author='Splunk, Inc.',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Testing',
'Programming Language :: Python',
'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Testing', 'Programming Language :: Python',
'Programming Language :: Python :: 2.7'],
keywords='splunk eventgen container containers docker automation',
entry_points={'console_scripts': ["splunk_eventgen = splunk_eventgen.__main__:main"]},
Expand All @@ -56,5 +52,4 @@ def readme():
'flake8>=3.7.7',
'yapf>=0.26.0',
'isort>=4.3.15'
]
)
])
5 changes: 4 additions & 1 deletion splunk_eventgen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

import json
import os

file_location = os.path.normpath(os.path.realpath(__file__))
VERSION_FILE = "version.json"
VERSION_LOCATION = os.path.normpath(os.path.join(file_location, '..', VERSION_FILE))


def _get_version(versionfile):
"""
@param versionfile: File to get the version info from
@param versionfile: File to get the version info from
@return: Version Number
"""
with open(VERSION_LOCATION, 'r') as fp:
Expand All @@ -19,6 +20,7 @@ def _get_version(versionfile):
fp.close()
return version


def _set_dev_version():
"""
Write .dev at the end of version
Expand All @@ -33,6 +35,7 @@ def _set_dev_version():
fp.write(json.dumps(json_data))
fp.close()


def _set_release_version():
"""
Remove .dev at end of version if it exists
Expand Down
Loading

0 comments on commit 710da6e

Please sign in to comment.