Skip to content
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

[pre-commit.ci] pre-commit autoupdate #493

Merged
merged 4 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ default_language_version:
python: python3.10
node: 16.14.2

ci:
skip: [generate-schemas]
autoupdate_schedule: "monthly"

repos:
- repo: https://github.com/ambv/black
rev: 23.7.0
- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black
name: Blacken
args: ["--config", "pyproject.toml"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: (pydatalab/example_data/)|(.*.snap)
Expand All @@ -26,20 +30,20 @@ repos:
- id: check-symlinks
- id: mixed-line-ending

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.281"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.4"
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.6.2
rev: v3.0.3
hooks:
- id: prettier
types_or: [javascript, jsx, vue, html, yaml]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.6.1
hooks:
- id: mypy
additional_dependencies: ["types-all", "pydantic~=1.10"]
Expand Down
38 changes: 19 additions & 19 deletions webapp/cypress/e2e/batchSampleFeature.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ function deleteSample(sample_id, delay = 100) {

function getBatchAddCell(row, column, additionalSelectors = "") {
return cy.get(
`[data-testid=batch-add-table] > tbody > tr:nth-of-type(${row}) > td:nth-of-type(${column}) ${additionalSelectors}`
`[data-testid=batch-add-table] > tbody > tr:nth-of-type(${row}) > td:nth-of-type(${column}) ${additionalSelectors}`,
);
}

function getBatchTemplateCell(column, additionalSelectors = "") {
return cy.get(
`[data-testid=batch-add-table-template] > tbody > td:nth-of-type(${column}) ${additionalSelectors}`
`[data-testid=batch-add-table-template] > tbody > td:nth-of-type(${column}) ${additionalSelectors}`,
);
}

function getBatchAddError(row, additionalSelectors = "") {
return cy.get(
`[data-testid=batch-add-table] > tbody > tr:nth-of-type(${row}) + td ${additionalSelectors}`
`[data-testid=batch-add-table] > tbody > tr:nth-of-type(${row}) + td ${additionalSelectors}`,
);
}

Expand Down Expand Up @@ -279,7 +279,7 @@ describe("Batch sample creation", () => {
// sample with two components, copied from a sample with no components
getBatchAddCell(2, 1).type("test102");
getBatchAddCell(2, 2).type(
"sample with two components, copied from a sample with no components"
"sample with two components, copied from a sample with no components",
);
getBatchAddCell(2, 4, ".vs__search").type("baseA");
cy.get(".vs__dropdown-menu").within(() => {
Expand All @@ -297,7 +297,7 @@ describe("Batch sample creation", () => {
// sample with one components, copied from a sample with two components
getBatchAddCell(3, 1).type("test103");
getBatchAddCell(3, 2).type(
"sample with one component, copied from a sample with two components"
"sample with one component, copied from a sample with two components",
);
getBatchAddCell(3, 4, ".vs__search").type("baseB");
cy.get(".vs__dropdown-menu").within(() => {
Expand All @@ -311,7 +311,7 @@ describe("Batch sample creation", () => {
// sample with three components, copied from a sample with some of the same components
getBatchAddCell(4, 1).type("test104");
getBatchAddCell(4, 2).type(
"sample with three components, copied from a sample with some of the same components"
"sample with three components, copied from a sample with some of the same components",
);
getBatchAddCell(4, 4, ".vs__search").type("baseB");
cy.get(".vs__dropdown-menu").within(() => {
Expand Down Expand Up @@ -352,7 +352,7 @@ describe("Batch sample creation", () => {
cy.contains("test102").click();
cy.findByLabelText("Name").should(
"have.value",
"sample with two components, copied from a sample with no components"
"sample with two components, copied from a sample with no components",
);
cy.contains("this is a description of baseA.");
cy.get("#synthesis-information table").contains("component1");
Expand All @@ -365,7 +365,7 @@ describe("Batch sample creation", () => {
cy.contains("test103").click();
cy.findByLabelText("Name").should(
"have.value",
"sample with one component, copied from a sample with two components"
"sample with one component, copied from a sample with two components",
);
cy.contains("this is a description of baseB.");
cy.get("#synthesis-information table").contains("component1");
Expand All @@ -376,19 +376,19 @@ describe("Batch sample creation", () => {

cy.get("#synthesis-information tbody tr:nth-of-type(1) td:nth-of-type(2) input").should(
"have.value",
"30"
"30",
);
cy.get("#synthesis-information tbody tr:nth-of-type(1) td:nth-of-type(3) input").should(
"have.value",
"g"
"g",
);
cy.get("#synthesis-information tbody tr:nth-of-type(2) td:nth-of-type(2) input").should(
"have.value",
"100"
"100",
);
cy.get("#synthesis-information tbody tr:nth-of-type(2) td:nth-of-type(3) input").should(
"have.value",
"g"
"g",
);

cy.findByText("a comment is added here.");
Expand All @@ -398,7 +398,7 @@ describe("Batch sample creation", () => {
cy.contains("test104").click();
cy.findByLabelText("Name").should(
"have.value",
"sample with three components, copied from a sample with some of the same components"
"sample with three components, copied from a sample with some of the same components",
);
cy.contains("this is a description of baseB.");
cy.get("#synthesis-information table").contains("component2");
Expand All @@ -408,27 +408,27 @@ describe("Batch sample creation", () => {

cy.get("#synthesis-information tbody tr:nth-of-type(1) td:nth-of-type(2) input").should(
"have.value",
"30"
"30",
);
cy.get("#synthesis-information tbody tr:nth-of-type(1) td:nth-of-type(3) input").should(
"have.value",
"g"
"g",
);
cy.get("#synthesis-information tbody tr:nth-of-type(2) td:nth-of-type(2) input").should(
"have.value",
"100"
"100",
);
cy.get("#synthesis-information tbody tr:nth-of-type(2) td:nth-of-type(3) input").should(
"have.value",
"g"
"g",
);
cy.get("#synthesis-information tbody tr:nth-of-type(3) td:nth-of-type(2) input").should(
"have.value",
""
"",
);
cy.get("#synthesis-information tbody tr:nth-of-type(3) td:nth-of-type(3) input").should(
"have.value",
"g"
"g",
);

cy.findByText("a description of the synthesis here");
Expand Down
26 changes: 13 additions & 13 deletions webapp/cypress/e2e/editPage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ describe("Edit Page", () => {

cy.get("#synthesis-information tbody tr:nth-of-type(1) td:nth-of-type(2) input").should(
"have.value",
10
10,
);
cy.get("#synthesis-information tbody tr:nth-of-type(1) td:nth-of-type(3) input").should(
"have.value",
"mL"
"mL",
);
cy.get("#synthesis-information tbody tr:nth-of-type(2) td:nth-of-type(2) input").should(
"have.value",
0.001
0.001,
);
cy.get("#synthesis-information tbody tr:nth-of-type(2) td:nth-of-type(3) input").should(
"have.value",
"pints"
"pints",
);
});

Expand All @@ -141,11 +141,11 @@ describe("Edit Page", () => {
cy.get("#synthesis-information tbody > tr").should("have.length", 2);
cy.get("#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input").should(
"have.value",
0.001
0.001,
);
cy.get("#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(3) input").should(
"have.value",
"pints"
"pints",
);

cy.get("#synthesis-information tbody > tr:nth-of-type(1) .close").click();
Expand All @@ -158,7 +158,7 @@ describe("Edit Page", () => {
cy.get("#synthesis-information").contains("component2");
cy.get("#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input").should(
"have.value",
""
"",
); // should be reset, not a previous value

cy.get("svg.add-row-button").click();
Expand All @@ -169,36 +169,36 @@ describe("Edit Page", () => {
cy.get("#synthesis-information").contains("Na2O");
cy.get("#synthesis-information tbody > tr:nth-of-type(2) td:nth-of-type(2) input").should(
"have.value",
""
"",
); // should be reset, not a previous value
});

it("tries to add a non-numeric value into quantity", () => {
cy.findByText("editable_sample").click();
cy.get("#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input").type(
"100.001"
"100.001",
);
cy.get(
"#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input.red-border"
"#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input.red-border",
).should("not.exist");
cy.get("#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input")
.clear()
.type("1");
cy.get(
"#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input.red-border"
"#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input.red-border",
).should("not.exist");
cy.get("#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input")
.clear()
.type("word");
cy.get(
"#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input.red-border"
"#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input.red-border",
).should("exist");

cy.get("#synthesis-information tbody > tr:nth-of-type(2) td:nth-of-type(2) input")
.clear()
.type("$");
cy.get(
"#synthesis-information tbody > tr:nth-of-type(2) td:nth-of-type(2) input.red-border"
"#synthesis-information tbody > tr:nth-of-type(2) td:nth-of-type(2) input.red-border",
).should("exist");

cy.get("#synthesis-information tbody > tr:nth-of-type(1) td:nth-of-type(2) input")
Expand Down
4 changes: 2 additions & 2 deletions webapp/cypress/e2e/sampleTablePage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("Sample table page", () => {
cy.request({ url: `${API_URL}/get-item-data/12345678910`, failOnStatusCode: false }).then(
(resp) => {
expect(resp.status).to.be.gte(400).lt(500);
}
},
);
});

Expand Down Expand Up @@ -203,7 +203,7 @@ describe("Sample table page", () => {
cy.request({ url: `${API_URL}/get-item-data/_122rwre`, failOnStatusCode: false }).then(
(resp) => {
expect(resp.status).to.be.gte(400).lt(500);
}
},
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion webapp/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/CollectionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default {
deleteCollection(collection) {
if (
confirm(
`Are you sure you want to delete collection "${collection.collection_id}"?\nThis will not delete any items.`
`Are you sure you want to delete collection "${collection.collection_id}"?\nThis will not delete any items.`,
)
) {
deleteCollection(collection.collection_id, collection);
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/CreateSampleModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default {
this.name,
startingCollection,
extraData,
this.selectedItemToCopy && this.selectedItemToCopy.item_id
this.selectedItemToCopy && this.selectedItemToCopy.item_id,
)
.then(() => {
this.$emit("update:modelValue", false); // close this modal
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/FancyCollectionSampleTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default {
const idsSelected = this.itemsSelected.map((x) => x.item_id);
if (
confirm(
`Are you sure you want to remove ${this.itemsSelected.length} selected items (${idsSelected}) from this collection?`
`Are you sure you want to remove ${this.itemsSelected.length} selected items (${idsSelected}) from this collection?`,
)
) {
console.log("deleting...");
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/FancySampleTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default {
const idsSelected = this.itemsSelected.map((x) => x.item_id);
if (
confirm(
`Are you sure you want to delete ${this.itemsSelected.length} selected items (${idsSelected})?`
`Are you sure you want to delete ${this.itemsSelected.length} selected items (${idsSelected})?`,
)
) {
console.log("deleting...");
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/FileSelectDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
updateBlockFromServer(
this.item_id,
this.block_id,
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id]
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id],
);
}
},
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/FileSelectModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
oldest_cache_update = new Date(response_json.meta.oldest_cache_update + "Z");
seconds_since_oldest_update = (new Date() - oldest_cache_update) / 1000;
console.log(
`loadCachedTree received, oldest dir update was ${seconds_since_oldest_update} s ago`
`loadCachedTree received, oldest dir update was ${seconds_since_oldest_update} s ago`,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/ItemGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default {
"background-color",
element.data("special") == 1
? itemTypes[element.data("type")].lightColor
: itemTypes[element.data("type")].navbarColor
: itemTypes[element.data("type")].navbarColor,
);
element.style("border-width", element.data("special") == 1 ? 2 : 0);
element.style("border-color", "grey");
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/MessageBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default {
const { svg } = await mermaid.render(
"mermaid_" + Math.floor(Math.random() * 1000000),
el.textContent,
el
el,
);
el.innerHTML = svg;
});
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/datablocks/ChatBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default {
await updateBlockFromServer(
this.item_id,
this.block_id,
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id]
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id],
);
this.isLoading = false;
},
Expand All @@ -144,7 +144,7 @@ export default {
await updateBlockFromServer(
this.item_id,
this.block_id,
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id]
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id],
).catch(() => {
this.messages.push(last_message);
});
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/datablocks/CycleBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export default {
updateBlockFromServer(
this.item_id,
this.block_id,
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id]
this.$store.state.all_item_data[this.item_id]["blocks_obj"][this.block_id],
).then(() => {
this.bokehPlotLimitedWidth = this.derivative_mode != "dQ/dV";
this.isReplotButtonDisplayed = false;
Expand Down
Loading
Loading