Refactor json_beau() with flexible indentation
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 16
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
A hardcoded 4 space can look awkward - so adding an indentation property defaulting to 4 makes it possible to use another value in the call.
diff --git a/mdd.py b/mdd.py
index cb9f3c1..cfb1de8 100644
--- a/mdd.py
+++ b/mdd.py
@@ -24,8 +24,8 @@ from dateutil import parser as date_parser
inxi = None
-def json_beaut(input, sort_keys=False):
- return json.dumps(input, indent=4, sort_keys=sort_keys)
+def json_beaut(input, sort_keys=False, indent=4):
+ return json.dumps(input, indent=indent, sort_keys=sort_keys)
def prepare_inxi():
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open mdd.py and inspect json_beaut(), which currently passes a fixed indentation value to json.dumps(). Confirm the default output remains four spaces while calls can provide another indentation value, then check the function's callers for compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100