Skip to content

Commit

Permalink
Adding Clippy Fix (backport #930) and Pin pillow<10 in CI (backport #922
Browse files Browse the repository at this point in the history
)  (#931)

* Adding fix that clippy warns for (#930)

Because of a new Rust update, Clippy now warned for a line of code in cycle_basis.rs in rustworkx-core.
This PR fixes that one line so that Clippy passes.

(cherry picked from commit d88f18b)

* Pin pillow<10 in CI (#922)

Since the recent release of Pillow 10.0.0 the docs CI job has started
failing due to an error in Pillow when trying to run the jupyter-execute
cell in the `.to_dot()` docstring. It looks like a bug that was
introduced in the new release which is being tracked in
python-pillow/Pillow#7259 where it's trying to return a jpeg
representation of the object from the RGBA data loaded from a PNG. Until
the issue is resolved upstream in pillow this commit just caps the
version we run in CI via the constraints file. While pillow is an
optional dependency and we could cap the version in the extras, this
issue isn't severe enough to warrant that, and the typical pillow usage,
especially via the rustworkx api (i.e. graphviz_draw() which returns a
PIL.Image object) will continue to work as expected with pillow 10.0.0
there isn't a reason to cap more broadly. This is just needed as a
workaround to unblock CI.

---------

Co-authored-by: danielleodigie <[email protected]>
Co-authored-by: Matthew Treinish <[email protected]>
  • Loading branch information
3 people authored Jul 17, 2023
1 parent 283a663 commit 14af315
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
decorator==4.4.2
importlib-metadata==4.13.0;python_version<'3.8'
pillow<10.0.0
5 changes: 2 additions & 3 deletions rustworkx-core/src/connectivity/cycle_basis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ where
let mut used: HashMap<G::NodeId, HashSet<G::NodeId>> = HashMap::new();
used.insert(root_index, HashSet::new());
// Walk the spanning tree
while !stack.is_empty() {
// Use the last element added so that cycles are easier to find
let z = stack.pop().unwrap();
// Use the last element added so that cycles are easier to find
while let Some(z) = stack.pop() {
for neighbor in graph.neighbors(z) {
// A new node was encountered:
if !used.contains_key(&neighbor) {
Expand Down

0 comments on commit 14af315

Please sign in to comment.