Skip to content

Commit

Permalink
fixed pylint config
Browse files Browse the repository at this point in the history
improved README
organized scripts
  • Loading branch information
andgineer committed Apr 17, 2023
1 parent 29fd07d commit 4054cba
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 131 deletions.
28 changes: 1 addition & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,5 @@ repos:
name: Pylint
entry: pylint --max-line-length=99 --ignore-imports=yes
files: \.py$
language: python

- id: jupyisort
name: Sorts ipynb imports
entry: jupytext --pipe-fmt ".py" --pipe "isort - --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=99"
files: \.ipynb$
language: python

- id: jupyblack
name: Fixes ipynb format
entry: jupytext --pipe-fmt ".py" --pipe "black - --line-length=99"
files: \.ipynb$
language: python

- id: nbconvert
name: Removes ipynb content
entry: jupyter nbconvert
args:
[
"--ClearOutputPreprocessor.enabled=True",
"--ClearMetadataPreprocessor.enabled=True",
"--RegexRemovePreprocessor.enabled=True",
"--to=notebook",
"--log-level=ERROR",
"--inplace",
]
files: \.ipynb$
exclude: (tests|version.py|setup.py)
language: python
97 changes: 10 additions & 87 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[MASTER]
extension-pkg-allow-list=pydantic

# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
Expand Down Expand Up @@ -61,114 +60,45 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=apply-builtin,
attribute-defined-outside-init,
backtick,
bad-continuation,
bad-inline-option,
bad-python3-import,
basestring-builtin,
disable=attribute-defined-outside-init,
broad-except,
buffer-builtin,
cmp-builtin,
cmp-method,
coerce-builtin,
coerce-method,
comprehension-escape,
consider-using-with,
delslice-method,
deprecated-itertools-function,
deprecated-operator-function,
deprecated-pragma,
deprecated-str-translate-call,
deprecated-string-function,
deprecated-sys-function,
deprecated-types-field,
deprecated-urllib-function,
dict-items-not-iterating,
dict-iter-method,
dict-keys-not-iterating,
dict-values-not-iterating,
dict-view-method,
div-method,
duplicate-code,
eq-without-hash,
exception-escape,
exception-message-attribute,
execfile-builtin,
file-builtin,
file-ignored,
filter-builtin-not-iterating,
fixme,
getslice-method,
hex-method,
idiv-method,
import-error,
import-outside-toplevel,
import-star-module-level,
indexing-exception,
input-builtin,
intern-builtin,
invalid-name,
invalid-str-codec,
line-too-long,
locally-disabled,
logging-fstring-interpolation,
long-builtin,
long-suffix,
map-builtin-not-iterating,
metaclass-assignment,
missing-class-docstring,
missing-function-docstring,
missing-module-docstring,
next-method-called,
next-method-defined,
no-absolute-import,
no-member,
no-self-use,
non-ascii-bytes-literal,
nonzero-method,
oct-method,
old-division,
old-ne-operator,
old-octal-literal,
old-raise-syntax,
parameter-unpacking,
print-statement,
protected-access,
raising-string,
range-builtin-not-iterating,
raw-checker-failed,
raw_input-builtin,
rdiv-method,
redefined-builtin,
redefined-outer-name,
reduce-builtin,
relative-beyond-top-level,
reload-builtin,
round-builtin,
setslice-method,
standarderror-builtin,
suppressed-message,
sys-max-int,
too-few-public-methods,
too-many-arguments,
too-many-instance-attributes,
too-many-locals,
unichr-builtin,
unicode-builtin,
unpacking-in-except,
unused-variable, # handled by flake8
use-symbolic-message-instead,
useless-suppression,
using-cmp-argument,
wrong-import-order,
wrong-import-position,
xrange-builtin,
xreadlines-attribute,
zip-builtin-not-iterating,
eval-used,
exec-used,
W1202, # Use % formatting in logging functions and pass the % parameters as arguments
W1203, # Use lazy % or .format() formatting in logging functions
E1101, # Module has no member (mypy checks that)
E0611, # No name in module (mypy checks that)
W0511, # ALlow TODO


# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
Expand Down Expand Up @@ -279,13 +209,6 @@ max-line-length=99
# Maximum number of lines in a module.
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down Expand Up @@ -595,5 +518,5 @@ valid-metaclass-classmethod-first-arg=cls

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ uninstall:
test:
bash ./scripts/test.sh


upload:
bash ./scripts/upload.sh

run:
bash ./scripts/run.sh

lint:
bash ./scripts/lint.sh
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ Example of report for the command::
Publishing
----------

Place pypi password into ~/.pypirc
Automatically published on pypi on create release on github.

If for some reason you want to publish from local machine:
1) Place pypi password into ~/.pypirc
2) `make upload`

Documentation
-------------
Expand Down
8 changes: 5 additions & 3 deletions bombard/bombardier.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def apply_supply(s: str, supply: Dict[str, Any]) -> str:
if not isinstance(s, str):
return s
try:
return str(eval('f"""' + s + '"""', supply))
return str(eval('f"""' + s + '"""', supply)) # pylint: disable=eval-used
except Exception as e:
log.error(f'Cannot eval "{s}":\n{e}', exc_info=True)
return s
Expand Down Expand Up @@ -130,7 +130,9 @@ def process_resp(
if not extractor:
extractor = name
if "[" in extractor:
self.supply[name] = eval("data" + extractor)
self.supply[name] = eval( # pylint: disable=eval-used
"data" + extractor
)
else:
self.supply[name] = data[extractor]
except Exception as e:
Expand All @@ -152,7 +154,7 @@ def process_resp(
}
if "compiled" not in request:
request["compiled"] = compile(request["script"], "script", "exec")
exec(request["compiled"], context)
exec(request["compiled"], context) # pylint: disable=exec-used
except Exception as e:
log.error(
f'Script fail\n{e}\n\n{request["script"]}\n\n{supply}\n', exc_info=True
Expand Down
8 changes: 0 additions & 8 deletions install_local.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion run.sh → scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# debug
#
python3 -m bombard.main $@
python -m bombard.main $@
6 changes: 3 additions & 3 deletions scripts/upload.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# Uploads built package (see build.sh) to PyPi repo
# Do not forget to test installation locally with install_local.sh
#
# This is manual upload.
# The package will be uploaded automatically when you create new release on github
# This is manual upload, normally you do not need it.
# The package will be uploaded to pypi automatically when you create new release on github.
#
rm -rf build/*
rm -rf dist/*
scripts/build.sh
Expand Down

0 comments on commit 4054cba

Please sign in to comment.