Skip to content

Conversation

@ccoffrin
Copy link
Member

@jbarberia an FYI just for your general knowledge.

When running the package tests I was getting this warning,

Testing Running tests...
┌ Warning: `sort(d::Dict; args...)` is deprecated, use `sort!(OrderedDict(d); args...)` instead.
│   caller = ip:0x0
└ @ Core :-1

Interestingly this only shows up from inside the package manager, i.e. ] test PowerModels.

I tracked it down to the calls in the pti_export feature like this one, sort(data["bus"], by = (x) -> parse(Int64, x)).

There are many possible fixes to the issue but the simple one in this situation is to "collect" the dict elements into an array before sorting them.

Additionally, a PowerModels specific tip, we have a convention that every component has a field called "index" that is the integer version of the component's id. Using this we can avoid the parsing of the dict key in many cases. In this case by = (x) -> parse(Int64, x.first) can be replaced by by = (x) -> x.second["index"]

@codecov
Copy link

codecov bot commented Nov 29, 2021

Codecov Report

Merging #801 (90aba6e) into master (5243b2a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #801   +/-   ##
=======================================
  Coverage   94.04%   94.04%           
=======================================
  Files          42       42           
  Lines        9800     9801    +1     
=======================================
+ Hits         9216     9217    +1     
  Misses        584      584           
Impacted Files Coverage Δ
src/io/psse.jl 97.29% <100.00%> (+<0.01%) ⬆️
src/io/pti.jl 90.98% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5243b2a...90aba6e. Read the comment docs.

@jbarberia
Copy link
Contributor

@ccoffrin , Thanks for the information!
I will take it into account for future contributions.

@ccoffrin ccoffrin merged commit 463b9cb into master Nov 29, 2021
@ccoffrin ccoffrin deleted the fix-sort-dep branch November 29, 2021 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants