microsoft / microsoft/knack

util.todict process DefaultInt to a dictionary instead of a int

Open
#215 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
358
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Not sure if this is a bug, or expected behavior.
When executing the example exapp

> knack_test.py hello world
Are you sure you want to perform this operation? (y/n): y
[
  "hello",
  "world",
  {
    "isDefault": true
  },
  null
]

Here the argument myarg is returned and during the processing of the command return. Then, util.todict is used to process it and since the real type of myarg is DefaultInt the int default value of 100 is not printed in the screen but instead the dictionary { "isDefault": true }, which comes from myarg.__dict__

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the examples/exapp command and the util.todict processing described in the report, then trace how a DefaultInt value is serialized in the command result. Confirm whether the intended output is the integer default value of 100 rather than the {"isDefault": true} dictionary, and add coverage for the observed case. Done when the example produces the agreed representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.