question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor: Updating subparts of activity to accept object as a parameter instead of dict.

See original GitHub issue

We expect a domain object should only accept dict for the class method from_dict() and we should avoid accepting dict for updating subparts of the object. In the following section we have curated a list of methods that needs to be refactored:

Subtopic: @RafayGhafoor

  • update_page_contents_html
  • update_page_contents_audio

State:

Question:

Skill:


You can follow these steps to complete the work (for each method):

  • Find the place where the method is defined. (*_domain.py where * is the name of the class.)
  • Change the method such that it accepts objects instead of dict (Also, do keep a record of how it’s converting the dict to object as you’ll be using this code later.).
  • Update the docstring of the method.
  • Find all files where this method is used.
  • Update the caller to firstly convert the dict into a domain object, and only then send the domain object as a parameter.
  • Look for the test file where this method is used and update the test files accordingly (you can use git grep to find all the cases where this method is used.)
  • Try running tests for the changed test files.
  • Once the tests pass, you can create a PR!

Pr’s for reference: #8582 #8591 #8699 #7024

Note: For a guide on how to access Oppia’s webpages, see this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:112 (90 by maintainers)

github_iconTop GitHub Comments

2reactions
DubeySandeepcommented, Jul 19, 2019

@RafayGhafoor, Thanks for the updates. (/cc @apb7 [onboarding mentor])

1reaction
DubeySandeepcommented, Sep 28, 2019

@RafayGhafoor, Yeah sure! 😃

I’ve assigned you to remaining parts of this issue, you can check the header comment of this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Is it better practice to pass sometimes complex dicts ...
Yes, it is very usual to pass a dictionary to Python functions in order to reduce the number of arguments. Dictionary-style configuration ...
Read more >
Dictionaries in Python - Real Python
In this Python dictionaries tutorial, you'll cover the basic characteristics and learn how to access and manage dictionary data. Once you have finished...
Read more >
Groovy Language Documentation
String , but we pass a groovy.lang.GString instance, the toString() method of the GString is automatically and transparently called.
Read more >
Are there guidelines on how many parameters a function ...
I've never seen a guideline, but in my experience a function that takes more than three or four parameters indicates one of two...
Read more >
Solutions to Exercises - Springer Link
Arity is the number of arguments passed to a constructor or method or the ... List<Object>, you cannot pass an object whose type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found