Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishav Chakraborty committed Jul 28, 2019
2 parents d7d2cc1 + ba5bfd0 commit aa703ae
Show file tree
Hide file tree
Showing 17 changed files with 147 additions and 62 deletions.
32 changes: 16 additions & 16 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@


# Dev workflow team.
/.circleci/ @apb7
/.eslintignore @apb7
/.eslintrc @apb7
/.htmllintrc @apb7
/.coveragerc @apb7
/.gitattributes @apb7
/.gitignore @apb7
/.isort.cfg @apb7
/.pylintrc @apb7
/.stylelintrc @apb7
/.travis.yml @apb7
/.circleci/ @kevinlee12
/.eslintignore @kevinlee12
/.eslintrc @kevinlee12
/.htmllintrc @kevinlee12
/.coveragerc @kevinlee12
/.gitattributes @kevinlee12
/.gitignore @kevinlee12
/.isort.cfg @kevinlee12
/.pylintrc @kevinlee12
/.stylelintrc @kevinlee12
/.travis.yml @kevinlee12
/codecov.yml @lilithxxx
/core/templates/dev/head/css/.stylelintrc @apb7
/tox.ini @apb7
/scripts/ @apb7
/Vagrantfile @apb7
/core/templates/dev/head/css/.stylelintrc @kevinlee12
/tox.ini @kevinlee12
/scripts/ @kevinlee12
/Vagrantfile @kevinlee12


# Exploration project.
Expand Down Expand Up @@ -354,7 +354,7 @@


# QA team.
/core/tests/ @apb7 @nithusha21
/core/tests/ @kevinlee12 @nithusha21
/assets/ @nithusha21
/data/ @nithusha21

