From 414701d9e48cc3b6cb5e2ee2d9e9c04f6d3ecb03 Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Wed, 22 Feb 2023 11:33:12 -0400 Subject: [PATCH 1/5] Switch to pyproject.toml no config changes --- .pylintrc | 416 ------------------------------------------------- pyproject.toml | 117 ++++++++++++++ 2 files changed, 117 insertions(+), 416 deletions(-) delete mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 4baca04b2623..000000000000 --- a/.pylintrc +++ /dev/null @@ -1,416 +0,0 @@ -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins=pylint.extensions.docparams, # enable checking of docstring args - pylint.extensions.docstyle, # basic docstring style checks - -# Use multiple processes to speed up Pylint. -jobs=1 - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - -# 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-allow-list=retworkx, numpy, tweedledum, qiskit._accelerate, rustworkx -generated-members=retworkx.visualization,retwork.visit -ignored-modules=retworkx,retworkx.visualization,retworkx.visit - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# 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=use-symbolic-message-instead - -# 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=spelling, # way too noisy - fixme, # disabled as TODOs would show up as warnings - protected-access, # disabled as we don't follow the public vs private - # convention strictly - duplicate-code, # disabled as it is too verbose - redundant-returns-doc, # for @abstractmethod, it cannot interpret "pass" - # disable the "too-many/few-..." refactoring hints - too-many-lines, too-many-branches, too-many-locals, too-many-nested-blocks, - too-many-statements, too-many-instance-attributes, too-many-arguments, - too-many-public-methods, too-few-public-methods, too-many-ancestors, - unnecessary-pass, # allow for methods with just "pass", for clarity - no-else-return, # relax "elif" after a clause with a return - docstring-first-line-empty, # relax docstring style - import-outside-toplevel, - import-error, # overzealous with our optionals/dynamic packages - - # TODO(#9614): these were added in modern Pylint. Decide if we want to enable them. If so, - # remove from here and fix the issues. Else, move it above this section and add a comment - # with the rationale. - arguments-renamed, - broad-exception-raised, - consider-iterating-dictionary, - consider-using-dict-items, - consider-using-enumerate, - consider-using-f-string, - consider-using-from-import, - modified-iterating-list, - nested-min-max, - no-member, - no-value-for-parameter, - non-ascii-name, - not-context-manager, - pointless-exception-statement, - superfluous-parens, - unknown-option-value, - unexpected-keyword-arg, - unnecessary-dict-index-lookup, - unnecessary-direct-lambda-call, - unnecessary-dunder-call, - unnecessary-ellipsis, - unnecessary-lambda-assignment, - unnecessary-list-index-lookup, - unspecified-encoding, - unsupported-assignment-operation, - use-dict-literal, - use-list-literal, - use-implicit-booleaness-not-comparison, - use-maxsplit-arg, - used-before-assignment, - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages -reports=yes - -# 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= - - -[BASIC] - -# Good variable names which should always be accepted, separated by a comma -# i,j,k = typical indices -# n,m = typical numbers -# ex = for exceptions and errors -# v,w = typical vectors -# x,y,z = typical axes -# _ = placeholder name -# q,r,qr,cr,qc = quantum and classical registers, and quantum circuit -# pi = the PI constant -# op = operation iterator -# b = basis iterator -good-names=a,b,i,j,k,d,n,m,ex,v,w,x,y,z,Run,_,logger,q,c,r,qr,cr,qc,nd,pi,op,b,ar,br,p,cp,dt, - __unittest,iSwapGate,mu - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,toto,tutu,tata - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty - -# Regular expression matching correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression matching correct constant names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression matching correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression matching correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct method names -method-rgx=(([a-z_][a-z0-9_]{2,49})|(assert[A-Z][a-zA-Z0-9]{2,43})|(test_[_a-zA-Z0-9]{2,}))$ - -# Regular expression matching correct attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}|ax|dt$ - -# Regular expression matching correct variable names -variable-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression matching correct class attribute names -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression matching correct inline iteration names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - - -[ELIF] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=105 - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# 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 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - - -[SPELLING] - -# 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=.local-spellings - -# 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 - - -[TYPECHECK] - -# 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 - -# 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= - -# 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,QuantumCircuit - -# 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= - -# 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 - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=(_+[a-zA-Z0-9_]*?$)|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# 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 - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,future.builtins - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# 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=mcs - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict,_fields,_replace,_source,_make - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=8 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=10 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=35 - -# Maximum number of boolean expressions in a if statement -max-bool-expr=5 - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=optparse - -# 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 external dependencies in the given file (report RP0402 must -# not be disabled) -ext-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 - -# 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 - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=builtins.Exception diff --git a/pyproject.toml b/pyproject.toml index 3598f189e129..22fd1227a73d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,3 +22,120 @@ environment = 'RUSTUP_TOOLCHAIN="stable"' [tool.cibuildwheel.linux] before-all = "yum install -y wget && {package}/tools/install_rust.sh" environment = 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true" RUSTUP_TOOLCHAIN="stable"' + +[tool.pylint.main] +extension-pkg-allow-list = ["retworkx", "numpy", "tweedledum", "qiskit._accelerate", "rustworkx"] +load-plugins = ["pylint.extensions.docparams", "pylint.extensions.docstyle"] +ignore-patterns = [] + +[tool.pylint.basic] +argument-rgx = "[a-z_][a-z0-9_]{2,30}|ax|dt$" +attr-rgx = "[a-z_][a-z0-9_]{2,30}$" +bad-names = ["foo", "bar", "toto", "tutu", "tata"] +class-attribute-rgx = "([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$" +class-rgx = "[A-Z_][a-zA-Z0-9]+$" +const-rgx = "(([A-Z_][A-Z0-9_]*)|(__.*__))$" +function-rgx = "[a-z_][a-z0-9_]{2,30}$" +good-names = ["a", "b", "i", "j", "k", "d", "n", "m", "ex", "v", "w", "x", "y", "z", "Run", "_", "logger", "q", "c", "r", "qr", "cr", "qc", "nd", "pi", "op", "b", "ar", "br", "p", "cp", "dt", "__unittest", "iSwapGate", "mu"] +inlinevar-rgx = "[A-Za-z_][A-Za-z0-9_]*$" +method-rgx = "(([a-z_][a-z0-9_]{2,49})|(assert[A-Z][a-zA-Z0-9]{2,43})|(test_[_a-zA-Z0-9]{2,}))$" +module-rgx = "(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$" +variable-rgx = "[a-z_][a-z0-9_]{1,30}$" + +[tool.pylint.classes] +defining-attr-methods = ["__init__", "__new__", "setUp"] # default ["__init__", "__new__", "setUp", "__post_init__"] + +[tool.pylint.design] +max-args = 8 # default 5 +max-attributes = 10 # default 7 +max-public-methods = 35 # default 20 + +[tool.pylint.exceptions] +overgeneral-exceptions = ["builtins.Exception"] # default ["builtins.BaseException", "builtins.Exception"] + +[tool.pylint.format] +max-line-length = 105 # default 100 + +[tool.pylint.imports] +deprecated-modules = ["optparse"] + +[tool.pylint."messages control"] +disable = ["raw-checker-failed", +"bad-inline-option", +"locally-disabled", +"file-ignored", +"suppressed-message", +"useless-suppression", +"deprecated-pragma", +"wrong-spelling-in-comment", +"wrong-spelling-in-docstring", +"invalid-characters-in-docstring", +"fixme", +"protected-access", +"duplicate-code", +"redundant-returns-doc", +"too-many-lines", +"too-many-branches", "too-many-locals", "too-many-nested-blocks", "too-many-statements", "too-many-instance-attributes", +"too-many-arguments", "too-many-public-methods", "too-few-public-methods", "too-many-ancestors", +"unnecessary-pass", +"no-else-return", +"docstring-first-line-empty", +"import-outside-toplevel", +"import-error", +"arguments-renamed", +"broad-exception-raised", +"consider-iterating-dictionary", +"consider-using-dict-items", +"consider-using-enumerate", +"consider-using-f-string", +"consider-using-from-import", +"modified-iterating-list", +"nested-min-max", +"no-member", +"no-value-for-parameter", +"non-ascii-name", +"not-context-manager", +"pointless-exception-statement", +"superfluous-parens", +"unknown-option-value", +"unexpected-keyword-arg", +"unnecessary-dict-index-lookup", +"unnecessary-direct-lambda-call", +"unnecessary-dunder-call", +"unnecessary-ellipsis", +"unnecessary-lambda-assignment", +"unnecessary-list-index-lookup", +"unspecified-encoding", +"unsupported-assignment-operation", +"use-dict-literal", +"use-list-literal", +"use-implicit-booleaness-not-comparison", +"use-maxsplit-arg", +"used-before-assignment"] + +enable = ["use-symbolic-message-instead", "c-extension-no-member"] + +[tool.pylint.parameter_documentation] +accept-no-param-doc = true +accept-no-raise-doc = true +accept-no-return-doc = true +accept-no-yields-doc = true +default-docstring-type = "default" + +[tool.pylint.reports] +evaluation = "10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)" +#default: "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))" +reports = true +ignore-imports = false + +[tool.pylint.spelling] +spelling-private-dict-file = ".local-spellings" + +[tool.pylint.typecheck] +ignored-classes = ["optparse.Values", "thread._local", "_thread._local", "QuantumCircuit"] +# default ["optparse.Values", "thread._local", "_thread._local", "argparse.Namespace"] + +[tool.pylint.variables] +dummy-variables-rgx = "(_+[a-zA-Z0-9_]*?$)|dummy" # default "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_" +ignored-argument-names = "_.*" # default "_.*|^ignored_|^unused_" +redefining-builtins-modules = ["six.moves", "future.builtins"] # default ["six.moves", "past.builtins", "future.builtins", "builtins", "io"] \ No newline at end of file From a793f46b0eea09caae49fdcbc5c9b04b41234c2b Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Wed, 22 Feb 2023 18:28:18 -0400 Subject: [PATCH 2/5] Remove trivial differences from default --- pyproject.toml | 143 ++++++++++----------------- test/python/pulse/test_transforms.py | 16 ++- 2 files changed, 58 insertions(+), 101 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 22fd1227a73d..1f5e87eb1630 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,94 +26,70 @@ environment = 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true" [tool.pylint.main] extension-pkg-allow-list = ["retworkx", "numpy", "tweedledum", "qiskit._accelerate", "rustworkx"] load-plugins = ["pylint.extensions.docparams", "pylint.extensions.docstyle"] -ignore-patterns = [] +py-version = "3.7" # update it when bumping minimum supported python version [tool.pylint.basic] argument-rgx = "[a-z_][a-z0-9_]{2,30}|ax|dt$" -attr-rgx = "[a-z_][a-z0-9_]{2,30}$" -bad-names = ["foo", "bar", "toto", "tutu", "tata"] -class-attribute-rgx = "([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$" -class-rgx = "[A-Z_][a-zA-Z0-9]+$" -const-rgx = "(([A-Z_][A-Z0-9_]*)|(__.*__))$" -function-rgx = "[a-z_][a-z0-9_]{2,30}$" good-names = ["a", "b", "i", "j", "k", "d", "n", "m", "ex", "v", "w", "x", "y", "z", "Run", "_", "logger", "q", "c", "r", "qr", "cr", "qc", "nd", "pi", "op", "b", "ar", "br", "p", "cp", "dt", "__unittest", "iSwapGate", "mu"] -inlinevar-rgx = "[A-Za-z_][A-Za-z0-9_]*$" method-rgx = "(([a-z_][a-z0-9_]{2,49})|(assert[A-Z][a-zA-Z0-9]{2,43})|(test_[_a-zA-Z0-9]{2,}))$" -module-rgx = "(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$" variable-rgx = "[a-z_][a-z0-9_]{1,30}$" -[tool.pylint.classes] -defining-attr-methods = ["__init__", "__new__", "setUp"] # default ["__init__", "__new__", "setUp", "__post_init__"] - -[tool.pylint.design] -max-args = 8 # default 5 -max-attributes = 10 # default 7 -max-public-methods = 35 # default 20 - -[tool.pylint.exceptions] -overgeneral-exceptions = ["builtins.Exception"] # default ["builtins.BaseException", "builtins.Exception"] [tool.pylint.format] max-line-length = 105 # default 100 -[tool.pylint.imports] -deprecated-modules = ["optparse"] - [tool.pylint."messages control"] -disable = ["raw-checker-failed", -"bad-inline-option", -"locally-disabled", -"file-ignored", -"suppressed-message", -"useless-suppression", -"deprecated-pragma", -"wrong-spelling-in-comment", -"wrong-spelling-in-docstring", -"invalid-characters-in-docstring", -"fixme", -"protected-access", -"duplicate-code", -"redundant-returns-doc", -"too-many-lines", -"too-many-branches", "too-many-locals", "too-many-nested-blocks", "too-many-statements", "too-many-instance-attributes", -"too-many-arguments", "too-many-public-methods", "too-few-public-methods", "too-many-ancestors", -"unnecessary-pass", -"no-else-return", -"docstring-first-line-empty", -"import-outside-toplevel", -"import-error", -"arguments-renamed", -"broad-exception-raised", -"consider-iterating-dictionary", -"consider-using-dict-items", -"consider-using-enumerate", -"consider-using-f-string", -"consider-using-from-import", -"modified-iterating-list", -"nested-min-max", -"no-member", -"no-value-for-parameter", -"non-ascii-name", -"not-context-manager", -"pointless-exception-statement", -"superfluous-parens", -"unknown-option-value", -"unexpected-keyword-arg", -"unnecessary-dict-index-lookup", -"unnecessary-direct-lambda-call", -"unnecessary-dunder-call", -"unnecessary-ellipsis", -"unnecessary-lambda-assignment", -"unnecessary-list-index-lookup", -"unspecified-encoding", -"unsupported-assignment-operation", -"use-dict-literal", -"use-list-literal", -"use-implicit-booleaness-not-comparison", -"use-maxsplit-arg", -"used-before-assignment"] - -enable = ["use-symbolic-message-instead", "c-extension-no-member"] +disable = [ +# intentionally disabled: + "spelling", # too noisy + "fixme", # disabled as TODOs would show up as warnings + "protected-access", # disabled as we don't follow the public vs private convention strictly + "duplicate-code", # disabled as it is too verbose + "redundant-returns-doc", # for @abstractmethod, it cannot interpret "pass" + "too-many-lines", "too-many-branches", "too-many-locals", "too-many-nested-blocks", "too-many-statements", + "too-many-instance-attributes", "too-many-arguments", "too-many-public-methods", "too-few-public-methods", "too-many-ancestors", + "unnecessary-pass", # allow for methods with just "pass", for clarity + "no-else-return", # relax "elif" after a clause with a return + "docstring-first-line-empty", # relax docstring style + "import-outside-toplevel", "import-error", # overzealous with our optionals/dynamic packages +# TODO(#9614): these were added in modern Pylint. Decide if we want to enable them. If so, +# remove from here and fix the issues. Else, move it above this section and add a comment +# with the rationale + "arguments-renamed", + "broad-exception-raised", + "consider-iterating-dictionary", + "consider-using-dict-items", + "consider-using-enumerate", + "consider-using-f-string", + "consider-using-from-import", + "modified-iterating-list", + "nested-min-max", + "no-member", + "no-value-for-parameter", + "non-ascii-name", + "not-context-manager", + "pointless-exception-statement", + "superfluous-parens", + "unknown-option-value", + "unexpected-keyword-arg", + "unnecessary-dict-index-lookup", + "unnecessary-direct-lambda-call", + "unnecessary-dunder-call", + "unnecessary-ellipsis", + "unnecessary-lambda-assignment", + "unnecessary-list-index-lookup", + "unspecified-encoding", + "unsupported-assignment-operation", + "use-dict-literal", + "use-list-literal", + "use-implicit-booleaness-not-comparison", + "use-maxsplit-arg", + "used-before-assignment", +] + +enable = [ + "use-symbolic-message-instead", + "c-extension-no-member"] [tool.pylint.parameter_documentation] accept-no-param-doc = true @@ -122,20 +98,5 @@ accept-no-return-doc = true accept-no-yields-doc = true default-docstring-type = "default" -[tool.pylint.reports] -evaluation = "10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)" -#default: "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))" -reports = true -ignore-imports = false - [tool.pylint.spelling] spelling-private-dict-file = ".local-spellings" - -[tool.pylint.typecheck] -ignored-classes = ["optparse.Values", "thread._local", "_thread._local", "QuantumCircuit"] -# default ["optparse.Values", "thread._local", "_thread._local", "argparse.Namespace"] - -[tool.pylint.variables] -dummy-variables-rgx = "(_+[a-zA-Z0-9_]*?$)|dummy" # default "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_" -ignored-argument-names = "_.*" # default "_.*|^ignored_|^unused_" -redefining-builtins-modules = ["six.moves", "future.builtins"] # default ["six.moves", "past.builtins", "future.builtins", "builtins", "io"] \ No newline at end of file diff --git a/test/python/pulse/test_transforms.py b/test/python/pulse/test_transforms.py index ce968e04e31b..1f41f3d7fbf5 100644 --- a/test/python/pulse/test_transforms.py +++ b/test/python/pulse/test_transforms.py @@ -267,13 +267,11 @@ def test_padding_schedule(self): ) ref_sched = ( - sched + sched # pylint: disable=unsupported-binary-operation | Delay(delay, DriveChannel(0)) | Delay(delay, DriveChannel(0)).shift(20) | Delay(delay, DriveChannel(1)) - | Delay( # pylint: disable=unsupported-binary-operation - 2 * delay, DriveChannel(1) - ).shift(20) + | Delay(2 * delay, DriveChannel(1)).shift(20) ) self.assertEqual(transforms.pad(sched), ref_sched) @@ -292,13 +290,11 @@ def test_padding_schedule_inverse_order(self): ) ref_sched = ( - sched + sched # pylint: disable=unsupported-binary-operation | Delay(delay, DriveChannel(0)) | Delay(delay, DriveChannel(0)).shift(20) | Delay(delay, DriveChannel(1)) - | Delay( # pylint: disable=unsupported-binary-operation - 2 * delay, DriveChannel(1) - ).shift(20) + | Delay(2 * delay, DriveChannel(1)).shift(20) ) self.assertEqual(transforms.pad(sched), ref_sched) @@ -320,10 +316,10 @@ def test_padding_until_greater(self): sched = Delay(delay, DriveChannel(0)).shift(10) + Delay(delay, DriveChannel(1)) ref_sched = ( - sched + sched # pylint: disable=unsupported-binary-operation | Delay(delay, DriveChannel(0)) | Delay(30, DriveChannel(0)).shift(20) - | Delay(40, DriveChannel(1)).shift(10) # pylint: disable=unsupported-binary-operation + | Delay(40, DriveChannel(1)).shift(10) ) self.assertEqual(transforms.pad(sched, until=50), ref_sched) From 01cea79ef19027ad99444496f712df19bcdaea95 Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:46:24 -0500 Subject: [PATCH 3/5] Fall back to a few additional defaults --- pyproject.toml | 15 ++------- test/python/pulse/test_transforms.py | 10 ++++-- .../transpiler/test_collect_2q_blocks.py | 32 +++++++++---------- 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1f5e87eb1630..ec54165cf952 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,12 +29,10 @@ load-plugins = ["pylint.extensions.docparams", "pylint.extensions.docstyle"] py-version = "3.7" # update it when bumping minimum supported python version [tool.pylint.basic] -argument-rgx = "[a-z_][a-z0-9_]{2,30}|ax|dt$" -good-names = ["a", "b", "i", "j", "k", "d", "n", "m", "ex", "v", "w", "x", "y", "z", "Run", "_", "logger", "q", "c", "r", "qr", "cr", "qc", "nd", "pi", "op", "b", "ar", "br", "p", "cp", "dt", "__unittest", "iSwapGate", "mu"] +good-names = ["a", "b", "i", "j", "k", "d", "n", "m", "ex", "v", "w", "x", "y", "z", "Run", "_", "logger", "q", "c", "r", "qr", "cr", "qc", "nd", "pi", "op", "b", "ar", "br", "p", "cp", "ax", "dt", "__unittest", "iSwapGate", "mu"] method-rgx = "(([a-z_][a-z0-9_]{2,49})|(assert[A-Z][a-zA-Z0-9]{2,43})|(test_[_a-zA-Z0-9]{2,}))$" variable-rgx = "[a-z_][a-z0-9_]{1,30}$" - [tool.pylint.format] max-line-length = 105 # default 100 @@ -88,15 +86,8 @@ disable = [ ] enable = [ - "use-symbolic-message-instead", - "c-extension-no-member"] - -[tool.pylint.parameter_documentation] -accept-no-param-doc = true -accept-no-raise-doc = true -accept-no-return-doc = true -accept-no-yields-doc = true -default-docstring-type = "default" + "use-symbolic-message-instead" +] [tool.pylint.spelling] spelling-private-dict-file = ".local-spellings" diff --git a/test/python/pulse/test_transforms.py b/test/python/pulse/test_transforms.py index 1f41f3d7fbf5..50d6cbd94498 100644 --- a/test/python/pulse/test_transforms.py +++ b/test/python/pulse/test_transforms.py @@ -271,7 +271,9 @@ def test_padding_schedule(self): | Delay(delay, DriveChannel(0)) | Delay(delay, DriveChannel(0)).shift(20) | Delay(delay, DriveChannel(1)) - | Delay(2 * delay, DriveChannel(1)).shift(20) + | Delay( # pylint: disable=unsupported-binary-operation + 2 * delay, DriveChannel(1) + ).shift(20) ) self.assertEqual(transforms.pad(sched), ref_sched) @@ -294,7 +296,9 @@ def test_padding_schedule_inverse_order(self): | Delay(delay, DriveChannel(0)) | Delay(delay, DriveChannel(0)).shift(20) | Delay(delay, DriveChannel(1)) - | Delay(2 * delay, DriveChannel(1)).shift(20) + | Delay( # pylint: disable=unsupported-binary-operation + 2 * delay, DriveChannel(1) + ).shift(20) ) self.assertEqual(transforms.pad(sched), ref_sched) @@ -319,7 +323,7 @@ def test_padding_until_greater(self): sched # pylint: disable=unsupported-binary-operation | Delay(delay, DriveChannel(0)) | Delay(30, DriveChannel(0)).shift(20) - | Delay(40, DriveChannel(1)).shift(10) + | Delay(40, DriveChannel(1)).shift(10) # pylint: disable=unsupported-binary-operation ) self.assertEqual(transforms.pad(sched, until=50), ref_sched) diff --git a/test/python/transpiler/test_collect_2q_blocks.py b/test/python/transpiler/test_collect_2q_blocks.py index 1c141ec42b66..aa412e73f07b 100644 --- a/test/python/transpiler/test_collect_2q_blocks.py +++ b/test/python/transpiler/test_collect_2q_blocks.py @@ -153,31 +153,31 @@ def test_do_not_merge_conditioned_gates(self): Gate("custom1qgate2", 1, []), ), ) - def test_collect_arbitrary_gates(self, twoQ_gate, oneQ_gate1, oneQ_gate2): + def test_collect_arbitrary_gates(self, twoq_gate, oneq_gate1, oneq_gate2): """Validate we can collect blocks irrespective of gate types in the circuit.""" qc = QuantumCircuit(3) # Block 1 - q[0] and q[1] - qc.append(oneQ_gate1, [0]) - qc.append(oneQ_gate2, [1]) - qc.append(twoQ_gate, [0, 1]) - qc.append(oneQ_gate1, [0]) - qc.append(oneQ_gate2, [1]) + qc.append(oneq_gate1, [0]) + qc.append(oneq_gate2, [1]) + qc.append(twoq_gate, [0, 1]) + qc.append(oneq_gate1, [0]) + qc.append(oneq_gate2, [1]) # Block 2 - q[1] and q[2] - qc.append(oneQ_gate1, [1]) - qc.append(oneQ_gate2, [2]) - qc.append(twoQ_gate, [1, 2]) - qc.append(oneQ_gate1, [1]) - qc.append(oneQ_gate2, [2]) + qc.append(oneq_gate1, [1]) + qc.append(oneq_gate2, [2]) + qc.append(twoq_gate, [1, 2]) + qc.append(oneq_gate1, [1]) + qc.append(oneq_gate2, [2]) # Block 3 - q[0] and q[1] - qc.append(oneQ_gate1, [0]) - qc.append(oneQ_gate2, [1]) - qc.append(twoQ_gate, [0, 1]) - qc.append(oneQ_gate1, [0]) - qc.append(oneQ_gate2, [1]) + qc.append(oneq_gate1, [0]) + qc.append(oneq_gate2, [1]) + qc.append(twoq_gate, [0, 1]) + qc.append(oneq_gate1, [0]) + qc.append(oneq_gate2, [1]) pass_manager = PassManager() pass_manager.append(Collect2qBlocks()) From 6947f0974c7dee5ff1bdb19c770ca66fd4c91810 Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Wed, 1 Mar 2023 08:19:46 -0500 Subject: [PATCH 4/5] Remove useless pylint suppressions --- qiskit/algorithms/amplitude_estimators/ae.py | 2 +- .../amplitude_estimators/estimation_problem.py | 1 - qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py | 3 --- qiskit/algorithms/eigensolvers/numpy_eigensolver.py | 1 - qiskit/algorithms/eigensolvers/vqd.py | 2 +- .../gradients/finite_diff_estimator_gradient.py | 1 - .../algorithms/gradients/finite_diff_sampler_gradient.py | 2 +- qiskit/algorithms/gradients/utils.py | 2 -- qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py | 1 - qiskit/algorithms/optimizers/adam_amsgrad.py | 1 - qiskit/algorithms/optimizers/optimizer.py | 4 ++-- qiskit/algorithms/optimizers/scipy_optimizer.py | 1 - qiskit/algorithms/optimizers/steppable_optimizer.py | 2 +- qiskit/algorithms/phase_estimators/phase_estimation.py | 1 - qiskit/assembler/assemble_schedules.py | 1 - qiskit/circuit/classicalfunction/boolean_expression.py | 2 +- qiskit/circuit/controlflow/if_else.py | 2 +- qiskit/circuit/equivalence.py | 2 +- qiskit/circuit/gate.py | 1 - qiskit/circuit/library/generalized_gates/diagonal.py | 2 -- qiskit/compiler/transpiler.py | 4 ++-- qiskit/dagcircuit/dagnode.py | 1 - qiskit/extensions/quantum_initializer/isometry.py | 1 - qiskit/opflow/converters/circuit_sampler.py | 1 - qiskit/opflow/evolutions/evolved_op.py | 1 - .../gradients/circuit_gradients/circuit_gradient.py | 1 - qiskit/opflow/gradients/circuit_gradients/lin_comb.py | 2 +- qiskit/opflow/gradients/circuit_qfis/lin_comb_full.py | 1 - qiskit/opflow/gradients/derivative_base.py | 1 - qiskit/opflow/list_ops/list_op.py | 7 +++---- qiskit/opflow/operator_base.py | 2 -- qiskit/opflow/primitive_ops/pauli_sum_op.py | 1 - qiskit/opflow/state_fns/circuit_state_fn.py | 2 +- qiskit/primitives/backend_estimator.py | 3 +-- qiskit/primitives/backend_sampler.py | 2 +- qiskit/providers/basicaer/basicaerjob.py | 1 - qiskit/providers/basicaer/basicaerprovider.py | 1 - qiskit/providers/basicaer/qasm_simulator.py | 2 -- qiskit/providers/basicaer/unitary_simulator.py | 2 -- qiskit/providers/fake_provider/fake_backend_v2.py | 1 - qiskit/providers/fake_provider/fake_job.py | 3 +-- qiskit/providers/fake_provider/fake_mumbai_v2.py | 1 - qiskit/pulse/builder.py | 6 +++--- qiskit/pulse/instructions/call.py | 1 - qiskit/pulse/instructions/instruction.py | 2 +- qiskit/pulse/library/continuous.py | 2 +- qiskit/pulse/library/discrete.py | 1 - qiskit/pulse/library/pulse.py | 2 +- qiskit/pulse/library/samplers/decorators.py | 2 -- qiskit/pulse/library/samplers/strategies.py | 1 - qiskit/pulse/schedule.py | 4 ++-- qiskit/qobj/converters/pulse_instruction.py | 2 +- qiskit/qpy/binary_io/schedules.py | 2 -- qiskit/qpy/common.py | 1 - qiskit/quantum_info/operators/pauli.py | 2 -- qiskit/quantum_info/operators/symplectic/base_pauli.py | 1 - qiskit/quantum_info/operators/symplectic/clifford.py | 2 -- qiskit/quantum_info/operators/symplectic/pauli.py | 2 -- qiskit/quantum_info/operators/symplectic/pauli_list.py | 1 - .../operators/symplectic/stabilizer_table.py | 1 - qiskit/result/utils.py | 1 - qiskit/synthesis/clifford/clifford_decompose_ag.py | 1 - qiskit/synthesis/discrete_basis/commutator_decompose.py | 2 +- qiskit/test/base.py | 4 +--- qiskit/transpiler/coupling.py | 2 +- qiskit/transpiler/passes/basis/basis_translator.py | 9 ++++----- qiskit/transpiler/passes/calibration/rzx_builder.py | 2 +- qiskit/transpiler/passes/layout/vf2_layout.py | 1 - qiskit/transpiler/passes/layout/vf2_post_layout.py | 1 - qiskit/transpiler/passes/optimization/hoare_opt.py | 2 +- qiskit/transpiler/preset_passmanagers/common.py | 1 - qiskit/utils/measurement_error_mitigation.py | 2 -- qiskit/utils/quantum_instance.py | 8 ++++---- qiskit/visualization/dag_visualization.py | 2 +- qiskit/visualization/pass_manager_visualization.py | 4 ++-- qiskit/visualization/pulse_v2/interface.py | 2 -- qiskit/visualization/pulse_v2/plotters/matplotlib.py | 2 -- qiskit/visualization/timeline/interface.py | 2 -- test/python/algorithms/minimum_eigensolvers/test_qaoa.py | 4 ++-- .../algorithms/minimum_eigensolvers/test_sampling_vqe.py | 2 +- test/python/algorithms/optimizers/test_spsa.py | 1 - test/python/algorithms/test_grover.py | 1 - test/python/circuit/test_circuit_load_from_qpy.py | 2 +- test/python/circuit/test_parameters.py | 2 +- test/python/circuit/test_unitary.py | 2 +- test/python/providers/test_options.py | 4 ++-- test/python/pulse/test_pulse_lib.py | 2 +- test/python/qpy/test_block_load_from_qpy.py | 1 - test/python/transpiler/test_calibrationbuilder.py | 2 +- test/python/transpiler/test_passmanager.py | 4 ++-- test/python/transpiler/test_unitary_synthesis_plugin.py | 4 ++-- test/python/utils/test_lazy_loaders.py | 2 -- test/python/visualization/test_circuit_latex.py | 1 - 93 files changed, 58 insertions(+), 134 deletions(-) diff --git a/qiskit/algorithms/amplitude_estimators/ae.py b/qiskit/algorithms/amplitude_estimators/ae.py index f79419706cd4..90dcd691fe4d 100644 --- a/qiskit/algorithms/amplitude_estimators/ae.py +++ b/qiskit/algorithms/amplitude_estimators/ae.py @@ -98,7 +98,7 @@ def __init__( self.quantum_instance = quantum_instance # get parameters - self._m = num_eval_qubits # pylint: disable=invalid-name + self._m = num_eval_qubits self._M = 2**num_eval_qubits # pylint: disable=invalid-name self._iqft = iqft diff --git a/qiskit/algorithms/amplitude_estimators/estimation_problem.py b/qiskit/algorithms/amplitude_estimators/estimation_problem.py index d38c3c0e2f3c..93b02991af2b 100644 --- a/qiskit/algorithms/amplitude_estimators/estimation_problem.py +++ b/qiskit/algorithms/amplitude_estimators/estimation_problem.py @@ -201,7 +201,6 @@ def rescale(self, scaling_factor: float) -> "EstimationProblem": # add the scaling qubit to the good state qualifier def is_good_state(bitstr): - # pylint: disable=not-callable return self.is_good_state(bitstr[1:]) and bitstr[0] == "1" # rescaled estimation problem diff --git a/qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py b/qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py index 77078dd6fbbc..32e1e22e8def 100755 --- a/qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py +++ b/qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py @@ -28,9 +28,6 @@ logger = logging.getLogger(__name__) -# pylint: disable=invalid-name - - class NumPyEigensolver(Eigensolver): r""" Pending deprecation: NumPy Eigensolver algorithm. diff --git a/qiskit/algorithms/eigensolvers/numpy_eigensolver.py b/qiskit/algorithms/eigensolvers/numpy_eigensolver.py index 41af1708ae07..c09f4bc911ed 100755 --- a/qiskit/algorithms/eigensolvers/numpy_eigensolver.py +++ b/qiskit/algorithms/eigensolvers/numpy_eigensolver.py @@ -29,7 +29,6 @@ from ..list_or_dict import ListOrDict logger = logging.getLogger(__name__) -# pylint: disable=invalid-name FilterType = Callable[[Union[List, np.ndarray], float, Optional[ListOrDict[float]]], bool] diff --git a/qiskit/algorithms/eigensolvers/vqd.py b/qiskit/algorithms/eigensolvers/vqd.py index 4fc692bc79b8..544d40234053 100644 --- a/qiskit/algorithms/eigensolvers/vqd.py +++ b/qiskit/algorithms/eigensolvers/vqd.py @@ -265,7 +265,7 @@ def compute_eigenvalues( # TODO: add gradient support after FidelityGradients are implemented if callable(self.optimizer): - opt_result = self.optimizer( # pylint: disable=not-callable + opt_result = self.optimizer( fun=energy_evaluation, x0=initial_point, bounds=bounds ) else: diff --git a/qiskit/algorithms/gradients/finite_diff_estimator_gradient.py b/qiskit/algorithms/gradients/finite_diff_estimator_gradient.py index 4b35d4ef889d..40ba2f6563bb 100644 --- a/qiskit/algorithms/gradients/finite_diff_estimator_gradient.py +++ b/qiskit/algorithms/gradients/finite_diff_estimator_gradient.py @@ -31,7 +31,6 @@ from ..exceptions import AlgorithmError if sys.version_info >= (3, 8): - # pylint: disable=no-name-in-module, ungrouped-imports from typing import Literal else: from typing_extensions import Literal diff --git a/qiskit/algorithms/gradients/finite_diff_sampler_gradient.py b/qiskit/algorithms/gradients/finite_diff_sampler_gradient.py index 3cec0e8efeb1..0bec48fbe263 100644 --- a/qiskit/algorithms/gradients/finite_diff_sampler_gradient.py +++ b/qiskit/algorithms/gradients/finite_diff_sampler_gradient.py @@ -30,7 +30,7 @@ from ..exceptions import AlgorithmError if sys.version_info >= (3, 8): - # pylint: disable=no-name-in-module, ungrouped-imports + # pylint: disable=ungrouped-imports from typing import Literal else: from typing_extensions import Literal diff --git a/qiskit/algorithms/gradients/utils.py b/qiskit/algorithms/gradients/utils.py index 5fd8abd410c9..02191fb22536 100644 --- a/qiskit/algorithms/gradients/utils.py +++ b/qiskit/algorithms/gradients/utils.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=invalid-name - """ Utility functions for gradients """ diff --git a/qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py b/qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py index 684252f54e4f..832abdca7998 100755 --- a/qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py +++ b/qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py @@ -210,7 +210,6 @@ def compute_minimum_eigenvalue( start_time = time() if callable(self.optimizer): - # pylint: disable=not-callable optimizer_result = self.optimizer(fun=evaluate_energy, x0=initial_point, bounds=bounds) else: # we always want to submit as many estimations per job as possible for minimal diff --git a/qiskit/algorithms/optimizers/adam_amsgrad.py b/qiskit/algorithms/optimizers/adam_amsgrad.py index ee305e00f446..3d4bba14d230 100644 --- a/qiskit/algorithms/optimizers/adam_amsgrad.py +++ b/qiskit/algorithms/optimizers/adam_amsgrad.py @@ -200,7 +200,6 @@ def load_params(self, load_dir: str) -> None: "gradient_function": "jac", } ) - # pylint: disable=arguments-differ def minimize( self, fun: Callable[[POINT], float], diff --git a/qiskit/algorithms/optimizers/optimizer.py b/qiskit/algorithms/optimizers/optimizer.py index 3ade5b08fb3a..c9201bd8d499 100644 --- a/qiskit/algorithms/optimizers/optimizer.py +++ b/qiskit/algorithms/optimizers/optimizer.py @@ -26,7 +26,7 @@ from qiskit.algorithms.algorithm_result import AlgorithmResult if sys.version_info >= (3, 8): - # pylint: disable=no-name-in-module, ungrouped-imports + # pylint: disable=ungrouped-imports from typing import Protocol else: from typing_extensions import Protocol @@ -41,7 +41,7 @@ class OptimizerResult(AlgorithmResult): def __init__(self) -> None: super().__init__() - self._x = None # pylint: disable=invalid-name + self._x = None self._fun = None self._jac = None self._nfev = None diff --git a/qiskit/algorithms/optimizers/scipy_optimizer.py b/qiskit/algorithms/optimizers/scipy_optimizer.py index 3d6bad2f5ee3..b9bde78f8588 100644 --- a/qiskit/algorithms/optimizers/scipy_optimizer.py +++ b/qiskit/algorithms/optimizers/scipy_optimizer.py @@ -58,7 +58,6 @@ def __init__( kwargs: additional kwargs for scipy.optimize.minimize. max_evals_grouped: Max number of default gradient evaluations performed simultaneously. """ - # pylint: disable=super-init-not-called self._method = method.lower() if isinstance(method, str) else method # Set support level if self._method in self._bounds_support_methods: diff --git a/qiskit/algorithms/optimizers/steppable_optimizer.py b/qiskit/algorithms/optimizers/steppable_optimizer.py index 928777133026..2330d65df01a 100644 --- a/qiskit/algorithms/optimizers/steppable_optimizer.py +++ b/qiskit/algorithms/optimizers/steppable_optimizer.py @@ -59,7 +59,7 @@ class OptimizerState: """ - x: POINT # pylint: disable=invalid-name + x: POINT """Current optimization parameters.""" fun: Optional[Callable[[POINT], float]] """Function being optimized.""" diff --git a/qiskit/algorithms/phase_estimators/phase_estimation.py b/qiskit/algorithms/phase_estimators/phase_estimation.py index bf18efcdcf95..83b446e7202f 100644 --- a/qiskit/algorithms/phase_estimators/phase_estimation.py +++ b/qiskit/algorithms/phase_estimators/phase_estimation.py @@ -243,7 +243,6 @@ def estimate_from_pe_circuit( self._num_evaluation_qubits, circuit_result=circuit_result, phases=phases ) - # pylint: disable=missing-param-doc def estimate( self, unitary: QuantumCircuit, diff --git a/qiskit/assembler/assemble_schedules.py b/qiskit/assembler/assemble_schedules.py index fb89e0051d85..6ddf4c140d56 100644 --- a/qiskit/assembler/assemble_schedules.py +++ b/qiskit/assembler/assemble_schedules.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=unused-import """Assemble function for converting a list of circuits into a qobj.""" import hashlib diff --git a/qiskit/circuit/classicalfunction/boolean_expression.py b/qiskit/circuit/classicalfunction/boolean_expression.py index 7a66f2a202bc..79e7ede087fd 100644 --- a/qiskit/circuit/classicalfunction/boolean_expression.py +++ b/qiskit/circuit/classicalfunction/boolean_expression.py @@ -116,7 +116,7 @@ def from_dimacs_file(cls, filename: str): expr_obj._tweedledum_bool_expression.num_inputs() + expr_obj._tweedledum_bool_expression.num_outputs() ) - super(BooleanExpression, expr_obj).__init__( # pylint: disable=no-value-for-parameter + super(BooleanExpression, expr_obj).__init__( name=basename(filename), num_qubits=num_qubits, params=[] ) return expr_obj diff --git a/qiskit/circuit/controlflow/if_else.py b/qiskit/circuit/controlflow/if_else.py index 502ff6d3dbf4..2a207565c684 100644 --- a/qiskit/circuit/controlflow/if_else.py +++ b/qiskit/circuit/controlflow/if_else.py @@ -555,7 +555,7 @@ def _unify_circuit_resources( return _unify_circuit_registers(true_body, false_body) -def _unify_circuit_resources_rebuild( # pylint: disable=invalid-name # (it's too long?!) +def _unify_circuit_resources_rebuild( true_body: QuantumCircuit, false_body: QuantumCircuit ) -> Tuple[QuantumCircuit, QuantumCircuit]: """ diff --git a/qiskit/circuit/equivalence.py b/qiskit/circuit/equivalence.py index bd4711614bbd..3168e137f41c 100644 --- a/qiskit/circuit/equivalence.py +++ b/qiskit/circuit/equivalence.py @@ -15,7 +15,7 @@ import copy from collections import namedtuple -from rustworkx.visualization import graphviz_draw # pylint: disable=no-name-in-module +from rustworkx.visualization import graphviz_draw import rustworkx as rx from qiskit.exceptions import InvalidFileError diff --git a/qiskit/circuit/gate.py b/qiskit/circuit/gate.py index 8ba620d8344d..b7eb43fef0f1 100644 --- a/qiskit/circuit/gate.py +++ b/qiskit/circuit/gate.py @@ -51,7 +51,6 @@ def to_matrix(self) -> np.ndarray: exception will be raised when this base class method is called. """ if hasattr(self, "__array__"): - # pylint: disable=no-member return self.__array__(dtype=complex) raise CircuitError(f"to_matrix not defined for this {type(self)}") diff --git a/qiskit/circuit/library/generalized_gates/diagonal.py b/qiskit/circuit/library/generalized_gates/diagonal.py index 99e5662230af..f31720260671 100644 --- a/qiskit/circuit/library/generalized_gates/diagonal.py +++ b/qiskit/circuit/library/generalized_gates/diagonal.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=no-member - """Diagonal matrix circuit.""" diff --git a/qiskit/compiler/transpiler.py b/qiskit/compiler/transpiler.py index 4d82214a5e03..eca13cde7bd1 100644 --- a/qiskit/compiler/transpiler.py +++ b/qiskit/compiler/transpiler.py @@ -50,8 +50,8 @@ from qiskit.transpiler.target import Target, target_to_backend_properties if sys.version_info >= (3, 8): - from multiprocessing.shared_memory import SharedMemory # pylint: disable=no-name-in-module - from multiprocessing.managers import SharedMemoryManager # pylint: disable=no-name-in-module + from multiprocessing.shared_memory import SharedMemory + from multiprocessing.managers import SharedMemoryManager else: from shared_memory import SharedMemory, SharedMemoryManager diff --git a/qiskit/dagcircuit/dagnode.py b/qiskit/dagcircuit/dagnode.py index 85485ca41f62..022c57fa4aff 100644 --- a/qiskit/dagcircuit/dagnode.py +++ b/qiskit/dagcircuit/dagnode.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=redefined-builtin """Objects to represent the information at a node in the DAGCircuit.""" diff --git a/qiskit/extensions/quantum_initializer/isometry.py b/qiskit/extensions/quantum_initializer/isometry.py index 5d17398ab3a3..611413e9f56f 100644 --- a/qiskit/extensions/quantum_initializer/isometry.py +++ b/qiskit/extensions/quantum_initializer/isometry.py @@ -14,7 +14,6 @@ # pylint: disable=unused-variable # pylint: disable=missing-param-doc # pylint: disable=missing-type-doc -# pylint: disable=no-member """ Generic isometries from m to n qubits. diff --git a/qiskit/opflow/converters/circuit_sampler.py b/qiskit/opflow/converters/circuit_sampler.py index e2376ac610ce..76b06ee5df81 100644 --- a/qiskit/opflow/converters/circuit_sampler.py +++ b/qiskit/opflow/converters/circuit_sampler.py @@ -138,7 +138,6 @@ def quantum_instance(self, quantum_instance: Union[QuantumInstance, Backend]) -> self._quantum_instance = quantum_instance self._check_quantum_instance_and_modes_consistent() - # pylint: disable=arguments-differ def convert( self, operator: OperatorBase, diff --git a/qiskit/opflow/evolutions/evolved_op.py b/qiskit/opflow/evolutions/evolved_op.py index e4427e858ec4..2ea66d998900 100644 --- a/qiskit/opflow/evolutions/evolved_op.py +++ b/qiskit/opflow/evolutions/evolved_op.py @@ -167,7 +167,6 @@ def to_matrix_op(self, massive: bool = False) -> Union[ListOp, MatrixOp]: def log_i(self, massive: bool = False) -> OperatorBase: return self.primitive * self.coeff - # pylint: disable=arguments-differ def to_instruction(self, massive: bool = False) -> Instruction: mat_op = self.to_matrix_op(massive=massive) if not isinstance(mat_op, MatrixOp): diff --git a/qiskit/opflow/gradients/circuit_gradients/circuit_gradient.py b/qiskit/opflow/gradients/circuit_gradients/circuit_gradient.py index 1b5a303cb0b6..5ab4864ad2ac 100644 --- a/qiskit/opflow/gradients/circuit_gradients/circuit_gradient.py +++ b/qiskit/opflow/gradients/circuit_gradients/circuit_gradient.py @@ -35,7 +35,6 @@ class CircuitGradient(ConverterBase): DerivativeBase - uses classical techniques to differentiate operator flow data structures """ - # pylint: disable=arguments-differ @abstractmethod def convert( self, diff --git a/qiskit/opflow/gradients/circuit_gradients/lin_comb.py b/qiskit/opflow/gradients/circuit_gradients/lin_comb.py index 366fb59fd497..4db33fffb761 100644 --- a/qiskit/opflow/gradients/circuit_gradients/lin_comb.py +++ b/qiskit/opflow/gradients/circuit_gradients/lin_comb.py @@ -99,7 +99,7 @@ class LinComb(CircuitGradient): "z", } - # pylint: disable=signature-differs, arguments-differ + # pylint: disable=signature-differs def __init__(self, aux_meas_op: OperatorBase = Z): """ Args: diff --git a/qiskit/opflow/gradients/circuit_qfis/lin_comb_full.py b/qiskit/opflow/gradients/circuit_qfis/lin_comb_full.py index 81865180881f..81f00eb5cfc0 100644 --- a/qiskit/opflow/gradients/circuit_qfis/lin_comb_full.py +++ b/qiskit/opflow/gradients/circuit_qfis/lin_comb_full.py @@ -35,7 +35,6 @@ class LinCombFull(CircuitQFI): See also :class:`~qiskit.opflow.QFI`. """ - # pylint: disable=signature-differs, arguments-differ def __init__( self, aux_meas_op: OperatorBase = Z, diff --git a/qiskit/opflow/gradients/derivative_base.py b/qiskit/opflow/gradients/derivative_base.py index 1e1b3fadb5b7..4d50d22bd228 100644 --- a/qiskit/opflow/gradients/derivative_base.py +++ b/qiskit/opflow/gradients/derivative_base.py @@ -48,7 +48,6 @@ class DerivativeBase(ConverterBase): DerivativeBase - uses classical techniques to differentiate opflow data structures """ - # pylint: disable=arguments-differ @abstractmethod def convert( self, diff --git a/qiskit/opflow/list_ops/list_op.py b/qiskit/opflow/list_ops/list_op.py index 8a3d9fecb026..32acaed8ce9c 100644 --- a/qiskit/opflow/list_ops/list_op.py +++ b/qiskit/opflow/list_ops/list_op.py @@ -359,7 +359,7 @@ def to_matrix(self, massive: bool = False) -> np.ndarray: # Note: this can end up, when we have list operators containing other list operators, as a # ragged array and numpy 1.19 raises a deprecation warning unless this is explicitly # done as object type now - was implicit before. - mat = self.combo_fn( # pylint: disable=not-callable + mat = self.combo_fn( np.asarray( [op.to_matrix(massive=massive) * self.coeff for op in self.oplist], dtype=object ) @@ -374,7 +374,6 @@ def to_spmatrix(self) -> Union[spmatrix, List[spmatrix]]: """ # Combination function must be able to handle classical values - # pylint: disable=not-callable return self.combo_fn([op.to_spmatrix() for op in self.oplist]) * self.coeff def eval( @@ -441,7 +440,7 @@ def eval( "Combo_fn not yet supported for mixed measurement " "and non-measurement StateFns" ) - result = self.combo_fn(evals) # pylint: disable=not-callable + result = self.combo_fn(evals) if isinstance(result, list): multiplied = self.coeff * np.array(result) return multiplied.tolist() @@ -452,7 +451,7 @@ def eval( elif any(isinstance(op, OperatorBase) for op in evals): raise TypeError("Cannot handle mixed scalar and Operator eval results.") else: - result = self.combo_fn(evals) # pylint: disable=not-callable + result = self.combo_fn(evals) if isinstance(result, list): multiplied = self.coeff * np.array(result) return multiplied.tolist() diff --git a/qiskit/opflow/operator_base.py b/qiskit/opflow/operator_base.py index 719a8fe99f5a..055f575fa75a 100644 --- a/qiskit/opflow/operator_base.py +++ b/qiskit/opflow/operator_base.py @@ -259,7 +259,6 @@ def equals(self, other: "OperatorBase") -> bool: # Scalar Multiplication - # pylint: disable=arguments-differ @abstractmethod def mul(self, scalar: Union[complex, ParameterExpression]) -> "OperatorBase": r""" @@ -446,7 +445,6 @@ def copy(self) -> "OperatorBase": # Composition - # pylint: disable=arguments-differ @abstractmethod def compose( self, other: "OperatorBase", permutation: Optional[List[int]] = None, front: bool = False diff --git a/qiskit/opflow/primitive_ops/pauli_sum_op.py b/qiskit/opflow/primitive_ops/pauli_sum_op.py index 894554341321..47e8fc772036 100644 --- a/qiskit/opflow/primitive_ops/pauli_sum_op.py +++ b/qiskit/opflow/primitive_ops/pauli_sum_op.py @@ -401,7 +401,6 @@ def __len__(self) -> int: """ return len(self.primitive) - # pylint: disable=arguments-differ def reduce(self, atol: Optional[float] = None, rtol: Optional[float] = None) -> "PauliSumOp": """Simplify the primitive ``SparsePauliOp``. diff --git a/qiskit/opflow/state_fns/circuit_state_fn.py b/qiskit/opflow/state_fns/circuit_state_fn.py index 7d5b3a2957de..6e5319457a55 100644 --- a/qiskit/opflow/state_fns/circuit_state_fn.py +++ b/qiskit/opflow/state_fns/circuit_state_fn.py @@ -228,7 +228,7 @@ def tensor(self, other: OperatorBase) -> Union["CircuitStateFn", TensoredOp]: c_op = c_op_self.tensor(c_op_other) if isinstance(c_op, CircuitOp): return CircuitStateFn( - primitive=c_op.primitive, # pylint: disable=no-member + primitive=c_op.primitive, coeff=c_op.coeff, is_measurement=self.is_measurement, ) diff --git a/qiskit/primitives/backend_estimator.py b/qiskit/primitives/backend_estimator.py index c2e9a424c6f7..3a667ecbdb7f 100644 --- a/qiskit/primitives/backend_estimator.py +++ b/qiskit/primitives/backend_estimator.py @@ -97,7 +97,6 @@ class BackendEstimator(BaseEstimator): precludes doing any provider- or backend-specific optimizations. """ - # pylint: disable=missing-raises-doc def __init__( self, backend: BackendV1 | BackendV2, @@ -142,7 +141,7 @@ def __init__( def __new__( # pylint: disable=signature-differs cls, backend: BackendV1 | BackendV2, # pylint: disable=unused-argument - **kwargs, # pylint: disable=unused-argument + **kwargs, ): self = super().__new__(cls) return self diff --git a/qiskit/primitives/backend_sampler.py b/qiskit/primitives/backend_sampler.py index 241e79ede911..7833268ac676 100644 --- a/qiskit/primitives/backend_sampler.py +++ b/qiskit/primitives/backend_sampler.py @@ -79,7 +79,7 @@ def __init__( def __new__( # pylint: disable=signature-differs cls, backend: BackendV1 | BackendV2, # pylint: disable=unused-argument - **kwargs, # pylint: disable=unused-argument + **kwargs, ): self = super().__new__(cls) return self diff --git a/qiskit/providers/basicaer/basicaerjob.py b/qiskit/providers/basicaer/basicaerjob.py index 407967c99a20..0a71d7feb7b4 100644 --- a/qiskit/providers/basicaer/basicaerjob.py +++ b/qiskit/providers/basicaer/basicaerjob.py @@ -37,7 +37,6 @@ def submit(self): return def result(self, timeout=None): - # pylint: disable=arguments-differ """Get job result . Returns: diff --git a/qiskit/providers/basicaer/basicaerprovider.py b/qiskit/providers/basicaer/basicaerprovider.py index c8d8b5191322..b46a83826a18 100644 --- a/qiskit/providers/basicaer/basicaerprovider.py +++ b/qiskit/providers/basicaer/basicaerprovider.py @@ -59,7 +59,6 @@ def get_backend(self, name=None, **kwargs): return super().get_backend(name=name, **kwargs) def backends(self, name=None, filters=None, **kwargs): - # pylint: disable=arguments-differ backends = self._backends.values() # Special handling of the `name` parameter, to support alias resolution diff --git a/qiskit/providers/basicaer/qasm_simulator.py b/qiskit/providers/basicaer/qasm_simulator.py index d4c016002dc6..ae999a2a66aa 100644 --- a/qiskit/providers/basicaer/qasm_simulator.py +++ b/qiskit/providers/basicaer/qasm_simulator.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=arguments-differ - """Contains a (slow) Python simulator. It simulates a qasm quantum circuit (an experiment) that has been compiled diff --git a/qiskit/providers/basicaer/unitary_simulator.py b/qiskit/providers/basicaer/unitary_simulator.py index 3cbdedb3df39..e92d55730ed0 100644 --- a/qiskit/providers/basicaer/unitary_simulator.py +++ b/qiskit/providers/basicaer/unitary_simulator.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=arguments-differ - """Contains a Python simulator that returns the unitary of the circuit. It simulates a unitary of a quantum circuit that has been compiled to run on diff --git a/qiskit/providers/fake_provider/fake_backend_v2.py b/qiskit/providers/fake_provider/fake_backend_v2.py index 4df3eba3e8ca..23b0c58dadce 100644 --- a/qiskit/providers/fake_provider/fake_backend_v2.py +++ b/qiskit/providers/fake_provider/fake_backend_v2.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=no-name-in-module """Mock BackendV2 object without run implemented for testing backwards compat""" diff --git a/qiskit/providers/fake_provider/fake_job.py b/qiskit/providers/fake_provider/fake_job.py index 22c4b4312f2e..8d2e394c2bb6 100644 --- a/qiskit/providers/fake_provider/fake_job.py +++ b/qiskit/providers/fake_provider/fake_job.py @@ -24,7 +24,7 @@ class FakeJob(JobV1): """Fake simulator job""" - _executor = futures.ThreadPoolExecutor() # pylint: disable=consider-using-with + _executor = futures.ThreadPoolExecutor() def __init__(self, backend, job_id, fn): super().__init__(backend, job_id) @@ -37,7 +37,6 @@ def submit(self): self._future = self._executor.submit(self._future_callback) def result(self, timeout=None): - # pylint: disable=arguments-differ return self._future.result(timeout=timeout) def cancel(self): diff --git a/qiskit/providers/fake_provider/fake_mumbai_v2.py b/qiskit/providers/fake_provider/fake_mumbai_v2.py index 2fc259bfc499..1a5f1c24d4a3 100644 --- a/qiskit/providers/fake_provider/fake_mumbai_v2.py +++ b/qiskit/providers/fake_provider/fake_mumbai_v2.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=no-name-in-module """Mock BackendV2 object without run implemented for testing backwards compat""" diff --git a/qiskit/pulse/builder.py b/qiskit/pulse/builder.py index 73ac8eb9f8fc..f0a2223df72f 100644 --- a/qiskit/pulse/builder.py +++ b/qiskit/pulse/builder.py @@ -500,7 +500,7 @@ from qiskit.pulse.transforms.alignments import AlignmentKind if sys.version_info >= (3, 8): - from functools import singledispatchmethod # pylint: disable=no-name-in-module + from functools import singledispatchmethod else: from singledispatchmethod import singledispatchmethod @@ -508,7 +508,7 @@ #: contextvars.ContextVar[BuilderContext]: active builder BUILDER_CONTEXTVAR = contextvars.ContextVar("backend") -T = TypeVar("T") # pylint: disable=invalid-name +T = TypeVar("T") StorageLocation = NewType("StorageLocation", Union[chans.MemorySlot, chans.RegisterSlot]) @@ -1212,7 +1212,7 @@ def active_transpiler_settings() -> Dict[str, Any]: return dict(_active_builder().transpiler_settings) -def active_circuit_scheduler_settings() -> Dict[str, Any]: # pylint: disable=invalid-name +def active_circuit_scheduler_settings() -> Dict[str, Any]: """Return the current active builder context's circuit scheduler settings. Examples: diff --git a/qiskit/pulse/instructions/call.py b/qiskit/pulse/instructions/call.py index 3353f23d0b4a..6fc3eaf577be 100644 --- a/qiskit/pulse/instructions/call.py +++ b/qiskit/pulse/instructions/call.py @@ -81,7 +81,6 @@ def channels(self) -> Tuple[Channel]: """Returns the channels that this schedule uses.""" return self.assigned_subroutine().channels - # pylint: disable=missing-return-type-doc @property def subroutine(self): """Return attached subroutine. diff --git a/qiskit/pulse/instructions/instruction.py b/qiskit/pulse/instructions/instruction.py index 26b599ea275a..4f8bfee9810a 100644 --- a/qiskit/pulse/instructions/instruction.py +++ b/qiskit/pulse/instructions/instruction.py @@ -32,7 +32,7 @@ from qiskit.utils.deprecation import deprecate_function -# pylint: disable=missing-return-doc,bad-docstring-quotes +# pylint: disable=bad-docstring-quotes class Instruction(ABC): diff --git a/qiskit/pulse/library/continuous.py b/qiskit/pulse/library/continuous.py index 52f05470635c..a7098ef25850 100644 --- a/qiskit/pulse/library/continuous.py +++ b/qiskit/pulse/library/continuous.py @@ -10,7 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-return-doc, invalid-unary-operand-type +# pylint: disable=invalid-unary-operand-type """Module for builtin continuous pulse functions.""" diff --git a/qiskit/pulse/library/discrete.py b/qiskit/pulse/library/discrete.py index 5195cbaa17c6..d5f6932a0be2 100644 --- a/qiskit/pulse/library/discrete.py +++ b/qiskit/pulse/library/discrete.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-return-doc """Module for builtin discrete pulses. diff --git a/qiskit/pulse/library/pulse.py b/qiskit/pulse/library/pulse.py index d716f631ef83..d34f1ffe2d1a 100644 --- a/qiskit/pulse/library/pulse.py +++ b/qiskit/pulse/library/pulse.py @@ -110,7 +110,7 @@ def draw( The returned data type depends on the ``plotter``. If matplotlib family is specified, this will be a ``matplotlib.pyplot.Figure`` data. """ - # pylint: disable=cyclic-import, missing-return-type-doc + # pylint: disable=cyclic-import from qiskit.visualization import pulse_drawer return pulse_drawer( diff --git a/qiskit/pulse/library/samplers/decorators.py b/qiskit/pulse/library/samplers/decorators.py index ade7c99b6ec9..eddef0b1ccdc 100644 --- a/qiskit/pulse/library/samplers/decorators.py +++ b/qiskit/pulse/library/samplers/decorators.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-return-doc - """Sampler decorator module for sampling of continuous pulses to discrete pulses to be exposed to user. diff --git a/qiskit/pulse/library/samplers/strategies.py b/qiskit/pulse/library/samplers/strategies.py index 14c252d3bcf2..c0886138d910 100644 --- a/qiskit/pulse/library/samplers/strategies.py +++ b/qiskit/pulse/library/samplers/strategies.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-return-doc """Sampler strategy module for sampler functions. diff --git a/qiskit/pulse/schedule.py b/qiskit/pulse/schedule.py index c501b9a8a04b..ff806de9a353 100644 --- a/qiskit/pulse/schedule.py +++ b/qiskit/pulse/schedule.py @@ -10,7 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=cyclic-import, missing-return-doc +# pylint: disable=cyclic-import """ ========= @@ -1802,7 +1802,7 @@ def draw( The returned data type depends on the ``plotter``. If matplotlib family is specified, this will be a ``matplotlib.pyplot.Figure`` data. """ - # pylint: disable=cyclic-import, missing-return-type-doc + # pylint: disable=cyclic-import from qiskit.visualization import pulse_drawer return pulse_drawer( diff --git a/qiskit/qobj/converters/pulse_instruction.py b/qiskit/qobj/converters/pulse_instruction.py index 502021429295..cac25ea14897 100644 --- a/qiskit/qobj/converters/pulse_instruction.py +++ b/qiskit/qobj/converters/pulse_instruction.py @@ -33,7 +33,7 @@ from qiskit.utils.deprecation import deprecate_function if sys.version_info >= (3, 8): - from functools import singledispatchmethod # pylint: disable=no-name-in-module + from functools import singledispatchmethod else: from singledispatchmethod import singledispatchmethod diff --git a/qiskit/qpy/binary_io/schedules.py b/qiskit/qpy/binary_io/schedules.py index db48fe3658f6..41c045f0a431 100644 --- a/qiskit/qpy/binary_io/schedules.py +++ b/qiskit/qpy/binary_io/schedules.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=invalid-name - """Read and write schedule and schedule instructions.""" import json import struct diff --git a/qiskit/qpy/common.py b/qiskit/qpy/common.py index 7ecbbe819353..456738ba5ae5 100644 --- a/qiskit/qpy/common.py +++ b/qiskit/qpy/common.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=too-many-return-statements """ Common functions across several serialization and deserialization modules. diff --git a/qiskit/quantum_info/operators/pauli.py b/qiskit/quantum_info/operators/pauli.py index a1e2797b860d..11342c4908de 100644 --- a/qiskit/quantum_info/operators/pauli.py +++ b/qiskit/quantum_info/operators/pauli.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=unused-import - """ DEPRECATED Tools for working with Pauli Operators. diff --git a/qiskit/quantum_info/operators/symplectic/base_pauli.py b/qiskit/quantum_info/operators/symplectic/base_pauli.py index 1f9e740361c1..fabcf22a8af9 100644 --- a/qiskit/quantum_info/operators/symplectic/base_pauli.py +++ b/qiskit/quantum_info/operators/symplectic/base_pauli.py @@ -87,7 +87,6 @@ def _tensor(cls, a, b): phase = np.mod(phase1 + phase2, 4) return BasePauli(z, x, phase) - # pylint: disable=arguments-differ def compose(self, other, qargs=None, front=False, inplace=False): """Return the composition of Paulis. diff --git a/qiskit/quantum_info/operators/symplectic/clifford.py b/qiskit/quantum_info/operators/symplectic/clifford.py index 3773a7b53700..076dac7c1c11 100644 --- a/qiskit/quantum_info/operators/symplectic/clifford.py +++ b/qiskit/quantum_info/operators/symplectic/clifford.py @@ -208,8 +208,6 @@ def copy(self): # Attributes # --------------------------------------------------------------------- - # pylint: disable=bad-docstring-quotes - def __getitem__(self, key): """Return a stabilizer Pauli row""" return self.table.__getitem__(key) diff --git a/qiskit/quantum_info/operators/symplectic/pauli.py b/qiskit/quantum_info/operators/symplectic/pauli.py index b2663222d408..1a6a25100aed 100644 --- a/qiskit/quantum_info/operators/symplectic/pauli.py +++ b/qiskit/quantum_info/operators/symplectic/pauli.py @@ -12,7 +12,6 @@ """ N-qubit Pauli Operator Class """ -# pylint: disable=invalid-name import re import warnings @@ -491,7 +490,6 @@ def compose(self, other, qargs=None, front=False, inplace=False): other = Pauli(other) return Pauli(super().compose(other, qargs=qargs, front=front, inplace=inplace)) - # pylint: disable=arguments-differ def dot(self, other, qargs=None, inplace=False): """Return the right multiplied operator self * other. diff --git a/qiskit/quantum_info/operators/symplectic/pauli_list.py b/qiskit/quantum_info/operators/symplectic/pauli_list.py index 4d566110b7f0..0a1505cba062 100644 --- a/qiskit/quantum_info/operators/symplectic/pauli_list.py +++ b/qiskit/quantum_info/operators/symplectic/pauli_list.py @@ -720,7 +720,6 @@ def compose(self, other, qargs=None, front=False, inplace=False): ) return PauliList(super().compose(other, qargs=qargs, front=front, inplace=inplace)) - # pylint: disable=arguments-differ def dot(self, other, qargs=None, inplace=False): """Return the composition other∘self for each Pauli in the list. diff --git a/qiskit/quantum_info/operators/symplectic/stabilizer_table.py b/qiskit/quantum_info/operators/symplectic/stabilizer_table.py index 8b0f62b471ab..08c8ea416e12 100644 --- a/qiskit/quantum_info/operators/symplectic/stabilizer_table.py +++ b/qiskit/quantum_info/operators/symplectic/stabilizer_table.py @@ -1039,7 +1039,6 @@ def _to_matrix(pauli, phase, sparse=False): array: if sparse=False. csr_matrix: if sparse=True. """ - # pylint: disable=arguments-differ mat = PauliTable._to_matrix(pauli, sparse=sparse, real_valued=True) if phase: mat *= -1 diff --git a/qiskit/result/utils.py b/qiskit/result/utils.py index 3e6108d757fa..25f96dc4d77d 100644 --- a/qiskit/result/utils.py +++ b/qiskit/result/utils.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=c-extension-no-member """Utility functions for working with Results.""" diff --git a/qiskit/synthesis/clifford/clifford_decompose_ag.py b/qiskit/synthesis/clifford/clifford_decompose_ag.py index bd92abf35e49..9121d733eafb 100644 --- a/qiskit/synthesis/clifford/clifford_decompose_ag.py +++ b/qiskit/synthesis/clifford/clifford_decompose_ag.py @@ -12,7 +12,6 @@ """ Circuit synthesis for the Clifford class. """ -# pylint: disable=invalid-name # --------------------------------------------------------------------- diff --git a/qiskit/synthesis/discrete_basis/commutator_decompose.py b/qiskit/synthesis/discrete_basis/commutator_decompose.py index 10622e76e2c9..5a9af6acfa2c 100644 --- a/qiskit/synthesis/discrete_basis/commutator_decompose.py +++ b/qiskit/synthesis/discrete_basis/commutator_decompose.py @@ -99,7 +99,7 @@ def objective(phi): return decomposition_angle -def _compute_rotation_from_angle_and_axis( # pylint: disable=invalid-name +def _compute_rotation_from_angle_and_axis( angle: float, axis: np.ndarray ) -> np.ndarray: """Computes the SO(3)-matrix corresponding to the rotation of ``angle`` about ``axis``. diff --git a/qiskit/test/base.py b/qiskit/test/base.py index 3b6853f4a06b..4874acf275e9 100644 --- a/qiskit/test/base.py +++ b/qiskit/test/base.py @@ -10,9 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=attribute-defined-outside-init,invalid-name,missing-type-doc -# pylint: disable=unused-argument,broad-except,bad-staticmethod-argument -# pylint: disable=inconsistent-return-statements +# pylint: disable=invalid-name """Base TestCases for the unit tests. diff --git a/qiskit/transpiler/coupling.py b/qiskit/transpiler/coupling.py index e547f8019288..7d8dc6e5467b 100644 --- a/qiskit/transpiler/coupling.py +++ b/qiskit/transpiler/coupling.py @@ -23,7 +23,7 @@ import numpy as np import rustworkx as rx -from rustworkx.visualization import graphviz_draw # pylint: disable=no-name-in-module +from rustworkx.visualization import graphviz_draw from qiskit.transpiler.exceptions import CouplingError diff --git a/qiskit/transpiler/passes/basis/basis_translator.py b/qiskit/transpiler/passes/basis/basis_translator.py index 215fba774885..7deea782c247 100644 --- a/qiskit/transpiler/passes/basis/basis_translator.py +++ b/qiskit/transpiler/passes/basis/basis_translator.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-function-docstring """Translates gates to a target basis using a given equivalence library.""" @@ -31,7 +30,7 @@ from qiskit.transpiler.exceptions import TranspilerError if sys.version_info >= (3, 8): - from functools import singledispatchmethod # pylint: disable=no-name-in-module + from functools import singledispatchmethod else: from singledispatchmethod import singledispatchmethod @@ -99,7 +98,7 @@ def __init__(self, equivalence_library, target_basis, target=None): self._target_basis = target_basis self._target = target self._non_global_operations = None - self._qargs_with_non_global_operation = {} # pylint: disable=invalid-name + self._qargs_with_non_global_operation = {} if target is not None: self._non_global_operations = self._target.get_non_global_operation_names() self._qargs_with_non_global_operation = defaultdict(set) @@ -367,7 +366,7 @@ class StopIfBasisRewritable(Exception): """Custom exception that signals `rustworkx.dijkstra_search` to stop.""" -class BasisSearchVisitor(rustworkx.visit.DijkstraVisitor): # pylint: disable=no-member +class BasisSearchVisitor(rustworkx.visit.DijkstraVisitor): """Handles events emitted during `rustworkx.dijkstra_search`.""" def __init__(self, graph, source_basis, target_basis): @@ -419,7 +418,7 @@ def examine_edge(self, edge): # if there are gates in this `rule` that we have not yet generated, we can't apply # this `rule`. if `target` is already in basis, it's not beneficial to use this rule. if self._num_gates_remain_for_rule[edata.index] > 0 or target in self.target_basis: - raise rustworkx.visit.PruneSearch # pylint: disable=no-member + raise rustworkx.visit.PruneSearch def edge_relaxed(self, edge): _, target, edata = edge diff --git a/qiskit/transpiler/passes/calibration/rzx_builder.py b/qiskit/transpiler/passes/calibration/rzx_builder.py index 85d428db4e9e..8f12aadce80b 100644 --- a/qiskit/transpiler/passes/calibration/rzx_builder.py +++ b/qiskit/transpiler/passes/calibration/rzx_builder.py @@ -14,7 +14,7 @@ import enum import warnings -from math import pi, erf # pylint: disable=no-name-in-module +from math import pi, erf from typing import List, Tuple, Union import numpy as np diff --git a/qiskit/transpiler/passes/layout/vf2_layout.py b/qiskit/transpiler/passes/layout/vf2_layout.py index 51755a2cc11f..c5f17d9192b4 100644 --- a/qiskit/transpiler/passes/layout/vf2_layout.py +++ b/qiskit/transpiler/passes/layout/vf2_layout.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=too-many-function-args """VF2Layout pass to find a layout using subgraph isomorphism""" import os diff --git a/qiskit/transpiler/passes/layout/vf2_post_layout.py b/qiskit/transpiler/passes/layout/vf2_post_layout.py index f1c7bd746846..1e874affa7c9 100644 --- a/qiskit/transpiler/passes/layout/vf2_post_layout.py +++ b/qiskit/transpiler/passes/layout/vf2_post_layout.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=too-many-function-args """VF2PostLayout pass to find a layout after transpile using subgraph isomorphism""" import os diff --git a/qiskit/transpiler/passes/optimization/hoare_opt.py b/qiskit/transpiler/passes/optimization/hoare_opt.py index e27aee549a60..50c1615361f1 100644 --- a/qiskit/transpiler/passes/optimization/hoare_opt.py +++ b/qiskit/transpiler/passes/optimization/hoare_opt.py @@ -36,7 +36,7 @@ def __init__(self, size=10): MissingOptionalLibraryError: if unable to import z3 solver """ # This module is just a script that adds several post conditions onto existing classes. - from . import _gate_extension # pylint: disable=unused-import + from . import _gate_extension super().__init__() self.solver = None diff --git a/qiskit/transpiler/preset_passmanagers/common.py b/qiskit/transpiler/preset_passmanagers/common.py index b4fd441e8afb..4d15fca99f24 100644 --- a/qiskit/transpiler/preset_passmanagers/common.py +++ b/qiskit/transpiler/preset_passmanagers/common.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=invalid-name """Common preset passmanager generators.""" diff --git a/qiskit/utils/measurement_error_mitigation.py b/qiskit/utils/measurement_error_mitigation.py index 9fca4f783921..15752fefc163 100644 --- a/qiskit/utils/measurement_error_mitigation.py +++ b/qiskit/utils/measurement_error_mitigation.py @@ -28,8 +28,6 @@ TensoredMeasFitter, ) -# pylint: disable=invalid-name - def get_measured_qubits( transpiled_circuits: List[QuantumCircuit], diff --git a/qiskit/utils/quantum_instance.py b/qiskit/utils/quantum_instance.py index f72b34d9cc02..e93f39660c8d 100644 --- a/qiskit/utils/quantum_instance.py +++ b/qiskit/utils/quantum_instance.py @@ -840,12 +840,12 @@ def max_job_retries(self, new_value): self._max_job_retries = new_value @property - def measurement_error_mitigation_cls(self): # pylint: disable=invalid-name + def measurement_error_mitigation_cls(self): """returns measurement error mitigation cls""" return self._meas_error_mitigation_cls @measurement_error_mitigation_cls.setter - def measurement_error_mitigation_cls(self, new_value): # pylint: disable=invalid-name + def measurement_error_mitigation_cls(self, new_value): """sets measurement error mitigation cls""" self._meas_error_mitigation_cls = new_value @@ -860,12 +860,12 @@ def cals_matrix_refresh_period(self, new_value): self._cals_matrix_refresh_period = new_value @property - def measurement_error_mitigation_shots(self): # pylint: disable=invalid-name + def measurement_error_mitigation_shots(self): """returns measurement error mitigation shots""" return self._meas_error_mitigation_shots @measurement_error_mitigation_shots.setter - def measurement_error_mitigation_shots(self, new_value): # pylint: disable=invalid-name + def measurement_error_mitigation_shots(self, new_value): """sets measurement error mitigation shots""" self._meas_error_mitigation_shots = new_value diff --git a/qiskit/visualization/dag_visualization.py b/qiskit/visualization/dag_visualization.py index b3e21fecbbfc..62995cb6de5f 100644 --- a/qiskit/visualization/dag_visualization.py +++ b/qiskit/visualization/dag_visualization.py @@ -15,7 +15,7 @@ """ Visualization function for DAG circuit representation. """ -from rustworkx.visualization import graphviz_draw # pylint: disable=no-name-in-module +from rustworkx.visualization import graphviz_draw from qiskit.dagcircuit.dagnode import DAGOpNode, DAGInNode, DAGOutNode from qiskit.circuit import Qubit diff --git a/qiskit/visualization/pass_manager_visualization.py b/qiskit/visualization/pass_manager_visualization.py index c8d6dc9a04cc..6765c199e7c5 100644 --- a/qiskit/visualization/pass_manager_visualization.py +++ b/qiskit/visualization/pass_manager_visualization.py @@ -261,7 +261,7 @@ def make_output(graph, raw, filename): if not _optionals.HAS_PIL and filename: # pylint says this isn't a method - it is - graph.write_png(filename) # pylint: disable=no-member + graph.write_png(filename) return None _optionals.HAS_PIL.require_now("pass manager drawer") @@ -272,7 +272,7 @@ def make_output(graph, raw, filename): tmppath = os.path.join(tmpdirname, "pass_manager.png") # pylint says this isn't a method - it is - graph.write_png(tmppath) # pylint: disable=no-member + graph.write_png(tmppath) image = Image.open(tmppath) os.remove(tmppath) diff --git a/qiskit/visualization/pulse_v2/interface.py b/qiskit/visualization/pulse_v2/interface.py index 21b7d8a24cb3..70b3922d8501 100644 --- a/qiskit/visualization/pulse_v2/interface.py +++ b/qiskit/visualization/pulse_v2/interface.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-return-type-doc - """Qiskit pulse drawer. This module provides a common user interface for the pulse drawer. diff --git a/qiskit/visualization/pulse_v2/plotters/matplotlib.py b/qiskit/visualization/pulse_v2/plotters/matplotlib.py index f2ccb6e641e7..d86e169901a3 100644 --- a/qiskit/visualization/pulse_v2/plotters/matplotlib.py +++ b/qiskit/visualization/pulse_v2/plotters/matplotlib.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=invalid-name - """Matplotlib plotter API.""" from typing import Optional diff --git a/qiskit/visualization/timeline/interface.py b/qiskit/visualization/timeline/interface.py index 2ed3d0cb870a..862fe747bbb3 100644 --- a/qiskit/visualization/timeline/interface.py +++ b/qiskit/visualization/timeline/interface.py @@ -10,8 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-return-type-doc - """Qiskit timeline drawer. This module provides a common user interface to the timeline drawer. diff --git a/test/python/algorithms/minimum_eigensolvers/test_qaoa.py b/test/python/algorithms/minimum_eigensolvers/test_qaoa.py index b512664e23cb..de1bbe5e1492 100644 --- a/test/python/algorithms/minimum_eigensolvers/test_qaoa.py +++ b/test/python/algorithms/minimum_eigensolvers/test_qaoa.py @@ -33,8 +33,8 @@ from qiskit.primitives import Sampler from qiskit.utils import algorithm_globals -I = PauliSumOp.from_list([("I", 1)]) # pylint: disable=invalid-name -X = PauliSumOp.from_list([("X", 1)]) # pylint: disable=invalid-name +I = PauliSumOp.from_list([("I", 1)]) +X = PauliSumOp.from_list([("X", 1)]) W1 = np.array([[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) P1 = 1 diff --git a/test/python/algorithms/minimum_eigensolvers/test_sampling_vqe.py b/test/python/algorithms/minimum_eigensolvers/test_sampling_vqe.py index e28908bffd85..8e364e3800c4 100644 --- a/test/python/algorithms/minimum_eigensolvers/test_sampling_vqe.py +++ b/test/python/algorithms/minimum_eigensolvers/test_sampling_vqe.py @@ -33,7 +33,7 @@ from qiskit.utils import algorithm_globals -# pylint: disable=invalid-name, unused-argument +# pylint: disable=invalid-name def _mock_optimizer(fun, x0, jac=None, bounds=None, inputs=None): """A mock of a callable that can be used as minimizer in the VQE. diff --git a/test/python/algorithms/optimizers/test_spsa.py b/test/python/algorithms/optimizers/test_spsa.py index 8e48e2801bbf..949f2aa03f80 100644 --- a/test/python/algorithms/optimizers/test_spsa.py +++ b/test/python/algorithms/optimizers/test_spsa.py @@ -258,7 +258,6 @@ def objective(x): def test_point_sample(self): """Test point sample function in QNSPSA""" - # pylint: disable=invalid-name def fidelity(x, _y): x = np.asarray(x) diff --git a/test/python/algorithms/test_grover.py b/test/python/algorithms/test_grover.py index f0363b6de41b..be57e2dc987f 100644 --- a/test/python/algorithms/test_grover.py +++ b/test/python/algorithms/test_grover.py @@ -80,7 +80,6 @@ def is_good_state(bitstr): problem = AmplificationProblem(oracle, is_good_state=is_good_state) expected = [state in ["01", "11"] for state in possible_states] - # pylint: disable=not-callable actual = [problem.is_good_state(state) for state in possible_states] self.assertListEqual(expected, actual) diff --git a/test/python/circuit/test_circuit_load_from_qpy.py b/test/python/circuit/test_circuit_load_from_qpy.py index ea9823d70873..eb78b6a38f9b 100644 --- a/test/python/circuit/test_circuit_load_from_qpy.py +++ b/test/python/circuit/test_circuit_load_from_qpy.py @@ -900,7 +900,7 @@ def __eq__(self, other): class CustomSerializer(json.JSONEncoder): """Custom json encoder to handle CustomObject.""" - def default(self, o): # pylint: disable=invalid-name + def default(self, o): if isinstance(o, CustomObject): return {"__type__": "Custom", "value": o.string} return json.JSONEncoder.default(self, o) diff --git a/test/python/circuit/test_parameters.py b/test/python/circuit/test_parameters.py index 429f26a9eb5d..74ac785d9448 100644 --- a/test/python/circuit/test_parameters.py +++ b/test/python/circuit/test_parameters.py @@ -39,7 +39,7 @@ from qiskit.tools import parallel_map -def raise_if_parameter_table_invalid(circuit): # pylint: disable=invalid-name +def raise_if_parameter_table_invalid(circuit): """Validates the internal consistency of a ParameterTable and its containing QuantumCircuit. Intended for use in testing. diff --git a/test/python/circuit/test_unitary.py b/test/python/circuit/test_unitary.py index c4cf7b67a4a6..798cd641dbda 100644 --- a/test/python/circuit/test_unitary.py +++ b/test/python/circuit/test_unitary.py @@ -177,7 +177,7 @@ def test_qobj_with_unitary_matrix(self): class NumpyEncoder(json.JSONEncoder): """Class for encoding json str with complex and numpy arrays.""" - def default(self, obj): # pylint: disable=arguments-differ + def default(self, obj): if isinstance(obj, numpy.ndarray): return obj.tolist() if isinstance(obj, complex): diff --git a/test/python/providers/test_options.py b/test/python/providers/test_options.py index 3162ae766206..7ea860dfffbc 100644 --- a/test/python/providers/test_options.py +++ b/test/python/providers/test_options.py @@ -133,8 +133,8 @@ def test_unpacking_dict(self): def test_setting_attributes(self): options = Options() - options.hello = "world" # pylint: disable=assigning-non-slot - options.a = "b" # pylint: disable=assigning-non-slot + options.hello = "world" + options.a = "b" self.assertEqual(options.get("hello"), "world") self.assertEqual(options.get("a"), "b") self.assertEqual(options.__dict__, {"hello": "world", "a": "b"}) diff --git a/test/python/pulse/test_pulse_lib.py b/test/python/pulse/test_pulse_lib.py index 01f079091330..a16aee744aa3 100644 --- a/test/python/pulse/test_pulse_lib.py +++ b/test/python/pulse/test_pulse_lib.py @@ -726,7 +726,7 @@ def test_constant_deprecated_type_check(self): class TestFunctionalPulse(QiskitTestCase): """Waveform tests.""" - # pylint: disable=invalid-name, unexpected-keyword-arg + # pylint: disable=invalid-name def test_gaussian(self): """Test gaussian pulse.""" diff --git a/test/python/qpy/test_block_load_from_qpy.py b/test/python/qpy/test_block_load_from_qpy.py index 88451917440d..59a635eb127b 100644 --- a/test/python/qpy/test_block_load_from_qpy.py +++ b/test/python/qpy/test_block_load_from_qpy.py @@ -174,7 +174,6 @@ def test_measure(self): @unpack def test_parameterized(self, channel, *params): """Test playing parameterized pulse.""" - # pylint: disable=no-value-for-parameter with builder.build() as test_sched: builder.play(Gaussian(*params), DriveChannel(channel)) self.assert_roundtrip_equal(test_sched) diff --git a/test/python/transpiler/test_calibrationbuilder.py b/test/python/transpiler/test_calibrationbuilder.py index f657b494b916..aadbc25c0332 100644 --- a/test/python/transpiler/test_calibrationbuilder.py +++ b/test/python/transpiler/test_calibrationbuilder.py @@ -12,7 +12,7 @@ """Test the RZXCalibrationBuilderNoEcho.""" -from math import pi, erf # pylint: disable=no-name-in-module +from math import pi, erf import numpy as np from ddt import data, ddt diff --git a/test/python/transpiler/test_passmanager.py b/test/python/transpiler/test_passmanager.py index 9f33ffbdcf5e..871947937a5e 100644 --- a/test/python/transpiler/test_passmanager.py +++ b/test/python/transpiler/test_passmanager.py @@ -10,7 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=missing-class-docstring,missing-function-docstring +# pylint: disable=missing-class-docstring """Test the passmanager logic""" @@ -129,7 +129,7 @@ def __init__(self, x): def run(self, dag): return dag - def repeat(count): # pylint: disable=unused-argument + def repeat(count): def condition(_): nonlocal count if not count: diff --git a/test/python/transpiler/test_unitary_synthesis_plugin.py b/test/python/transpiler/test_unitary_synthesis_plugin.py index ca00f5ea5672..57ccf6437139 100644 --- a/test/python/transpiler/test_unitary_synthesis_plugin.py +++ b/test/python/transpiler/test_unitary_synthesis_plugin.py @@ -255,10 +255,10 @@ def test_config_passed_to_non_default(self): ControllableSynthesis, "run", return_value=return_dag ) as plugin_mock: pm.run(qc) - plugin_mock.assert_called() # pylint: disable=no-member + plugin_mock.assert_called() # This access should be `run.call_args.kwargs`, but the namedtuple access wasn't added # until Python 3.8. - call_kwargs = plugin_mock.call_args[1] # pylint: disable=no-member + call_kwargs = plugin_mock.call_args[1] expected_kwargs = [ "config", ] diff --git a/test/python/utils/test_lazy_loaders.py b/test/python/utils/test_lazy_loaders.py index 94db9bb94278..614bea15f04d 100644 --- a/test/python/utils/test_lazy_loaders.py +++ b/test/python/utils/test_lazy_loaders.py @@ -21,8 +21,6 @@ from qiskit.test import QiskitTestCase from qiskit.utils import LazyImportTester, LazySubprocessTester -# pylint: disable=no-member - def available_importer(**kwargs): """A LazyImportTester that should succeed.""" diff --git a/test/python/visualization/test_circuit_latex.py b/test/python/visualization/test_circuit_latex.py index f07b34c1f567..ed95ab64d515 100644 --- a/test/python/visualization/test_circuit_latex.py +++ b/test/python/visualization/test_circuit_latex.py @@ -10,7 +10,6 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -# pylint: disable=arguments-differ """Tests for visualization of circuit with Latex drawer.""" From 107f7790de920e80c331d1444351539db4c28190 Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Wed, 1 Mar 2023 08:46:53 -0500 Subject: [PATCH 5/5] Reblacken --- qiskit/algorithms/eigensolvers/vqd.py | 4 +--- qiskit/synthesis/discrete_basis/commutator_decompose.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/qiskit/algorithms/eigensolvers/vqd.py b/qiskit/algorithms/eigensolvers/vqd.py index 544d40234053..c01152732dcb 100644 --- a/qiskit/algorithms/eigensolvers/vqd.py +++ b/qiskit/algorithms/eigensolvers/vqd.py @@ -265,9 +265,7 @@ def compute_eigenvalues( # TODO: add gradient support after FidelityGradients are implemented if callable(self.optimizer): - opt_result = self.optimizer( - fun=energy_evaluation, x0=initial_point, bounds=bounds - ) + opt_result = self.optimizer(fun=energy_evaluation, x0=initial_point, bounds=bounds) else: # we always want to submit as many estimations per job as possible for minimal # overhead on the hardware diff --git a/qiskit/synthesis/discrete_basis/commutator_decompose.py b/qiskit/synthesis/discrete_basis/commutator_decompose.py index 5a9af6acfa2c..caa669d409d7 100644 --- a/qiskit/synthesis/discrete_basis/commutator_decompose.py +++ b/qiskit/synthesis/discrete_basis/commutator_decompose.py @@ -99,9 +99,7 @@ def objective(phi): return decomposition_angle -def _compute_rotation_from_angle_and_axis( - angle: float, axis: np.ndarray -) -> np.ndarray: +def _compute_rotation_from_angle_and_axis(angle: float, axis: np.ndarray) -> np.ndarray: """Computes the SO(3)-matrix corresponding to the rotation of ``angle`` about ``axis``. Args: