From 6aa1af20df4cba8424eb7a6001f48665eba10a4f Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 15 Feb 2019 15:37:34 -0600 Subject: [PATCH 01/22] Add Pylint CI job --- .gitlab-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a09e5d830..462cbe6a9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -103,6 +103,16 @@ Python 3 POCL Examples: except: - tags +Pylint: + script: + - export PY_EXE=python3 + - EXTRA_INSTALL="pybind11 numpy mako matplotlib" + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh + - ". ./prepare-and-run-pylint.sh loopy test/test_*.py" + tags: + - python3 + except: + - tags CentOS binary: script: -- GitLab From ce9b8cf94c7d3ee9bfcd56562c78178b7d01041d Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 15 Feb 2019 16:11:41 -0600 Subject: [PATCH 02/22] Temporarily disable other jobs --- .gitlab-ci.yml | 255 +++++++++++++++++++++++++------------------------ 1 file changed, 128 insertions(+), 127 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 462cbe6a9..c94bc01bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,107 +1,107 @@ -Python 2.7 POCL: - script: - - export PY_EXE=python2.7 - - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako" - - export LOOPY_NO_CACHE=1 - - export NO_DOCTESTS=1 - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - - ". ./build-and-test-py-project.sh" - tags: - - python2.7 - - pocl - except: - - tags - artifacts: - reports: - junit: test/pytest.xml - - -Python 2.7 with legacy PyOpenCL: - script: - - export PY_EXE=python2.7 - - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako" - - export REQUIREMENTS_TXT="requirements-old-pyopencl.txt" - - export LOOPY_NO_CACHE=1 - - export NO_DOCTESTS=1 - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - - ". ./build-and-test-py-project.sh" - tags: - - python2.7 - - pocl - except: - - tags - retry: 2 - artifacts: - reports: - junit: test/pytest.xml - - -Python 3 POCL: - script: - - export PY_EXE=python3 - - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako" - - export LOOPY_NO_CACHE=1 - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - - ". ./build-and-test-py-project.sh" - tags: - - python3 - - pocl - except: - - tags - artifacts: - reports: - junit: test/pytest.xml - - -Python 3 POCL Twice With Cache: - script: - - export PY_EXE=python3 - - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako" - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - - ". ./build-and-test-py-project.sh" - - "cd .." - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - - ". ./build-and-test-py-project.sh" - tags: - - python3 - - pocl - except: - - tags - artifacts: - reports: - junit: test/pytest.xml - - -# PyPy POCL: +# Python 2.7 POCL: # script: -# - export PY_EXE=pypy +# - export PY_EXE=python2.7 # - export PYOPENCL_TEST=portable # - export EXTRA_INSTALL="pybind11 numpy mako" +# - export LOOPY_NO_CACHE=1 +# - export NO_DOCTESTS=1 # - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh # - ". ./build-and-test-py-project.sh" # tags: -# - pypy +# - python2.7 # - pocl # except: # - tags - -Python 3 POCL Examples: - script: - - export PY_EXE=python3 - - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako pyvisfile matplotlib ipykernel nbconvert" - - ". ./build-py-project-and-run-examples.sh" - tags: - - python3 - - pocl - - large-node - - ispc - except: - - tags +# artifacts: +# reports: +# junit: test/pytest.xml +# +# +# Python 2.7 with legacy PyOpenCL: +# script: +# - export PY_EXE=python2.7 +# - export PYOPENCL_TEST=portable +# - export EXTRA_INSTALL="pybind11 numpy mako" +# - export REQUIREMENTS_TXT="requirements-old-pyopencl.txt" +# - export LOOPY_NO_CACHE=1 +# - export NO_DOCTESTS=1 +# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh +# - ". ./build-and-test-py-project.sh" +# tags: +# - python2.7 +# - pocl +# except: +# - tags +# retry: 2 +# artifacts: +# reports: +# junit: test/pytest.xml +# +# +# Python 3 POCL: +# script: +# - export PY_EXE=python3 +# - export PYOPENCL_TEST=portable +# - export EXTRA_INSTALL="pybind11 numpy mako" +# - export LOOPY_NO_CACHE=1 +# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh +# - ". ./build-and-test-py-project.sh" +# tags: +# - python3 +# - pocl +# except: +# - tags +# artifacts: +# reports: +# junit: test/pytest.xml +# +# +# Python 3 POCL Twice With Cache: +# script: +# - export PY_EXE=python3 +# - export PYOPENCL_TEST=portable +# - export EXTRA_INSTALL="pybind11 numpy mako" +# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh +# - ". ./build-and-test-py-project.sh" +# - "cd .." +# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh +# - ". ./build-and-test-py-project.sh" +# tags: +# - python3 +# - pocl +# except: +# - tags +# artifacts: +# reports: +# junit: test/pytest.xml +# +# +# # PyPy POCL: +# # script: +# # - export PY_EXE=pypy +# # - export PYOPENCL_TEST=portable +# # - export EXTRA_INSTALL="pybind11 numpy mako" +# # - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh +# # - ". ./build-and-test-py-project.sh" +# # tags: +# # - pypy +# # - pocl +# # except: +# # - tags +# +# Python 3 POCL Examples: +# script: +# - export PY_EXE=python3 +# - export PYOPENCL_TEST=portable +# - export EXTRA_INSTALL="pybind11 numpy mako pyvisfile matplotlib ipykernel nbconvert" +# - ". ./build-py-project-and-run-examples.sh" +# tags: +# - python3 +# - pocl +# - large-node +# - ispc +# except: +# - tags Pylint: script: @@ -114,35 +114,36 @@ Pylint: except: - tags -CentOS binary: - script: - - (cd build-helpers; ./make-linux-build-docker.sh --nodate) - - (cd ./build-helpers; ./loopy-centos6 ../examples/fortran/sparse.floopy) - artifacts: - expire_in: 4 weeks - paths: - - build-helpers/loopy-centos6 - tags: - - docker - only: - - master - retry: 2 - -Documentation: - script: - - EXTRA_INSTALL="pybind11 numpy" - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-docs.sh - - ". ./build-docs.sh" - tags: - - python3 - only: - - master - -Flake8: - script: - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh - - ". ./prepare-and-run-flake8.sh loopy test" - tags: - - python3 - except: - - tags +# CentOS binary: +# script: +# - (cd build-helpers; ./make-linux-build-docker.sh --nodate) +# - (cd ./build-helpers; ./loopy-centos6 ../examples/fortran/sparse.floopy) +# artifacts: +# expire_in: 4 weeks +# paths: +# - build-helpers/loopy-centos6 +# tags: +# - docker +# only: +# - master +# retry: 2 +# +# Documentation: +# script: +# - EXTRA_INSTALL="pybind11 numpy" +# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-docs.sh +# - ". ./build-docs.sh" +# tags: +# - python3 +# only: +# - master +# +# Flake8: +# script: +# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh +# - ". ./prepare-and-run-flake8.sh loopy test" +# tags: +# - python3 +# except: +# - tags +# -- GitLab From 105f119b8ea8bdf63475eca6ba89a8f53958172c Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 15 Feb 2019 16:18:41 -0600 Subject: [PATCH 03/22] Add pylintrc --- .pylintrc | 813 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 813 insertions(+) create mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 000000000..de1bb1e61 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,813 @@ +# Based on: https://gitlab.tiker.net/inducer/ci-support/raw/6748afc607cece25d55eb7d645ad846999824246/.pylintrc-default + +[MASTER] + +# 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 +# run arbitrary code. +extension-pkg-whitelist=numpy,isply + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS,compyte + +# Add files or directories matching the regex patterns to the blacklist. The +# regex matches against base names, not paths. +ignore-patterns= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +init-hook=sys.setrecursionlimit(5000) + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use. +jobs=1 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=no + +# Specify a configuration file. +#rcfile= + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. +confidence= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --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=blacklisted-name, + invalid-name, + missing-docstring, + empty-docstring, + unneeded-not, + singleton-comparison, + misplaced-comparison-constant, + unidiomatic-typecheck, + consider-using-enumerate, + consider-iterating-dictionary, + bad-classmethod-argument, + bad-mcs-method-argument, + bad-mcs-classmethod-argument, + single-string-used-for-slots, + line-too-long, + too-many-lines, + trailing-whitespace, + missing-final-newline, + trailing-newlines, + multiple-statements, + superfluous-parens, + bad-whitespace, + mixed-line-endings, + unexpected-line-ending-format, + bad-continuation, + wrong-spelling-in-comment, + wrong-spelling-in-docstring, + invalid-characters-in-docstring, + multiple-imports, + wrong-import-order, + ungrouped-imports, + wrong-import-position, + useless-import-alias, + len-as-condition, + print-statement, + parameter-unpacking, + unpacking-in-except, + old-raise-syntax, + backtick, + long-suffix, + old-ne-operator, + old-octal-literal, + import-star-module-level, + non-ascii-bytes-literal, + raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead, + c-extension-no-member, + literal-comparison, + comparison-with-itself, + no-self-use, + no-classmethod-decorator, + no-staticmethod-decorator, + useless-object-inheritance, + cyclic-import, + duplicate-code, + too-many-ancestors, + too-many-instance-attributes, + too-few-public-methods, + too-many-public-methods, + too-many-return-statements, + too-many-branches, + too-many-arguments, + too-many-locals, + too-many-statements, + too-many-boolean-expressions, + consider-merging-isinstance, + too-many-nested-blocks, + simplifiable-if-statement, + redefined-argument-from-local, + no-else-return, + consider-using-ternary, + trailing-comma-tuple, + stop-iteration-return, + simplify-boolean-expression, + inconsistent-return-statements, + useless-return, + consider-swap-variables, + consider-using-join, + consider-using-in, + consider-using-get, + chained-comparison, + consider-using-dict-comprehension, + consider-using-set-comprehension, + simplifiable-if-expression, + unreachable, + dangerous-default-value, + pointless-statement, + pointless-string-statement, + expression-not-assigned, + unnecessary-pass, + unnecessary-lambda, + duplicate-key, + assign-to-new-keyword, + useless-else-on-loop, + exec-used, + eval-used, + confusing-with-statement, + using-constant-test, + comparison-with-callable, + lost-exception, + assert-on-tuple, + attribute-defined-outside-init, + bad-staticmethod-argument, + protected-access, + arguments-differ, + signature-differs, + abstract-method, + super-init-not-called, + no-init, + non-parent-init-called, + useless-super-delegation, + unnecessary-semicolon, + bad-indentation, + mixed-indentation, + wildcard-import, + deprecated-module, + relative-import, + reimported, + import-self, + misplaced-future, + fixme, + invalid-encoded-data, + global-variable-undefined, + global-variable-not-assigned, + global-statement, + global-at-module-level, + unused-import, + unused-variable, + unused-argument, + unused-wildcard-import, + redefined-outer-name, + redefined-builtin, + redefine-in-handler, + undefined-loop-variable, + unbalanced-tuple-unpacking, + cell-var-from-loop, + possibly-unused-variable, + self-cls-assignment, + bare-except, + broad-except, + duplicate-except, + try-except-raise, + binary-op-exception, + raising-format-tuple, + keyword-arg-before-vararg, + logging-not-lazy, + logging-format-interpolation, + logging-fstring-interpolation, + bad-format-string-key, + unused-format-string-key, + bad-format-string, + missing-format-argument-key, + unused-format-string-argument, + format-combined-specification, + missing-format-attribute, + invalid-format-index, + duplicate-string-formatting-argument, + anomalous-backslash-in-string, + anomalous-unicode-escape-in-string, + implicit-str-concat-in-sequence, + bad-open-mode, + boolean-datetime, + redundant-unittest-assert, + deprecated-method, + bad-thread-instantiation, + shallow-copy-environ, + invalid-envvar-default, + subprocess-popen-preexec-fn, + apply-builtin, + basestring-builtin, + buffer-builtin, + cmp-builtin, + coerce-builtin, + execfile-builtin, + file-builtin, + long-builtin, + raw_input-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + no-absolute-import, + old-division, + dict-iter-method, + dict-view-method, + next-method-called, + metaclass-assignment, + indexing-exception, + raising-string, + reload-builtin, + oct-method, + hex-method, + nonzero-method, + cmp-method, + input-builtin, + round-builtin, + intern-builtin, + unichr-builtin, + map-builtin-not-iterating, + zip-builtin-not-iterating, + range-builtin-not-iterating, + filter-builtin-not-iterating, + using-cmp-argument, + eq-without-hash, + div-method, + idiv-method, + rdiv-method, + exception-message-attribute, + invalid-str-codec, + sys-max-int, + bad-python3-import, + deprecated-string-function, + deprecated-str-translate-call, + deprecated-itertools-function, + deprecated-types-field, + next-method-defined, + dict-items-not-iterating, + dict-keys-not-iterating, + dict-values-not-iterating, + deprecated-operator-function, + deprecated-urllib-function, + xreadlines-attribute, + deprecated-sys-function, + exception-escape, + comprehension-escape + +# 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 +# it should appear only once). See also the "--disable" option for examples. +enable=syntax-error, + unrecognized-inline-option, + bad-option-value, + init-is-generator, + return-in-init, + function-redefined, + not-in-loop, + return-outside-function, + yield-outside-function, + return-arg-in-generator, + nonexistent-operator, + duplicate-argument-name, + abstract-class-instantiated, + bad-reversed-sequence, + too-many-star-expressions, + invalid-star-assignment-target, + star-needs-assignment-target, + nonlocal-and-global, + continue-in-finally, + nonlocal-without-binding, + used-prior-global-declaration, + misplaced-format-function, + method-hidden, + access-member-before-definition, + no-method-argument, + no-self-argument, + invalid-slots-object, + assigning-non-slot, + invalid-slots, + inherit-non-class, + inconsistent-mro, + duplicate-bases, + non-iterator-returned, + unexpected-special-method-signature, + invalid-length-returned, + import-error, + relative-beyond-top-level, + used-before-assignment, + undefined-variable, + undefined-all-variable, + invalid-all-object, + no-name-in-module, + unpacking-non-sequence, + bad-except-order, + raising-bad-type, + bad-exception-context, + misplaced-bare-raise, + raising-non-exception, + notimplemented-raised, + catching-non-exception, + bad-super-call, + missing-super-argument, + no-member, + not-callable, + assignment-from-no-return, + no-value-for-parameter, + too-many-function-args, + unexpected-keyword-arg, + redundant-keyword-arg, + missing-kwoa, + invalid-sequence-index, + invalid-slice-index, + assignment-from-none, + not-context-manager, + invalid-unary-operand-type, + unsupported-binary-operation, + repeated-keyword, + not-an-iterable, + not-a-mapping, + unsupported-membership-test, + unsubscriptable-object, + unsupported-assignment-operation, + unsupported-delete-operation, + invalid-metaclass, + unhashable-dict-key, + logging-unsupported-format, + logging-format-truncated, + logging-too-many-args, + logging-too-few-args, + bad-format-character, + truncated-format-string, + mixed-format-string, + format-needs-mapping, + missing-format-string-key, + too-many-format-args, + too-few-format-args, + bad-string-format-type, + bad-str-strip-call, + invalid-envvar-value, + yield-inside-async-function, + not-async-context-manager, + fatal, + astroid-error, + parse-error, + method-check-failed + + +[REPORTS] + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +#msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=no + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit + + +[LOGGING] + +# Format style used to check logging format string. `old` means using % +# formatting, while `new` is for `{}` formatting. +logging-format-style=old + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package.. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# 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 + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[SIMILARITIES] + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. +#argument-rgx= + +# Naming style matching correct attribute names. +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. +#class-attribute-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _ + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. +#variable-rgx= + + +[IMPORTS] + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules=optparse,tkinter.tix + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled). +ext-import-graph= + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled). +import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict, + _fields, + _replace, + _source, + _make + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=cls + + +[DESIGN] + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement. +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception". +overgeneral-exceptions=Exception -- GitLab From d63bd5331b079fb265cac57987ab92ea9c686207 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 15 Feb 2019 17:14:11 -0600 Subject: [PATCH 04/22] Install ipykernel --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c94bc01bf..453de8844 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -106,7 +106,7 @@ Pylint: script: - export PY_EXE=python3 - - EXTRA_INSTALL="pybind11 numpy mako matplotlib" + - EXTRA_INSTALL="pybind11 numpy mako matplotlib ipykernel" - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh - ". ./prepare-and-run-pylint.sh loopy test/test_*.py" tags: -- GitLab From 5e17c715c1f7300117186830d367cf042af52541 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 15 Feb 2019 17:14:21 -0600 Subject: [PATCH 05/22] Suppress loopy.maxima errors --- loopy/maxima.py | 1 + 1 file changed, 1 insertion(+) diff --git a/loopy/maxima.py b/loopy/maxima.py index 22d0c085c..c74360a73 100644 --- a/loopy/maxima.py +++ b/loopy/maxima.py @@ -1,3 +1,4 @@ +# pylint: disable=all # This code needs porting to modern loopy """Export to maxima.""" from __future__ import division -- GitLab From 4d05c96e297b4173cccd385899ac1feaa6c76642 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 16 Feb 2019 02:10:33 -0600 Subject: [PATCH 06/22] Fix loopy.kernel.instruction --- loopy/kernel/instruction.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/loopy/kernel/instruction.py b/loopy/kernel/instruction.py index 4d3b25497..5dee96e75 100644 --- a/loopy/kernel/instruction.py +++ b/loopy/kernel/instruction.py @@ -474,7 +474,7 @@ class InstructionBase(ImmutableRecord): from loopy.tools import intern_frozenset_of_ids - if self.id is not None: + if self.id is not None: # pylint:disable=access-member-before-definition self.id = intern(self.id) self.depends_on = intern_frozenset_of_ids(self.depends_on) self.groups = intern_frozenset_of_ids(self.groups) @@ -575,23 +575,23 @@ class memory_ordering(object): # noqa """ @_deprecated_memory_ordering_class_method - def RELAXED(): + def RELAXED(): # pylint:disable=no-method-argument return MemoryOrdering.RELAXED @_deprecated_memory_ordering_class_method - def ACQUIRE(): + def ACQUIRE(): # pylint:disable=no-method-argument return MemoryOrdering.ACQUIRE @_deprecated_memory_ordering_class_method - def RELEASE(): + def RELEASE(): # pylint:disable=no-method-argument return MemoryOrdering.RELEASE @_deprecated_memory_ordering_class_method - def ACQ_REL(): + def ACQ_REL(): # pylint:disable=no-method-argument return MemoryOrdering.ACQ_REL @_deprecated_memory_ordering_class_method - def SEQ_CST(): + def SEQ_CST(): # pylint:disable=no-method-argument return MemoryOrdering.SEQ_CST @staticmethod @@ -652,23 +652,23 @@ class memory_scope(object): # noqa """ @_deprecated_memory_scope_class_method - def WORK_ITEM(): - return MemoryScope.PRIVATE + def WORK_ITEM(): # pylint:disable=no-method-argument + return MemoryScope.WORK_ITEM @_deprecated_memory_scope_class_method - def WORK_GROUP(): + def WORK_GROUP(): # pylint:disable=no-method-argument return MemoryScope.WORK_GROUP @_deprecated_memory_scope_class_method - def DEVICE(): + def DEVICE(): # pylint:disable=no-method-argument return MemoryScope.DEVICE @_deprecated_memory_scope_class_method - def ALL_SVM_DEVICES(): + def ALL_SVM_DEVICES(): # pylint:disable=no-method-argument return MemoryScope.ALL_SVM_DEVICES @_deprecated_memory_scope_class_method - def auto(): + def auto(): # pylint:disable=no-method-argument return MemoryScope.auto @staticmethod @@ -735,6 +735,10 @@ class OrderedAtomic(VarAtomicity): and self.ordering == other.ordering and self.scope == other.scope) + @property + def op_name(self): + raise NotImplementedError + def __str__(self): return "%s[%s]%s/%s" % ( self.op_name, -- GitLab From 27ea84cbc2e4377a2b8b9deda201bc97266bd264 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 16 Feb 2019 02:11:46 -0600 Subject: [PATCH 07/22] Disable some spurious errors --- loopy/kernel/data.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loopy/kernel/data.py b/loopy/kernel/data.py index 8103029dc..dd68c950e 100644 --- a/loopy/kernel/data.py +++ b/loopy/kernel/data.py @@ -286,15 +286,15 @@ class temp_var_scope(object): # noqa """ @_deprecated_temp_var_scope_class_method - def PRIVATE(): + def PRIVATE(): # pylint:disable=no-method-argument return AddressSpace.PRIVATE @_deprecated_temp_var_scope_class_method - def LOCAL(): + def LOCAL(): # pylint:disable=no-method-argument return AddressSpace.LOCAL @_deprecated_temp_var_scope_class_method - def GLOBAL(): + def GLOBAL(): # pylint:disable=no-method-argument return AddressSpace.GLOBAL @classmethod -- GitLab From aeccf3837c10e4f0ef7dc775af6f5c0c4ed4e770 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 16 Feb 2019 14:47:45 -0600 Subject: [PATCH 08/22] Fix a legitimate looking issue --- loopy/kernel/creation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index 2175b5f36..039a3c172 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -765,15 +765,14 @@ def parse_instructions(instructions, defines): local_w_inames = insn_options_stack[-1]["within_inames"] if insn.within_inames_is_final: - if not ( - local_w_inames <= insn.within_inames): + if not (local_w_inames <= insn.within_inames): raise LoopyError("non-parsed instruction '%s' without " "inames '%s' (but with final iname dependencies) " "found inside 'for'/'with' block for inames " - "'%s'" - % (insn.id, + "'%s'" % ( + insn.id, ", ".join(local_w_inames - insn.within_inames), - insn_options_stack[-1].within_inames)) + local_w_inames)) else: # not final, add inames from current scope -- GitLab From 218130d2d89ddd6f64ae58531c7d4688b0cb0348 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 16 Feb 2019 14:53:09 -0600 Subject: [PATCH 09/22] [ci skip] More disabling of spurious warnings --- loopy/kernel/creation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index 039a3c172..5ba147dfd 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -2043,14 +2043,14 @@ def make_kernel(domains, instructions, kernel_data=["..."], **kwargs): kernel_args.append(dat) continue - if isinstance(dat, ArrayBase) and isinstance(dat.shape, tuple): + if isinstance(dat, ArrayBase) and isinstance(dat.shape, tuple): # noqa pylint:disable=no-member new_shape = [] - for shape_axis in dat.shape: + for shape_axis in dat.shape: # pylint:disable=no-member if shape_axis is not None: new_shape.append(expand_defines_in_expr(shape_axis, defines)) else: new_shape.append(shape_axis) - dat = dat.copy(shape=tuple(new_shape)) + dat = dat.copy(shape=tuple(new_shape)) # pylint:disable=no-member for arg_name in dat.name.split(","): arg_name = arg_name.strip() -- GitLab From bc4e06c48f9ab3b79c9ac826a9bb3bc293811975 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 16 Feb 2019 17:29:04 -0600 Subject: [PATCH 10/22] Fix isl_helpers.py --- loopy/isl_helpers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/loopy/isl_helpers.py b/loopy/isl_helpers.py index 5a747d070..664d09d2e 100644 --- a/loopy/isl_helpers.py +++ b/loopy/isl_helpers.py @@ -56,8 +56,9 @@ def pw_aff_to_aff(pw_aff): def dump_space(ls): - return " ".join("%s: %d" % (dt, ls.dim(getattr(dim_type, dt))) - for dt in dim_type.names) + return " ".join( + "%s: %d" % (dim_type.find_value(dt), ls.dim(dt)) + for dt in range(1 + dim_type.all)) # {{{ make_slab @@ -451,7 +452,7 @@ def obj_involves_variable(obj, var_name): return True for idiv in obj.dim(dim_type.div): - if obj_involves_variable(obj.get_div(idiv)): + if obj_involves_variable(obj.get_div(idiv), var_name): return True return False -- GitLab From 3e43a5a757cd086c5fd82135cab934018574f640 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 17:26:44 -0600 Subject: [PATCH 11/22] Fix loopy.library.reduction --- loopy/library/reduction.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/loopy/library/reduction.py b/loopy/library/reduction.py index 8ed5cbe56..2658b8cd7 100644 --- a/loopy/library/reduction.py +++ b/loopy/library/reduction.py @@ -226,6 +226,14 @@ class _SegmentedScalarReductionOperation(ReductionOperation): def __init__(self, **kwargs): self.inner_reduction = self.base_reduction_class(**kwargs) + @property + def base_reduction_class(self): + raise NotImplementedError + + @property + def which(self): + raise NotImplementedError + @property def arg_count(self): return 2 @@ -301,6 +309,15 @@ class ArgExtOp(ReductionOpFunction): class _ArgExtremumReductionOperation(ReductionOperation): + + @property + def which(self): + raise NotImplementedError + + @property + def neutral_sign(self): + raise NotImplementedError + def prefix(self, scalar_dtype, index_dtype): return "loopy_arg%s_%s_%s" % (self.which, scalar_dtype.numpy_dtype.type.__name__, -- GitLab From 37caab3a4bbbecfcf6b7c9be15f0a8865c60d309 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 17:56:42 -0600 Subject: [PATCH 12/22] Fix dump_binary option of auto_test_vs_ref --- loopy/auto_test.py | 28 ++++++++++++++++++++-------- test/test_loopy.py | 17 +++++++++++++++++ 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/loopy/auto_test.py b/loopy/auto_test.py index 015c82dd1..402ca983f 100644 --- a/loopy/auto_test.py +++ b/loopy/auto_test.py @@ -514,7 +514,6 @@ def auto_test_vs_ref( queue = cl.CommandQueue(ctx, properties=cl.command_queue_properties.PROFILING_ENABLE) - args = None from loopy.kernel import KernelState from loopy.target.pyopencl import PyOpenCLTarget if test_knl.state not in [ @@ -542,12 +541,12 @@ def auto_test_vs_ref( compiled = CompiledKernel(ctx, kernel) - if args is None: - kernel_info = compiled.kernel_info(frozenset()) + kernel_info = compiled.kernel_info(frozenset()) + + args = make_args(kernel, + kernel_info.implemented_data_info, + queue, ref_arg_data, parameters) - args = make_args(kernel, - kernel_info.implemented_data_info, - queue, ref_arg_data, parameters) args["out_host"] = False if not quiet: @@ -558,8 +557,21 @@ def auto_test_vs_ref( print(compiled.get_highlighted_code()) print(75*"-") if dump_binary: - print(type(compiled.cl_program)) - print(compiled.cl_program.binaries[0]) + # {{{ find cl program + + for name in dir(kernel_info.cl_kernels): + if name.startswith("__"): + continue + cl_kernel = getattr(kernel_info.cl_kernels, name) + cl_program = cl_kernel.get_info(cl.kernel_info.PROGRAM) + break + else: + assert False, "could not find cl_program" + + # }}} + + print(type(cl_program)) + print(cl_program.binaries[0]) print(75*"-") logger.info("%s: run warmup" % (knl.name)) diff --git a/test/test_loopy.py b/test/test_loopy.py index defd27dc0..80af89f3b 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -2927,6 +2927,23 @@ def test_backwards_dep_printing_and_error(): print(knl) +def test_dump_binary(ctx_factory): + ctx = ctx_factory() + + knl = lp.make_kernel( + "{ [i]: 0<=i Date: Sun, 17 Feb 2019 17:59:12 -0600 Subject: [PATCH 13/22] Fix loopy.tools --- loopy/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopy/tools.py b/loopy/tools.py index 470921e31..0fc6d1bf9 100644 --- a/loopy/tools.py +++ b/loopy/tools.py @@ -42,7 +42,7 @@ from six.moves import intern if six.PY2: def is_integer(obj): - return isinstance(obj, (int, long, np.integer)) # noqa + return isinstance(obj, (int, long, np.integer)) # noqa pylint:disable=undefined-variable else: def is_integer(obj): return isinstance(obj, (int, np.integer)) -- GitLab From d8f8b3ebdc247c5c83130d76e1652835adc305c3 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 18:03:26 -0600 Subject: [PATCH 14/22] Fix loopy.frontend.fortran --- .gitlab-ci.yml | 2 +- loopy/frontend/fortran/translator.py | 4 ++-- loopy/frontend/fortran/tree.py | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 453de8844..545c85b38 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -106,7 +106,7 @@ Pylint: script: - export PY_EXE=python3 - - EXTRA_INSTALL="pybind11 numpy mako matplotlib ipykernel" + - EXTRA_INSTALL="pybind11 numpy mako matplotlib ipykernel ply fparser" - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh - ". ./prepare-and-run-pylint.sh loopy test/test_*.py" tags: diff --git a/loopy/frontend/fortran/translator.py b/loopy/frontend/fortran/translator.py index bcbe41874..0df2f13c5 100644 --- a/loopy/frontend/fortran/translator.py +++ b/loopy/frontend/fortran/translator.py @@ -307,9 +307,9 @@ class F2LoopyTranslator(FTreeWalkerBase): ("integer", "8"): np.int64, } if hasattr(np, "float128"): - TYPE_MAP[("real", "16")] = np.float128 + TYPE_MAP[("real", "16")] = np.float128 # pylint:disable=no-member if hasattr(np, "complex256"): - TYPE_MAP[("complex", "32")] = np.complex256 + TYPE_MAP[("complex", "32")] = np.complex256 # pylint:disable=no-member def dtype_from_stmt(self, stmt): length, kind = stmt.selector diff --git a/loopy/frontend/fortran/tree.py b/loopy/frontend/fortran/tree.py index 6939bb6ad..8eeb14eab 100644 --- a/loopy/frontend/fortran/tree.py +++ b/loopy/frontend/fortran/tree.py @@ -32,6 +32,10 @@ class FTreeWalkerBase(object): from loopy.frontend.fortran.expression import FortranExpressionParser self.expr_parser = FortranExpressionParser(self) + @property + def filename(self): + raise NotImplementedError + def rec(self, expr, *args, **kwargs): mro = list(type(expr).__mro__) dispatch_class = kwargs.pop("dispatch_class", type(self)) -- GitLab From c9b39af1557466b37cd41380cc0593b93ee1e75d Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 18:12:11 -0600 Subject: [PATCH 15/22] Remove dead code --- loopy/target/cuda.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/loopy/target/cuda.py b/loopy/target/cuda.py index d6f55091a..8f14738c3 100644 --- a/loopy/target/cuda.py +++ b/loopy/target/cuda.py @@ -262,24 +262,6 @@ class CUDACASTBuilder(CASTBuilder): return FunctionDeclarationWrapper(fdecl) - def generate_code(self, kernel, codegen_state, impl_arg_info): - code, implemented_domains = ( - super(CudaTarget, self).generate_code( - kernel, codegen_state, impl_arg_info)) - - return code, implemented_domains - - def generate_body(self, kernel, codegen_state): - body, implemented_domains = ( - super(CudaTarget, self).generate_body(kernel, codegen_state)) - - from loopy.kernel.data import ImageArg - - if any(isinstance(arg, ImageArg) for arg in kernel.args): - raise NotImplementedError("not yet: texture arguments in CUDA") - - return body, implemented_domains - # }}} # {{{ code generation guts -- GitLab From 1d8416646df659a9ecbe5223e3dbf8f88cbd8015 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 18:20:35 -0600 Subject: [PATCH 16/22] Update pylintrc --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index de1bb1e61..0d46bf68e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -5,7 +5,7 @@ # 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 # run arbitrary code. -extension-pkg-whitelist=numpy,isply +extension-pkg-whitelist=numpy,islpy # Add files or directories to the blacklist. They should be base names, not # paths. -- GitLab From f886bbbc55efe1365a499f5f7d1a06e4329ff7ce Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 18:22:33 -0600 Subject: [PATCH 17/22] Various fixes --- .gitlab-ci.yml | 22 ++++++++++++---------- loopy/codegen/control.py | 2 +- loopy/codegen/loop.py | 4 ++-- loopy/kernel/__init__.py | 16 +++++++--------- loopy/target/c/__init__.py | 4 ++-- loopy/target/ispc.py | 2 +- loopy/target/opencl.py | 2 +- loopy/transform/precompute.py | 4 ++-- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 545c85b38..7599297d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -105,6 +105,8 @@ Pylint: script: + # Needed to avoid name shadowing issues when running from source directory. + - PROJECT_INSTALL_FLAGS="--editable" - export PY_EXE=python3 - EXTRA_INSTALL="pybind11 numpy mako matplotlib ipykernel ply fparser" - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh @@ -137,13 +139,13 @@ Pylint: # - python3 # only: # - master -# -# Flake8: -# script: -# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh -# - ". ./prepare-and-run-flake8.sh loopy test" -# tags: -# - python3 -# except: -# - tags -# + +Flake8: + script: + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh + - ". ./prepare-and-run-flake8.sh loopy test" + tags: + - python3 + except: + - tags + diff --git a/loopy/codegen/control.py b/loopy/codegen/control.py index 45e2a18c4..e1520a82e 100644 --- a/loopy/codegen/control.py +++ b/loopy/codegen/control.py @@ -503,7 +503,7 @@ def build_loop_nest(codegen_state, schedule_index): prev_gen_code = gen_code - def gen_code(inner_codegen_state): + def gen_code(inner_codegen_state): # noqa pylint:disable=function-redefined condition_exprs = [ constraint_to_cond_expr(cns) for cns in bounds_checks] + [ diff --git a/loopy/codegen/loop.py b/loopy/codegen/loop.py index ebddf3153..58f055b7b 100644 --- a/loopy/codegen/loop.py +++ b/loopy/codegen/loop.py @@ -175,7 +175,7 @@ def generate_vectorize_loop(codegen_state, sched_index): warn(kernel, "vec_upper_not_const", "upper bound for vectorized loop '%s' is not a constant, " "cannot vectorize--unrolling instead") - return generate_unroll_loop(kernel, sched_index, codegen_state) + return generate_unroll_loop(codegen_state, sched_index) length = int(pw_aff_to_expr(length_aff)) @@ -190,7 +190,7 @@ def generate_vectorize_loop(codegen_state, sched_index): warn(kernel, "vec_lower_not_0", "lower bound for vectorized loop '%s' is not zero, " "cannot vectorize--unrolling instead") - return generate_unroll_loop(kernel, sched_index, codegen_state) + return generate_unroll_loop(codegen_state, sched_index) # {{{ 'implement' vectorization bounds diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py index e3342d0f9..42d7c0f1e 100644 --- a/loopy/kernel/__init__.py +++ b/loopy/kernel/__init__.py @@ -121,15 +121,15 @@ class kernel_state(object): # noqa """ @_deperecated_kernel_state_class_method - def INITIAL(): - return KernelState.INITITAL + def INITIAL(): # pylint:disable=no-method-argument + return KernelState.INITIAL @_deperecated_kernel_state_class_method - def PREPROCESSED(): + def PREPROCESSED(): # pylint:disable=no-method-argument return KernelState.PREPROCESSED @_deperecated_kernel_state_class_method - def SCHEDULED(): + def SCHEDULED(): # pylint:disable=no-method-argument return KernelState.SCHEDULED # }}} @@ -1456,13 +1456,11 @@ class LoopKernel(ImmutableRecordWithoutPickling): # {{{ check that 'reconstituted' object has same hash from loopy.tools import LoopyKeyBuilder - LoopyKeyBuilder()(self) - - assert p_hash_digest == self._pytools_persistent_hash_digest + assert p_hash_digest == LoopyKeyBuilder()(self) # }}} - else: - self._pytools_persistent_hash_digest = p_hash_digest + + self._pytools_persistent_hash_digest = p_hash_digest from loopy.kernel.tools import SetOperationCacheManager self.cache_manager = SetOperationCacheManager() diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index 83efecf0e..17dd9dc10 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -381,7 +381,7 @@ def c_math_mangler(target, name, arg_dtypes, modify_name=True): pass # fabs elif dtype == np.float32: name = name + "f" # fabsf - elif dtype == np.float128: + elif dtype == np.float128: # pylint:disable=no-member name = name + "l" # fabsl else: raise LoopyTypeError("%s does not support type %s" % (name, dtype)) @@ -407,7 +407,7 @@ def c_math_mangler(target, name, arg_dtypes, modify_name=True): pass # fmin elif dtype == np.float32: name = name + "f" # fminf - elif dtype == np.float128: + elif dtype == np.float128: # pylint:disable=no-member name = name + "l" # fminl else: raise LoopyTypeError("%s does not support type %s" diff --git a/loopy/target/ispc.py b/loopy/target/ispc.py index 5e59dff48..cccee2301 100644 --- a/loopy/target/ispc.py +++ b/loopy/target/ispc.py @@ -404,7 +404,7 @@ class ISPCASTBuilder(CASTBuilder): simplify_using_aff(kernel, idx) for idx in lhs.index_tuple) access_info = get_access_info(kernel.target, ary, index_tuple, - lambda expr: evaluate(expr, self.codegen_state.var_subst_map), + lambda expr: evaluate(expr, codegen_state.var_subst_map), codegen_state.vectorization_info) from loopy.kernel.data import ArrayArg, TemporaryVariable diff --git a/loopy/target/opencl.py b/loopy/target/opencl.py index 81292fe60..8a6e52842 100644 --- a/loopy/target/opencl.py +++ b/loopy/target/opencl.py @@ -607,7 +607,7 @@ class OpenCLCASTBuilder(CASTBuilder): var_kind = "__global" else: raise LoopyError("unexpected kind of variable '%s' in " - "atomic operation: " + "atomic operation: '%s'" % (lhs_var.name, type(lhs_var).__name__)) old_val = "*(%s *) &" % ctype + old_val diff --git a/loopy/transform/precompute.py b/loopy/transform/precompute.py index 52d568975..f2b184a41 100644 --- a/loopy/transform/precompute.py +++ b/loopy/transform/precompute.py @@ -997,13 +997,13 @@ def precompute(kernel, subst_use, sweep_inames=[], within=None, if len(temp_var.shape) != len(new_temp_shape): raise LoopyError("Existing and new temporary '%s' do not " - "have matching number of dimensions " + "have matching number of dimensions ('%d' vs. '%d') " % (temporary_name, len(temp_var.shape), len(new_temp_shape))) if temp_var.base_indices != (0,) * len(new_temp_shape): raise LoopyError("Existing and new temporary '%s' do not " - "have matching number of dimensions " + "have matching number of dimensions ('%d' vs. '%d') " % (temporary_name, len(temp_var.shape), len(new_temp_shape))) -- GitLab From 5d7ced54886726ddb9ddecc58a2dccd80fbebd59 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 18:29:49 -0600 Subject: [PATCH 18/22] Re-enable other CI jobs --- .gitlab-ci.yml | 239 ++++++++++++++++++++++++------------------------- 1 file changed, 119 insertions(+), 120 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7599297d8..a6f81e5b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,107 +1,107 @@ -# Python 2.7 POCL: -# script: -# - export PY_EXE=python2.7 -# - export PYOPENCL_TEST=portable -# - export EXTRA_INSTALL="pybind11 numpy mako" -# - export LOOPY_NO_CACHE=1 -# - export NO_DOCTESTS=1 -# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh -# - ". ./build-and-test-py-project.sh" -# tags: -# - python2.7 -# - pocl -# except: -# - tags -# artifacts: -# reports: -# junit: test/pytest.xml -# -# -# Python 2.7 with legacy PyOpenCL: -# script: -# - export PY_EXE=python2.7 -# - export PYOPENCL_TEST=portable -# - export EXTRA_INSTALL="pybind11 numpy mako" -# - export REQUIREMENTS_TXT="requirements-old-pyopencl.txt" -# - export LOOPY_NO_CACHE=1 -# - export NO_DOCTESTS=1 -# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh -# - ". ./build-and-test-py-project.sh" -# tags: -# - python2.7 -# - pocl -# except: -# - tags -# retry: 2 -# artifacts: -# reports: -# junit: test/pytest.xml -# -# -# Python 3 POCL: -# script: -# - export PY_EXE=python3 -# - export PYOPENCL_TEST=portable -# - export EXTRA_INSTALL="pybind11 numpy mako" -# - export LOOPY_NO_CACHE=1 -# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh -# - ". ./build-and-test-py-project.sh" -# tags: -# - python3 -# - pocl -# except: -# - tags -# artifacts: -# reports: -# junit: test/pytest.xml -# -# -# Python 3 POCL Twice With Cache: +Python 2.7 POCL: + script: + - export PY_EXE=python2.7 + - export PYOPENCL_TEST=portable + - export EXTRA_INSTALL="pybind11 numpy mako" + - export LOOPY_NO_CACHE=1 + - export NO_DOCTESTS=1 + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + tags: + - python2.7 + - pocl + except: + - tags + artifacts: + reports: + junit: test/pytest.xml + + +Python 2.7 with legacy PyOpenCL: + script: + - export PY_EXE=python2.7 + - export PYOPENCL_TEST=portable + - export EXTRA_INSTALL="pybind11 numpy mako" + - export REQUIREMENTS_TXT="requirements-old-pyopencl.txt" + - export LOOPY_NO_CACHE=1 + - export NO_DOCTESTS=1 + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + tags: + - python2.7 + - pocl + except: + - tags + retry: 2 + artifacts: + reports: + junit: test/pytest.xml + + +Python 3 POCL: + script: + - export PY_EXE=python3 + - export PYOPENCL_TEST=portable + - export EXTRA_INSTALL="pybind11 numpy mako" + - export LOOPY_NO_CACHE=1 + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + tags: + - python3 + - pocl + except: + - tags + artifacts: + reports: + junit: test/pytest.xml + + +Python 3 POCL Twice With Cache: + script: + - export PY_EXE=python3 + - export PYOPENCL_TEST=portable + - export EXTRA_INSTALL="pybind11 numpy mako" + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + - "cd .." + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + tags: + - python3 + - pocl + except: + - tags + artifacts: + reports: + junit: test/pytest.xml + + +# PyPy POCL: # script: -# - export PY_EXE=python3 +# - export PY_EXE=pypy # - export PYOPENCL_TEST=portable # - export EXTRA_INSTALL="pybind11 numpy mako" # - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh # - ". ./build-and-test-py-project.sh" -# - "cd .." -# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh -# - ". ./build-and-test-py-project.sh" # tags: -# - python3 +# - pypy # - pocl # except: # - tags -# artifacts: -# reports: -# junit: test/pytest.xml -# -# -# # PyPy POCL: -# # script: -# # - export PY_EXE=pypy -# # - export PYOPENCL_TEST=portable -# # - export EXTRA_INSTALL="pybind11 numpy mako" -# # - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh -# # - ". ./build-and-test-py-project.sh" -# # tags: -# # - pypy -# # - pocl -# # except: -# # - tags -# -# Python 3 POCL Examples: -# script: -# - export PY_EXE=python3 -# - export PYOPENCL_TEST=portable -# - export EXTRA_INSTALL="pybind11 numpy mako pyvisfile matplotlib ipykernel nbconvert" -# - ". ./build-py-project-and-run-examples.sh" -# tags: -# - python3 -# - pocl -# - large-node -# - ispc -# except: -# - tags + +Python 3 POCL Examples: + script: + - export PY_EXE=python3 + - export PYOPENCL_TEST=portable + - export EXTRA_INSTALL="pybind11 numpy mako pyvisfile matplotlib ipykernel nbconvert" + - ". ./build-py-project-and-run-examples.sh" + tags: + - python3 + - pocl + - large-node + - ispc + except: + - tags Pylint: script: @@ -116,30 +116,30 @@ Pylint: except: - tags -# CentOS binary: -# script: -# - (cd build-helpers; ./make-linux-build-docker.sh --nodate) -# - (cd ./build-helpers; ./loopy-centos6 ../examples/fortran/sparse.floopy) -# artifacts: -# expire_in: 4 weeks -# paths: -# - build-helpers/loopy-centos6 -# tags: -# - docker -# only: -# - master -# retry: 2 -# -# Documentation: -# script: -# - EXTRA_INSTALL="pybind11 numpy" -# - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-docs.sh -# - ". ./build-docs.sh" -# tags: -# - python3 -# only: -# - master - +CentOS binary: + script: + - (cd build-helpers; ./make-linux-build-docker.sh --nodate) + - (cd ./build-helpers; ./loopy-centos6 ../examples/fortran/sparse.floopy) + artifacts: + expire_in: 4 weeks + paths: + - build-helpers/loopy-centos6 + tags: + - docker + only: + - master + retry: 2 + +Documentation: + script: + - EXTRA_INSTALL="pybind11 numpy" + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-docs.sh + - ". ./build-docs.sh" + tags: + - python3 + only: + - master + Flake8: script: - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh @@ -148,4 +148,3 @@ Flake8: - python3 except: - tags - -- GitLab From dad06e56459fe58716c7ed8fba7be34fd0443de4 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 18:34:03 -0600 Subject: [PATCH 19/22] Fix loopy.transform.iname --- loopy/transform/iname.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/loopy/transform/iname.py b/loopy/transform/iname.py index 83598dcc2..51de11191 100644 --- a/loopy/transform/iname.py +++ b/loopy/transform/iname.py @@ -675,7 +675,12 @@ def tag_inames(kernel, iname_to_tag, force=False, ignore_nonexistent=False): iname_to_tag = list(six.iteritems(iname_to_tag)) # flatten iterables of tags for each iname - from collections import Iterable + + try: + from collections.abc import Iterable + except ImportError: + from collections import Iterable # pylint:disable=no-name-in-module + unpack_iname_to_tag = [] for iname, tags in iname_to_tag: if isinstance(tags, Iterable) and not isinstance(tags, str): -- GitLab From 4bbfe34a9613b2e5b998fdab6df0d05a7930d083 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 18:45:46 -0600 Subject: [PATCH 20/22] Pass filename to parent class --- loopy/frontend/fortran/translator.py | 4 +--- loopy/frontend/fortran/tree.py | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/loopy/frontend/fortran/translator.py b/loopy/frontend/fortran/translator.py index 0df2f13c5..d7a1b2498 100644 --- a/loopy/frontend/fortran/translator.py +++ b/loopy/frontend/fortran/translator.py @@ -199,7 +199,7 @@ class Scope(object): class F2LoopyTranslator(FTreeWalkerBase): def __init__(self, filename, target=None): - FTreeWalkerBase.__init__(self) + FTreeWalkerBase.__init__(self, filename) self.target = target @@ -214,8 +214,6 @@ class F2LoopyTranslator(FTreeWalkerBase): self.conditions = [] self.conditions_data = [] - self.filename = filename - self.index_dtype = None self.block_nest = [] diff --git a/loopy/frontend/fortran/tree.py b/loopy/frontend/fortran/tree.py index 8eeb14eab..c73896774 100644 --- a/loopy/frontend/fortran/tree.py +++ b/loopy/frontend/fortran/tree.py @@ -28,13 +28,10 @@ from loopy.diagnostic import LoopyError class FTreeWalkerBase(object): - def __init__(self): + def __init__(self, filename): from loopy.frontend.fortran.expression import FortranExpressionParser self.expr_parser = FortranExpressionParser(self) - - @property - def filename(self): - raise NotImplementedError + self.filename = filename def rec(self, expr, *args, **kwargs): mro = list(type(expr).__mro__) -- GitLab From 10466c336bac1d669fae55b87b9b47d3c5c06a56 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 17 Feb 2019 19:41:19 -0600 Subject: [PATCH 21/22] Check for binaries attribute --- loopy/auto_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loopy/auto_test.py b/loopy/auto_test.py index 402ca983f..92c01addb 100644 --- a/loopy/auto_test.py +++ b/loopy/auto_test.py @@ -571,7 +571,9 @@ def auto_test_vs_ref( # }}} print(type(cl_program)) - print(cl_program.binaries[0]) + if hasattr(cl_program, "binaries"): + print(cl_program.binaries[0]) + print(75*"-") logger.info("%s: run warmup" % (knl.name)) -- GitLab From e40acf20996124a24c71d50dd559eb476ff387e8 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Thu, 7 Mar 2019 20:13:07 -0600 Subject: [PATCH 22/22] Switch to YAML-based Pylint config --- .pylintrc | 813 -------------------------------------------- .pylintrc-local.yml | 6 + 2 files changed, 6 insertions(+), 813 deletions(-) delete mode 100644 .pylintrc create mode 100644 .pylintrc-local.yml diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 0d46bf68e..000000000 --- a/.pylintrc +++ /dev/null @@ -1,813 +0,0 @@ -# Based on: https://gitlab.tiker.net/inducer/ci-support/raw/6748afc607cece25d55eb7d645ad846999824246/.pylintrc-default - -[MASTER] - -# 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 -# run arbitrary code. -extension-pkg-whitelist=numpy,islpy - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS,compyte - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -init-hook=sys.setrecursionlimit(5000) - -# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the -# number of processors available to use. -jobs=1 - -# Control the amount of potential inferred values when inferring a single -# object. This can help the performance when dealing with large functions or -# complex, nested conditions. -limit-inference-results=100 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=no - -# Specify a configuration file. -#rcfile= - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. -confidence= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once). You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --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=blacklisted-name, - invalid-name, - missing-docstring, - empty-docstring, - unneeded-not, - singleton-comparison, - misplaced-comparison-constant, - unidiomatic-typecheck, - consider-using-enumerate, - consider-iterating-dictionary, - bad-classmethod-argument, - bad-mcs-method-argument, - bad-mcs-classmethod-argument, - single-string-used-for-slots, - line-too-long, - too-many-lines, - trailing-whitespace, - missing-final-newline, - trailing-newlines, - multiple-statements, - superfluous-parens, - bad-whitespace, - mixed-line-endings, - unexpected-line-ending-format, - bad-continuation, - wrong-spelling-in-comment, - wrong-spelling-in-docstring, - invalid-characters-in-docstring, - multiple-imports, - wrong-import-order, - ungrouped-imports, - wrong-import-position, - useless-import-alias, - len-as-condition, - print-statement, - parameter-unpacking, - unpacking-in-except, - old-raise-syntax, - backtick, - long-suffix, - old-ne-operator, - old-octal-literal, - import-star-module-level, - non-ascii-bytes-literal, - raw-checker-failed, - bad-inline-option, - locally-disabled, - file-ignored, - suppressed-message, - useless-suppression, - deprecated-pragma, - use-symbolic-message-instead, - c-extension-no-member, - literal-comparison, - comparison-with-itself, - no-self-use, - no-classmethod-decorator, - no-staticmethod-decorator, - useless-object-inheritance, - cyclic-import, - duplicate-code, - too-many-ancestors, - too-many-instance-attributes, - too-few-public-methods, - too-many-public-methods, - too-many-return-statements, - too-many-branches, - too-many-arguments, - too-many-locals, - too-many-statements, - too-many-boolean-expressions, - consider-merging-isinstance, - too-many-nested-blocks, - simplifiable-if-statement, - redefined-argument-from-local, - no-else-return, - consider-using-ternary, - trailing-comma-tuple, - stop-iteration-return, - simplify-boolean-expression, - inconsistent-return-statements, - useless-return, - consider-swap-variables, - consider-using-join, - consider-using-in, - consider-using-get, - chained-comparison, - consider-using-dict-comprehension, - consider-using-set-comprehension, - simplifiable-if-expression, - unreachable, - dangerous-default-value, - pointless-statement, - pointless-string-statement, - expression-not-assigned, - unnecessary-pass, - unnecessary-lambda, - duplicate-key, - assign-to-new-keyword, - useless-else-on-loop, - exec-used, - eval-used, - confusing-with-statement, - using-constant-test, - comparison-with-callable, - lost-exception, - assert-on-tuple, - attribute-defined-outside-init, - bad-staticmethod-argument, - protected-access, - arguments-differ, - signature-differs, - abstract-method, - super-init-not-called, - no-init, - non-parent-init-called, - useless-super-delegation, - unnecessary-semicolon, - bad-indentation, - mixed-indentation, - wildcard-import, - deprecated-module, - relative-import, - reimported, - import-self, - misplaced-future, - fixme, - invalid-encoded-data, - global-variable-undefined, - global-variable-not-assigned, - global-statement, - global-at-module-level, - unused-import, - unused-variable, - unused-argument, - unused-wildcard-import, - redefined-outer-name, - redefined-builtin, - redefine-in-handler, - undefined-loop-variable, - unbalanced-tuple-unpacking, - cell-var-from-loop, - possibly-unused-variable, - self-cls-assignment, - bare-except, - broad-except, - duplicate-except, - try-except-raise, - binary-op-exception, - raising-format-tuple, - keyword-arg-before-vararg, - logging-not-lazy, - logging-format-interpolation, - logging-fstring-interpolation, - bad-format-string-key, - unused-format-string-key, - bad-format-string, - missing-format-argument-key, - unused-format-string-argument, - format-combined-specification, - missing-format-attribute, - invalid-format-index, - duplicate-string-formatting-argument, - anomalous-backslash-in-string, - anomalous-unicode-escape-in-string, - implicit-str-concat-in-sequence, - bad-open-mode, - boolean-datetime, - redundant-unittest-assert, - deprecated-method, - bad-thread-instantiation, - shallow-copy-environ, - invalid-envvar-default, - subprocess-popen-preexec-fn, - apply-builtin, - basestring-builtin, - buffer-builtin, - cmp-builtin, - coerce-builtin, - execfile-builtin, - file-builtin, - long-builtin, - raw_input-builtin, - reduce-builtin, - standarderror-builtin, - unicode-builtin, - xrange-builtin, - coerce-method, - delslice-method, - getslice-method, - setslice-method, - no-absolute-import, - old-division, - dict-iter-method, - dict-view-method, - next-method-called, - metaclass-assignment, - indexing-exception, - raising-string, - reload-builtin, - oct-method, - hex-method, - nonzero-method, - cmp-method, - input-builtin, - round-builtin, - intern-builtin, - unichr-builtin, - map-builtin-not-iterating, - zip-builtin-not-iterating, - range-builtin-not-iterating, - filter-builtin-not-iterating, - using-cmp-argument, - eq-without-hash, - div-method, - idiv-method, - rdiv-method, - exception-message-attribute, - invalid-str-codec, - sys-max-int, - bad-python3-import, - deprecated-string-function, - deprecated-str-translate-call, - deprecated-itertools-function, - deprecated-types-field, - next-method-defined, - dict-items-not-iterating, - dict-keys-not-iterating, - dict-values-not-iterating, - deprecated-operator-function, - deprecated-urllib-function, - xreadlines-attribute, - deprecated-sys-function, - exception-escape, - comprehension-escape - -# 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 -# it should appear only once). See also the "--disable" option for examples. -enable=syntax-error, - unrecognized-inline-option, - bad-option-value, - init-is-generator, - return-in-init, - function-redefined, - not-in-loop, - return-outside-function, - yield-outside-function, - return-arg-in-generator, - nonexistent-operator, - duplicate-argument-name, - abstract-class-instantiated, - bad-reversed-sequence, - too-many-star-expressions, - invalid-star-assignment-target, - star-needs-assignment-target, - nonlocal-and-global, - continue-in-finally, - nonlocal-without-binding, - used-prior-global-declaration, - misplaced-format-function, - method-hidden, - access-member-before-definition, - no-method-argument, - no-self-argument, - invalid-slots-object, - assigning-non-slot, - invalid-slots, - inherit-non-class, - inconsistent-mro, - duplicate-bases, - non-iterator-returned, - unexpected-special-method-signature, - invalid-length-returned, - import-error, - relative-beyond-top-level, - used-before-assignment, - undefined-variable, - undefined-all-variable, - invalid-all-object, - no-name-in-module, - unpacking-non-sequence, - bad-except-order, - raising-bad-type, - bad-exception-context, - misplaced-bare-raise, - raising-non-exception, - notimplemented-raised, - catching-non-exception, - bad-super-call, - missing-super-argument, - no-member, - not-callable, - assignment-from-no-return, - no-value-for-parameter, - too-many-function-args, - unexpected-keyword-arg, - redundant-keyword-arg, - missing-kwoa, - invalid-sequence-index, - invalid-slice-index, - assignment-from-none, - not-context-manager, - invalid-unary-operand-type, - unsupported-binary-operation, - repeated-keyword, - not-an-iterable, - not-a-mapping, - unsupported-membership-test, - unsubscriptable-object, - unsupported-assignment-operation, - unsupported-delete-operation, - invalid-metaclass, - unhashable-dict-key, - logging-unsupported-format, - logging-format-truncated, - logging-too-many-args, - logging-too-few-args, - bad-format-character, - truncated-format-string, - mixed-format-string, - format-needs-mapping, - missing-format-string-key, - too-many-format-args, - too-few-format-args, - bad-string-format-type, - bad-str-strip-call, - invalid-envvar-value, - yield-inside-async-function, - not-async-context-manager, - fatal, - astroid-error, - parse-error, - method-check-failed - - -[REPORTS] - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details. -#msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio). You can also give a reporter class, e.g. -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages. -reports=no - -# Activate the evaluation score. -score=no - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. -never-returning-functions=sys.exit - - -[LOGGING] - -# Format style used to check logging format string. `old` means using % -# formatting, while `new` is for `{}` formatting. -logging-format-style=old - -# Logging modules to check that the string format arguments are in logging -# function parameter format. -logging-modules=logging - - -[SPELLING] - -# Limits count of emitted suggestions for spelling mistakes. -max-spelling-suggestions=4 - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package.. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME, - XXX, - TODO - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# Tells whether to warn about missing members when the owner of the attribute -# is inferred to be None. -ignore-none=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid defining new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_, - _cb - -# A regular expression matching the name of dummy variables (i.e. expected to -# not be used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore. -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=100 - -# 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 - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[SIMILARITIES] - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[BASIC] - -# Naming style matching correct argument names. -argument-naming-style=snake_case - -# Regular expression matching correct argument names. Overrides argument- -# naming-style. -#argument-rgx= - -# Naming style matching correct attribute names. -attr-naming-style=snake_case - -# Regular expression matching correct attribute names. Overrides attr-naming- -# style. -#attr-rgx= - -# Bad variable names which should always be refused, separated by a comma. -bad-names=foo, - bar, - baz, - toto, - tutu, - tata - -# Naming style matching correct class attribute names. -class-attribute-naming-style=any - -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style. -#class-attribute-rgx= - -# Naming style matching correct class names. -class-naming-style=PascalCase - -# Regular expression matching correct class names. Overrides class-naming- -# style. -#class-rgx= - -# Naming style matching correct constant names. -const-naming-style=UPPER_CASE - -# Regular expression matching correct constant names. Overrides const-naming- -# style. -#const-rgx= - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming style matching correct function names. -function-naming-style=snake_case - -# Regular expression matching correct function names. Overrides function- -# naming-style. -#function-rgx= - -# Good variable names which should always be accepted, separated by a comma. -good-names=i, - j, - k, - ex, - Run, - _ - -# Include a hint for the correct naming format with invalid-name. -include-naming-hint=no - -# Naming style matching correct inline iteration names. -inlinevar-naming-style=any - -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style. -#inlinevar-rgx= - -# Naming style matching correct method names. -method-naming-style=snake_case - -# Regular expression matching correct method names. Overrides method-naming- -# style. -#method-rgx= - -# Naming style matching correct module names. -module-naming-style=snake_case - -# Regular expression matching correct module names. Overrides module-naming- -# style. -#module-rgx= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -# These decorators are taken in consideration only for invalid-name. -property-classes=abc.abstractproperty - -# Naming style matching correct variable names. -variable-naming-style=snake_case - -# Regular expression matching correct variable names. Overrides variable- -# naming-style. -#variable-rgx= - - -[IMPORTS] - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Deprecated modules which should not be used, separated by a comma. -deprecated-modules=optparse,tkinter.tix - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled). -ext-import-graph= - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled). -import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled). -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict, - _fields, - _replace, - _source, - _make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=cls - - -[DESIGN] - -# Maximum number of arguments for function / method. -max-args=5 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in an if statement. -max-bool-expr=5 - -# Maximum number of branch for function / method body. -max-branches=12 - -# Maximum number of locals for function / method body. -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body. -max-returns=6 - -# Maximum number of statements in function / method body. -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception". -overgeneral-exceptions=Exception diff --git a/.pylintrc-local.yml b/.pylintrc-local.yml new file mode 100644 index 000000000..32f9604dc --- /dev/null +++ b/.pylintrc-local.yml @@ -0,0 +1,6 @@ +- arg: extension-pkg-whitelist + val: islpy +- arg: ignore + val: compyte +- arg: init-hook + val: sys.setrecursionlimit(5000) -- GitLab