Expand Down
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [ ] The linter/Karma presubmit checks have passed.
- These should run automatically, but if not, you can manually trigger them locally using `python scripts/pre_commit_linter.py` and `bash scripts/run_frontend_tests.sh`.
- [ ] The PR is made from a branch that's **not** called "develop".
- [ ] The PR has an appropriate "PROJECT: ..." label (Please add this label for the first-pass review of the PR).
- [ ] The PR has an appropriate "CHANGELOG: ..." label (If you are unsure of which label to add, ask the reviewers for guidance).
- [ ] The PR follows the [style guide](https://github.com/oppia/oppia/wiki/Coding-style-guide).
- [ ] The PR addresses the points mentioned in the codeowner checks for the files/folders changed. (See the [codeowner's wiki page](https://github.com/oppia/oppia/wiki/Oppia%27s-code-owners-and-checks-to-be-carried-out-by-developers).)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ coverage.xml
.vscode/*
libpeerconnection.log
tsc_output_log.txt
tmpcompiledjs*
uploads/*
venv/
*.db
Expand Down
5 changes: 3 additions & 2 deletions core/domain/exp_domain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,9 @@ def test_validation(self):
self._assert_validation_error(
exploration, 'Expected answer group rules to be a list')

init_state.interaction.answer_groups[0].tagged_skill_misconception_id = None # pylint: disable=line-too-long
init_state.interaction.answer_groups[0].rule_specs = []
first_answer_group = init_state.interaction.answer_groups[0]
first_answer_group.tagged_skill_misconception_id = None
first_answer_group.rule_specs = []
self._assert_validation_error(
exploration,
'There must be at least one rule or training data for each'
Expand Down
4 changes: 2 additions & 2 deletions core/domain/state_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def __init__(
training_data: list(*). List of answers belonging to training
data of this answer group.
tagged_skill_misconception_id: str or None. The format is
'<skill_id>-<misconeption_id>', where skill_id is the skill ID
of the tagged misconception and misconeption_id is the id of
'<skill_id>-<misconception_id>', where skill_id is the skill ID
of the tagged misconception and misconception_id is the id of
the tagged misconception for the answer group. It is not None
only when a state is part of a Question object that
tests a particular skill.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import { downgradeInjectable } from '@angular/upgrade/static';
import { Injectable } from '@angular/core';

export class AnswerClassificationResult {
// TODO(#7165): Replace 'any' with the exact type. This has been kept as
// 'any' because 'outcome' is an outcome domain object and this can be
// directly typed to 'Outcome' type once 'OutcomeObjectFactory' is upgraded.
outcome: any;
answerGroupIndex: number;
ruleIndex: number;
Expand All @@ -40,9 +43,12 @@ export class AnswerClassificationResult {
providedIn: 'root'
})
export class AnswerClassificationResultObjectFactory {
// TODO(#7165): Replace 'any' with the exact type. This has been kept as
// 'any' because 'outcome' is an outcome domain object and this can be
// directly typed to 'Outcome' type once 'OutcomeObjectFactory' is upgraded.
createNew(
outcome: any, answerGroupIndex: number, ruleIndex: number,
classificationCategorization: string) {
classificationCategorization: string): AnswerClassificationResult {
return new AnswerClassificationResult(
outcome, answerGroupIndex, ruleIndex, classificationCategorization);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import { Injectable } from '@angular/core';

export class Classifier {
algorithmId: string;
// TODO(#7176): Replace 'any' with the exact type. This has been kept as
// 'any' because 'classifierData' is a dict with underscore_cased keys which
// give tslint errors against underscore_casing in favor of camelCasing.
classifierData: any;
dataSchemaVersion: number;

Expand All @@ -37,7 +40,12 @@ export class Classifier {
providedIn: 'root'
})
export class ClassifierObjectFactory {
create(algorithmId: string, classifierData: any, dataSchemaVersion: number) {
// TODO(#7176): Replace 'any' with the exact type. This has been kept as
// 'any' because 'classifierData' is a dict with underscore_cased keys which
// give tslint errors against underscore_casing in favor of camelCasing.
create(
algorithmId: string, classifierData: any,
dataSchemaVersion: number): Classifier {
return new Classifier(algorithmId, classifierData, dataSchemaVersion);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export class PredictionResult {
providedIn: 'root'
})
export class PredictionResultObjectFactory extends PredictionResult {
createNew(label: number, confidence: number) {
createNew(label: number, confidence: number): PredictionResult {
return new PredictionResult(label, confidence);
}
getLabel() {
getLabel(): number {
return this.predictionLabel;
}
getConfidence() {
getConfidence(): number {
return this.predictionConfidence;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,23 @@
import { downgradeInjectable } from '@angular/upgrade/static';
import { Injectable } from '@angular/core';

export interface IExplorationDraftDict {
// TODO(#7165): Replace 'any' with the exact type. This has been typed
// as 'any' since 'draftChanges' is an array of dicts with possible
// underscore_cased keys. A thorough check needs to be done to assure of
// its exact type.
draftChanges: any;
draftChangeListId: number
}

export class ExplorationDraft {
// TODO(#7165): Replace 'any' with the exact type. This has been typed
// as 'any' since 'draftChanges' is an array of dicts with possible
// underscore_cased keys. A thorough check needs to be done to assure of
// its exact type.
draftChanges: any;
draftChangeListId: number;

constructor(draftChanges: any, draftChangeListId: number) {
this.draftChanges = draftChanges;
this.draftChangeListId = draftChangeListId;
Expand All @@ -37,10 +51,14 @@ export class ExplorationDraft {
* @returns {Boolean} - True iff the currentDraftId is the same as the
* draftChangeListId corresponding to this draft.
*/
isValid(currentDraftId: number) {
isValid(currentDraftId: number): boolean {
return (currentDraftId === this.draftChangeListId);
}
getChanges() {
// TODO(#7165): Replace 'any' with the exact type. This has been typed
// as 'any' since 'draftChanges' is an array of dicts with possible
// underscore_cased keys. A thorough check needs to be done to assure of
// its exact type.
getChanges(): any {
return this.draftChanges;
}
}
Expand All @@ -49,12 +67,18 @@ export class ExplorationDraft {
providedIn: 'root'
})
export class ExplorationDraftObjectFactory {
createFromLocalStorageDict(explorationDraftDict: any) {
createFromLocalStorageDict(
explorationDraftDict: IExplorationDraftDict): ExplorationDraft {
return new ExplorationDraft(
explorationDraftDict.draftChanges,
explorationDraftDict.draftChangeListId);
}
toLocalStorageDict(changeList: any, draftChangeListId: number) {
toLocalStorageDict(
// TODO(#7165): Replace 'any' with the exact type. This has been typed
// as 'any' since 'changeList' is an array of dicts with possible
// underscore_cased keys. A thorough check needs to be done to assure of
// its exact type.
changeList: any, draftChangeListId: number): IExplorationDraftDict {
return {
draftChanges: changeList,
draftChangeListId: draftChangeListId
Expand Down
15 changes: 12 additions & 3 deletions core/templates/dev/head/domain/exploration/RuleObjectFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ import { Injectable } from '@angular/core';

export class Rule {
type: string;
// TODO(#7165): Replace 'any' with the exact type. This has been typed
// as 'any' since 'inputs' is a complex object having varying types. A general
// type needs to be found.
inputs: any;
constructor(type: string, inputs: any) {
this.type = type;
this.inputs = inputs;
}
toBackendDict() {
// TODO(#7176): Replace 'any' with the exact type. This has been kept as
// 'any' because the return type is a dict with underscore_cased keys which
// gives tslint errors against underscore_casing in favor of camelCasing.
toBackendDict(): any {
return {
rule_type: this.type,
inputs: this.inputs
Expand All @@ -39,10 +45,13 @@ export class Rule {
providedIn: 'root'
})
export class RuleObjectFactory {
createNew(type: string, inputs: any) {
createNew(type: string, inputs: any): Rule {
return new Rule(type, inputs);
}
createFromBackendDict(ruleDict: any) {
// TODO(#7176): Replace 'any' with the exact type. This has been kept as
// 'any' because 'ruleDict' is a dict with underscore_cased keys which
// gives tslint errors against underscore_casing in favor of camelCasing.
createFromBackendDict(ruleDict: any): Rule {
return new Rule(ruleDict.rule_type, ruleDict.inputs);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,22 @@ export class WrittenTranslation {
this.html = html;
this.needsUpdate = needsUpdate;
}
getHtml() {
getHtml(): string {
return this.html;
}
setHtml(html: string) {
setHtml(html: string): void {
this.html = html;
}
markAsNeedingUpdate() {
markAsNeedingUpdate(): void {
this.needsUpdate = true;
}
toggleNeedsUpdateAttribute() {
toggleNeedsUpdateAttribute(): void {
this.needsUpdate = !this.needsUpdate;
}
toBackendDict() {
// TODO(#7176): Replace 'any' with the exact type. This has been kept as
// 'any' because the return type is a dict with underscore_cased keys which
// gives tslint errors against underscore_casing in favor of camelCasing.
toBackendDict(): any {
return {
html: this.html,
needs_update: this.needsUpdate
Expand All @@ -51,9 +54,13 @@ export class WrittenTranslation {
providedIn: 'root'
})
export class WrittenTranslationObjectFactory {
createNew(html: string) {
createNew(html: string): WrittenTranslation {
return new WrittenTranslation(html, false);
}
// TODO(#7176): Replace 'any' with the exact type. This has been kept as
// 'any' because 'translationBackendDict' is a dict with underscore_cased keys
// which gives tslint errors against underscore_casing in favor of
// camelCasing.
createFromBackendDict(translationBackendDict: any) {
return new WrittenTranslation(
translationBackendDict.html,
Expand Down
34 changes: 19 additions & 15 deletions core/templates/dev/head/domain/topic/TopicRightsObjectFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
import { downgradeInjectable } from '@angular/upgrade/static';
import { Injectable } from '@angular/core';

export interface ITopicRights {
isPublished: () => boolean;
canEditTopic: () => boolean;
canPublishTopic: () => boolean;
}

export class TopicRights {
_published: boolean;
_canPublishTopic: boolean;
Expand All @@ -32,26 +38,26 @@ export class TopicRights {
this._canEditTopic = canEditTopic;
}

canEditTopic() {
canEditTopic(): boolean {
return this._canEditTopic;
}
isPublished() {
isPublished(): boolean {
return this._published;
}
canPublishTopic() {
canPublishTopic(): boolean {
return this._canPublishTopic;
}
canEditName() {
canEditName(): boolean {
return this._canPublishTopic;
}
markTopicAsPublished() {
markTopicAsPublished(): void {
if (this._canPublishTopic) {
this._published = true;
} else {
throw new Error('User is not allowed to publish this topic.');
}
}
markTopicAsUnpublished() {
markTopicAsUnpublished(): void {
if (this._canPublishTopic) {
this._published = false;
} else {
Expand All @@ -61,12 +67,7 @@ export class TopicRights {
// Reassigns all values within this topic to match the existing
// topic rights. This is performed as a deep copy such that none of the
// internal, bindable objects are changed within this topic rights.
copyFromTopicRights(
otherTopicRights: {
isPublished: () => boolean;
canEditTopic: () => boolean;
canPublishTopic: () => boolean;
}) {
copyFromTopicRights(otherTopicRights: ITopicRights) {
this._published = otherTopicRights.isPublished();
this._canEditTopic = otherTopicRights.canEditTopic();
this._canPublishTopic = otherTopicRights.canPublishTopic();
Expand All @@ -79,8 +80,11 @@ export class TopicRights {
export class TopicRightsObjectFactory {
// This function takes a JSON object which represents a backend
// topic python dict.
createFromBackendDict(
topicRightsBackendObject: any) {
// TODO(#7176): Replace 'any' with the exact type. This has been kept as
// 'any' because 'topicRightsBackendObject' is a dict with underscore_cased
// keys which give tslint errors against underscore_casing in favor of
// camelCasing.
createFromBackendDict(topicRightsBackendObject: any) {
return new TopicRights(
topicRightsBackendObject.published,
topicRightsBackendObject.can_publish_topic,
Expand All @@ -92,7 +96,7 @@ export class TopicRightsObjectFactory {
// placeholder until the actual topic rights object is fetched from
// the backend. Since it is acting as a placeholder, it should be valid and
// hence the most restrictive rights are given to the object.
createInterstitialRights() {
createInterstitialRights(): TopicRights {
return new TopicRights(false, false, false);
}
}
Expand Down
Loading

0 comments on commit aa703ae

Please sign in to comment.