Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ repos:

- id: no-commit-to-branch
name: 'The commit is not being made to the main branch'
args: [--branch, main, --branch, master]
args: [--branch, main]

- id: check-merge-conflict
name: "Files are free of git merge conflict strings"
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ callbacks=cb_,

# A regular expression matching the name of placeholder variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|^ignored_|^unused_|^placeholder_?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The regular expression pattern ^placeholder_? is unanchored at the end, which means it will match any variable name starting with placeholder (such as placeholders, placeholder_values, or placeholder_map). This can cause Pylint to silently ignore unused variable warnings for actual, active variables that happen to start with this prefix.\n\nTo prevent this, the pattern should be anchored to match only the exact word placeholder (or explicitly placeholder_ if intended as a prefix for unused variables).

dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|^ignored_|^unused_|^placeholder$


# Argument names that match this expression will be ignored.
ignored-argument-names=_.*|^ignored_|^unused_
Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def set_threadpool_limits():
if "PYTEST_XDIST_WORKER_COUNT" in os.environ:
from openfermion.config import get_available_cpu_count

# Limit native library thread pools for this worker.
# Limit compiled library thread pools for this worker.
with threadpoolctl.threadpool_limits(limits=get_available_cpu_count()):
yield
else:
Expand Down
4 changes: 2 additions & 2 deletions src/openfermion/ops/operators/binary_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ def __rmul__(self, factor):
def __str__(self):
"""Return an easy-to-read string representation."""

def convert_to_native(value):
def to_python_type(value):
return getattr(value, "tolist", lambda: value)()

string_return = [list(map(list, convert_to_native(self.encoder.toarray())))]
string_return = [list(map(list, to_python_type(self.encoder.toarray())))]

dec_str = '['
for term in self.decoder:
Expand Down
Loading