Ticket #9067 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Config keys

Reported by: Owen Arnold Owned by: Dan Nixon
Priority: major Milestone: Release 3.4
Component: Python Keywords:
Cc: Blocked By:
Blocking: Tester: Harry Jeffery

Description

This is a suggestion that I personally would find quite useful - lets see how it fares with the triage stages.

The config dictionary-like object exposed to python doesn't have a keys() method. This makes it very hard to figure out what keys are available to extract values for. I think a keys() method would make this type more pythonic.

Change History

comment:1 Changed 7 years ago by Nick Draper

  • Status changed from new to assigned
  • Owner changed from Anyone to Martyn Gigg

comment:2 Changed 5 years ago by Dan Nixon

  • Owner changed from Martyn Gigg to Dan Nixon
  • Milestone changed from Backlog to Release 3.4

comment:3 Changed 5 years ago by Dan Nixon

  • Status changed from assigned to inprogress

Add ConfigService.keys() function

Refs #9067

Changeset: 93d8524ba7168ae9e84582ed3b072b89678d4994

comment:4 Changed 5 years ago by Dan Nixon

Clang format Refs #9067

Changeset: e0525f2bb9f6c200787d5ef0638ee8d2382aa150

comment:5 Changed 5 years ago by Dan Nixon

Work recursively as nesting length is not constant

Refs #9067

Changeset: dfd22f0bd180d2a5b9d6babaac9b9b2d9332b7d5

comment:6 Changed 5 years ago by Dan Nixon

  • Status changed from inprogress to verify
  • Resolution set to fixed

This is being verified as pull request #585.

comment:7 Changed 5 years ago by Harry Jeffery

  • Status changed from verify to verifying
  • Tester set to Harry Jeffery

comment:8 Changed 5 years ago by Harry Jeffery

Something to consider:

It looks like getKeysRecursive could/should be private to the class. You could also change its type to void getKeysRecursive(const std::string& root, std::vector<std::string>& keys). That way it can insert the keys into the output keys vector directly, and just pass the reference down the layers. It would save on the construction/destruction of the vector for each call, and you don't have to copy the keys around each time you move up a layer.

comment:9 Changed 5 years ago by Dan Nixon

Good point on the vector allocation, I was keeping getKeysRecursive as similar as possible to the existing getKeys but I think the scope of how useful it actually is is limited.

comment:10 Changed 5 years ago by Dan Nixon

Better ahndling of vectors

Refs #9067

Changeset: 431ecbe6a3e8f08cac9e927b66a81a9e7b14370d

comment:11 Changed 5 years ago by Dan Nixon

Fix possible Coverity issue

Refs #9067

Changeset: afee32f39244a6c82405081e19aefbd8ca20bb99

comment:12 Changed 5 years ago by Harry Jeffery

  • Status changed from verifying to closed

Merge pull request #585 from mantidproject/9067_configservice_keys_python_api

Add keys() method to ConfigService

Full changeset: 19ff857cbb0944afd11d12ee83e0475f1380ccb3

comment:13 Changed 5 years ago by Dan Nixon

Add ConfigService.keys() function

Refs #9067

Changeset: 9fbcf5c078243b44c13a4917d0ed4fb148e21475

comment:14 Changed 5 years ago by Dan Nixon

Clang format Refs #9067

Changeset: 3a1d44537a95217e7e3f7d31421ded0784e5b408

comment:15 Changed 5 years ago by Dan Nixon

Work recursively as nesting length is not constant

Refs #9067

Changeset: b5ff8c338bb3433889bff875c18c9aa16af230a3

comment:16 Changed 5 years ago by Dan Nixon

Better ahndling of vectors

Refs #9067

Changeset: ebd24b919475c1ada60636a715c22bfd41f3cac0

comment:17 Changed 5 years ago by Dan Nixon

Fix possible Coverity issue

Refs #9067

Changeset: 226b6d32b63558f4bc9482a2fa2d1175e87177cc

comment:18 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9910

Note: See TracTickets for help on using tickets.