ni / ni/nimi-python

Implementation of __repr__ for custom types in nifake should be updated to use `__module__` and `__qualname__`

Open
#1,444 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ni-internal
Dominant language
Python
Stars
128
Forks
110
Avg merge
5d 14h
Merged PRs (30d)
10

Description

Description of issue

Best practice for implementing __repr__ for custom types is to use
__module__ and __qualname__.

By including __module__ in __repr__, eval(repr(CustomType()))
can be called by importing nifake as import nifake; which is
consistent with recommended import style of nimi-python.

Related issue for making similar change in released modules: #1443

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

Inspect the custom type implementations in nifake and compare the related released-module change described in issue #1443. Update the representations to use module and qualname; done means eval(repr(CustomType())) works when nifake is imported as import nifake.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.