-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2394: Add docstring to core.domain.user_jobs_continous.py #3569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @shubha1593 -- this is a great start! Please see inline comments.
core/domain/user_jobs_continuous.py
Outdated
user_id: str. The unique ID of the user | ||
|
||
Returns: | ||
tuple(job_queued_msec, output): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tuple(float, list(dict)). A 2-tuple with the following entries:
- float. The time, in milliseconds since the Epoch, when the job was queued.
- list(dict). A list of ... with keys:
- 'type': str. Either ...
- 'activity_id': str. The ID of the ...
- ...
Note, for the second arg, how the types of each key of the dict are specified. The descriptions for the other fields need to be completed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
type, such as feconf.UPDATE_TYPE_EXPLORATION_COMMIT. | ||
delete_commit_message: This (string) represents the commit message | ||
delete_commit_message: str. This represents the commit message | ||
to use when an activity is found to be deleted, such as | ||
feconf.COMMIT_MESSAGE_EXPLORATION_DELETED. | ||
|
||
Returns: | ||
A tuple with two entries: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above for notes on format:
tuple(...). A tuple with two entries:
- ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
Computes most recent activity commits and feedbacks of a spcecific user. | ||
|
||
Args: | ||
item: The parameter passed to this function is a single element of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just say:
item: UserSubscriptionsModel. An instance of UserSubscriptionsModel.
Seems more concrete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
|
||
Returns: | ||
This function may yield as many times as appropriate (including zero) | ||
the key/value 2-tuples. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the key/value 2-tuples. For example" --> "2-tuples in the format"
and combine into a single sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
For example, (reducer_key, recent_activity_commit_dict) where | ||
reducer_key: str. This is of the form 'user_id@job_queued_msec' | ||
recent_activity_commit_dict: dictionary with the following keys | ||
- 'type': The value of the commit_type argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add type info (see above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
Returns: | ||
This function may yield as many times as appropriate the key/value 2-tuples. | ||
For example, (id, exploration_data) where | ||
id: str. The unique id of contributor or owner of the exploration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reframe this so that it's more centered on the user, rather than on the exploration. E.g.:
id: str. A user ID.
exploration_data: dict. A dict that includes entries for all the explorations that this user contributes to or owns. Each entry has the following keys: ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
- 'num_ratings_for_owned_exp': int. Total number of ratings for the | ||
exploration | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
stringified_values: A list of information regarding all the explorations | ||
owned by user. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
of ratings across all explorations and average rating. | ||
|
||
Args: | ||
key: str. The unique id of user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add period at end; ditto elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/user_jobs_continuous.py
Outdated
@@ -520,6 +594,17 @@ def map(item): | |||
|
|||
@staticmethod | |||
def reduce(key, stringified_values): | |||
"""Implements the reduce function. | |||
This function creates or updates the UserStatsModel instance for the given |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newline above this one (since it's a new paragraph).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Codecov Report
@@ Coverage Diff @@
## develop #3569 +/- ##
===========================================
- Coverage 44.85% 44.84% -0.01%
===========================================
Files 257 257
Lines 19871 19873 +2
Branches 3131 3132 +1
===========================================
Hits 8913 8913
- Misses 10958 10960 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shubha1593! This is looking great; I've taken a first pass and made a few more notes, but they're mostly on small things. PTAL?
core/domain/user_jobs_continuous.py
Outdated
|
||
Returns: | ||
tuple(float, list(dict)). A 2-tuple with following entries: | ||
-float. The time, in milliseconds since the Epoch, when the job was queued. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: here and below, please add a single space after each "-".
core/domain/user_jobs_continuous.py
Outdated
-'activity_id': str. The ID of the exploration being committed to or | ||
to which the feedback thread belongs. | ||
-'activity_title': str. The title of the activity. | ||
-'last_updated_ms': float. The time when the update was made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The time when the update was made, in milliseconds since the Epoch.
core/domain/user_jobs_continuous.py
Outdated
-'activity_title': str. The title of the activity. | ||
-'last_updated_ms': float. The time when the update was made. | ||
-'author_id': str. The ID of the author who made the update. | ||
-'subject': str. The commit message or message indicating a feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can say: "A brief description of the notification." This automatically covers cases where additional notification types are added in the future.
core/domain/user_jobs_continuous.py
Outdated
was deleted. | ||
- A list containing valid activity model instances which are | ||
mappable to feedback threads | ||
tuple(list(dict), list(*)). A 2-tuple with following entries: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't the elements of the second list have a specific type?
tuple(list(dict), list(ExplorationModel|...|...)).
(where you should enumerate the different classes that can occur in the second argument).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, do you want me to specify all the models in the argument ?
('activity', 'audit', 'base_model', 'classifier', 'collection', 'config',
'email', 'exploration', 'feedback', 'file', 'job', 'recommendations',
'statistics', 'user')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, just the specific model classes that are processed in this job and that can appear in this tuple.
core/domain/user_jobs_continuous.py
Outdated
mappable to feedback threads | ||
tuple(list(dict), list(*)). A 2-tuple with following entries: | ||
-list(dict): A list, having information for every activity in | ||
activity_ids_list. Dict have the following keys: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dict have --> Each dict in this list has
core/domain/user_jobs_continuous.py
Outdated
- 'total_plays': # of times the user's explorations were played | ||
- 'num_ratings': # of times the user's explorations were started | ||
- 'average_ratings': average of average ratings across all explorations | ||
'total_plays': int. # of times the user's explorations were played. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--> Number; ditto in next line.
core/domain/user_jobs_continuous.py
Outdated
|
||
Yields: | ||
This function may yield as many times as appropriate 2-tuples in the | ||
format: (str, dict) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto (see a previous comment) re punctuation.
core/domain/user_jobs_continuous.py
Outdated
-dict: A dict that includes entries for all the explorations that this | ||
user contributes to or owns. Each entry has the following keys: | ||
- 'exploration_impact_score': float. The impact score of all the | ||
explorations contributed to by the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be indented by 4 from the previous line. Similarly below.
core/domain/user_jobs_continuous.py
Outdated
|
||
Args: | ||
key: str. The unique ID of the user. | ||
stringified_values: list(str(dict)). A list of information regarding all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment re type info.
core/domain/user_jobs_continuous.py
Outdated
the explorations that this user contributes to or owns. Each entry is | ||
a stringified dict having the following keys: | ||
- 'exploration_impact_score': float. The impact score of all the | ||
explorations contributed to by the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto re indentation.
@seanlip made the modifications, please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks excellent, LGTM. Thank you, @shubha1593!
Or rather ... almost excellent. I'm afraid the lint checks fail; please take a look at the logs. (Did the lint checks not run automaticaly before you pushed?) Assigning this to @AllanYangZhou to merge once the lint checks are fixed. |
Hi @shubha1593, have you had a chance to look at the lint errors and correct them? Looks like the only issue is that some lines are too long, once that's fixed I can merge it in. |
Hi @AllanYangZhou, I am having issues with my machine, need to format it. I will fix the lint errors by today or tomorrow definitely. |
Understood, thanks! |
Hi @AllanYangZhou, Fixed the lint errors. |
Nice, thanks! |
…date * upstream/develop: (32 commits) Remove erroneous clause in app.yaml. (oppia#3643) Part of oppia#2447: Upgrade select2 library (oppia#3626) Fix part of oppia#2394: Added docstrings in exp_domain.py (oppia#3578) Fix oppia#3618: stop icon overlap (oppia#3642) Add backend functionality to correctly handle needs_update part of subtitled HTML. (oppia#3620) Change 'style' to 'ng-attr-style' in an attempt to fix IE bug in collection viewer. (oppia#3636) Fix typo in Exploration editor (oppia#3637) Update credits (oppia#3633) Fix oppia#2639: Updated Google chart/visualization Library loader code and use async to load the library (oppia#3614) Fix user bios job in the case that user_bio is None (oppia#3632) Update changelog and credits for release 2.5.2 (oppia#3628) Fix oppia#2394: Add docstring to core.domain.user_jobs_continous.py (oppia#3569) Fix oppia#3585: Corrected arrows in exploration progress nav (oppia#3605) change the text edit error message Corrected tense of error message Corrected state to read card Close modal window if clicked outside (oppia#3623) Storage, Domain classes and helper functions for ClassifierExplorationMapping (oppia#3583) removed super admin role from admin interface. (oppia#3621) ...
Fix #2394 : Add docstring for the functions in proper format.