before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
get onChange() {
return this._onChange;
}
set onChange(handler: OnChangeHandler | undefined) {
if (handler !== undefined && handler.length !== 3) {
throw new Error("onChange() requires three parameters");
}
this._onChange = handler;
}
get onNotify() {
... | Then this.on change && this.onChange(encodedName, value) | }
set onInit(handler: OnInitHandler | undefined) {
if (handler !== undefined && handler.length !== 1) {
throw new Error("onInit() requires one parameter");
}
this._onInit = handler;
}
onInitEvent() {
this.onInit && this.onInit(this);
}
get onChange(... | @@ -80,6 +93,10 @@ export class TaipyApp {
this._onChange = handler;
}
+ onChangeEvent(encodedName: string, value: unknown) {
+ this.onChange && this.onChange(this, encodedName, value); | frontend/taipy-gui/base/src/app.ts | 26 | TypeScript | 0.286 | suggestion | 56 | 51 | 51 | false | Expose websocket decouple frontend | 1,501 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 |
[0.7777777777777778, "#006d2c"],
[0.8888888888888888, "#00441b"],
[1, "#000000"]
]
},
paper_bgcolor: "rgb(255,255,255)",
}
}
describe("Metric Component", () => {
it("renders", async () => {
const {getByTestId} = render(<Metric ... | why not use const {container}=render(...) ? | });
it("processes type and threshold props correctly when type is not linear", async () => {
render(<Metric type="angular" threshold={50} testId="test-id" />);
await waitFor(() => {
const elt = document.querySelector(".angular");
expect(elt).toBeInTheDocument();
... | @@ -11,21 +11,415 @@
* specific language governing permissions and limitations under the License.
*/
-import React from "react";
-import {render} from "@testing-library/react";
+import React, {act} from "react";
+import {render, waitFor, RenderResult} from "@testing-library/react";
import "@testing-library/jest-... | frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx | 26 | TypeScript | 0.143 | question | 43 | 51 | 51 | false | Adding unit test for Metric component | 1,502 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
}
expect(titleElement.textContent).toContain(title);
});
});
it('logs an error when template prop is a malformed JSON string', () => {
const consoleSpy = jest.spyOn(console, 'info');
const malformedJson = "{ key: 'value'";
render(<Metric template={malform... | How does this test the use of the template ? | });
it("processes template_Dark_ prop correctly when theme is dark", async () => {
const darkTheme = createTheme({
palette: {
mode: "dark",
},
});
render(
<ThemeProvider theme={darkTheme}>
<Metric template_Dark_={JSON.... | @@ -11,21 +11,415 @@
* specific language governing permissions and limitations under the License.
*/
-import React from "react";
-import {render} from "@testing-library/react";
+import React, {act} from "react";
+import {render, waitFor, RenderResult} from "@testing-library/react";
import "@testing-library/jest-... | frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx | 26 | TypeScript | 0.143 | question | 44 | 51 | 51 | false | Adding unit test for Metric component | 1,502 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
});
it('processes template_Light_ prop correctly when theme is not dark', async () => {
const lightTheme = createTheme({
palette: {
mode: 'light',
},
});
render(
<ThemeProvider theme={lightTheme}>
<Metric template_Ligh... | I didn't know you could do this ! | /*
* Copyright 2021-2024 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | @@ -11,21 +11,415 @@
* specific language governing permissions and limitations under the License.
*/
-import React from "react";
-import {render} from "@testing-library/react";
+import React, {act} from "react";
+import {render, waitFor, RenderResult} from "@testing-library/react";
import "@testing-library/jest-... | frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx | 26 | TypeScript | 0.143 | suggestion | 33 | 38 | 333 | false | Adding unit test for Metric component | 1,502 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
/*
* Copyright 2021-2024 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | Honestly, for testing purposes, I would have made those far lighter.
But well, go for it.
| /*
* Copyright 2021-2024 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | @@ -12,20 +12,321 @@
*/
import React from "react";
-import {render} from "@testing-library/react";
+import { render, waitFor } from "@testing-library/react";
import "@testing-library/jest-dom";
+import { ThemeProvider } from "@mui/material/styles";
+import { createTheme } from "@mui/material/styles";
import Me... | frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx | 22 | TypeScript | 0.214 | suggestion | 92 | 32 | 47 | false | Adding unit test for Metric component | 1,502 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
try:
expr_hash = self.__expr_to_hash.get(expr, "unknownExpr")
holder_hash = self.__get_holder_hash(holder, expr_hash)
expr_value = _getscopeattr_drill(gui, expr_hash)
holder_value = _getscopeattr(gui, holder_hash, None)
if not isinstance(holder_value, ... | That 'replace' is a bit weak in my opinion.
What if the expression contains the string "\""?
That could be another issue for the time being, honestly. | try:
expr_hash = self.__expr_to_hash.get(expr, "unknownExpr")
holder_hash = self.__get_holder_hash(holder, expr_hash)
expr_value = _getscopeattr_drill(gui, expr_hash)
holder_value = _getscopeattr(gui, holder_hash, None)
if not isinstance(holder_value, ... | @@ -210,15 +210,17 @@ def __evaluate_holder(self, gui: Gui, holder: t.Type[_TaipyBase], expr: str) ->
_warn(f"Cannot evaluate expression {holder.__name__}({expr_hash},'{expr_hash}') for {expr}", e)
return None
- def evaluate_expr(self, gui: Gui, expr: str, lazy_declare: t.Optional[bool] = Fal... | taipy/gui/utils/_evaluator.py | 26 | Python | 0.429 | suggestion | 152 | 51 | 51 | false | support f-strings in lambda | 1,505 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
const { getByRole } = render(<FileSelector label="FileSelectorDrop" />);
const elt = getByRole("button");
// Create a mock DragEvent and add the mock file to the event's dataTransfer.files property
const mockEvent = new Event("drop", { bubbles: true }) as unknown as DragEvent;
Ob... | can't you get this element with the gettext(label) (default of specific) ? | const { getByRole } = render(<FileSelector label="FileSelectorDrop" />);
const elt = getByRole("button");
// Create a mock DragEvent and add the mock file to the event's dataTransfer.files property
const mockEvent = new Event("drop", { bubbles: true }) as unknown as DragEvent;
Ob... | @@ -98,4 +105,180 @@ describe("FileSelector Component", () => {
},
});
});
+ it("handles drag over event", () => {
+ const { getByRole } = render(<FileSelector label="FileSelectorDrag" />);
+ const fileSelector = getByRole("button");
+
+ // Create a mock DragEv... | frontend/taipy-gui/src/components/Taipy/FileSelector.spec.tsx | 26 | TypeScript | 0.214 | question | 74 | 51 | 51 | false | add test cases for FileSelector.tsx | 1,507 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
// Create a mock DragEvent and add the mock file to the event's dataTransfer.files property
const mockEvent = new Event("drop", { bubbles: true }) as unknown as DragEvent;
Object.assign(mockEvent, {
dataTransfer: {
files: [file],
},
});
// ... | is this different from elt = getByRole("button"); ? | // Create a mock DragEvent and add the mock file to the event's dataTransfer.files property
const mockEvent = new Event("drop", { bubbles: true }) as unknown as DragEvent;
Object.assign(mockEvent, {
dataTransfer: {
files: [file],
},
});
// ... | @@ -98,4 +105,180 @@ describe("FileSelector Component", () => {
},
});
});
+ it("handles drag over event", () => {
+ const { getByRole } = render(<FileSelector label="FileSelectorDrag" />);
+ const fileSelector = getByRole("button");
+
+ // Create a mock DragEv... | frontend/taipy-gui/src/components/Taipy/FileSelector.spec.tsx | 26 | TypeScript | 0.214 | question | 52 | 51 | 51 | false | add test cases for FileSelector.tsx | 1,507 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
(event: React.MouseEvent<HTMLButtonElement>) => event.preventDefault(),
[]
);
const muiInputProps = useMemo(
() =>
type == "password"
? {
endAdornment: (
<InputAdornment position="end">
... | Aria-label is used by automatic readers to help people with disabilities.
We need to give it a value that is meaningful
I propose `increment value` (no id) | (event: React.MouseEvent<HTMLButtonElement>) => event.preventDefault(),
[]
);
const muiInputProps = useMemo(
() =>
type == "password"
? {
endAdornment: (
<InputAdornment position="end">
... | @@ -235,14 +235,14 @@ const Input = (props: TaipyInputProps) => {
endAdornment: (
<div style={verticalDivStyle}>
<IconButton
- data-testid="stepper-up-spinner"
+ aria-label=... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.571 | suggestion | 156 | 51 | 51 | false | Unit test for Input component | 1,508 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
const state: TaipyState = INITIAL_STATE;
const { getByDisplayValue } = render(
<TaipyContext.Provider value={{ state, dispatch }}>
<Input value="Val" type="text" updateVarName="varname" onAction="on_action" />
</TaipyContext.Provider>,
);
const elt... | not testing the icon's presence ? | const state: TaipyState = INITIAL_STATE;
const { getByDisplayValue } = render(
<TaipyContext.Provider value={{ state, dispatch }}>
<Input value="Val" type="text" updateVarName="varname" onAction="on_action" />
</TaipyContext.Provider>,
);
const elt... | @@ -128,6 +147,18 @@ describe("Input Component", () => {
type: "SEND_UPDATE_ACTION",
});
});
+ it("should display visibility off icon when showPassword is true", async () => {
+ const { getByLabelText } = render(<Input value={"Test Input"} type="password" />);
+ const visibil... | frontend/taipy-gui/src/components/Taipy/Input.spec.tsx | 26 | TypeScript | 0.071 | question | 33 | 51 | 51 | false | Unit test for Input component | 1,508 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
while (_fmt) {
if ((match = re.text.exec(_fmt)) !== null) {
// Non-placeholder text
parseTree.push(match[0]);
} else if ((match = re.modulo.exec(_fmt)) !== null) {
// '%%' escape sequence
parseTree.push('%');
} else if ((match = re.placeholder... | No linter complains about this additional ';'? |
while (_fmt) {
if ((match = re.text.exec(_fmt)) !== null) {
// Non-placeholder text
parseTree.push(match[0]);
} else if ((match = re.modulo.exec(_fmt)) !== null) {
// '%%' escape sequence
parseTree.push("%");
} else if ((match = re.placeholder... | @@ -44,34 +44,36 @@ const sprintfParse = (fmt?: string): (string | { placeholder: string; })[] => {
parseTree.push(match[0]);
} else if ((match = re.modulo.exec(_fmt)) !== null) {
// '%%' escape sequence
- parseTree.push('%');
+ parseTree.push("%");
} el... | frontend/taipy-gui/src/utils/formatConversion.ts | 26 | TypeScript | 0.071 | question | 46 | 51 | 51 | false | Unit test for format conversion | 1,514 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
const { getByRole } = render(<Image defaultContent="/url/toto.png" active={true} onAction="tp" />);
const elt = getByRole("button");
expect(elt).not.toBeDisabled();
});
it("is an image when no action", async () => {
const { getByRole } = render(<Image defaultContent="/url/toto.pn... | ```suggestion
it("URL used when content prop is not provided", () => {
``` | const { getByRole } = render(<Image defaultContent="/url/toto.png" active={true} onAction="tp" />);
const elt = getByRole("button");
expect(elt).not.toBeDisabled();
});
it("is an image when no action", async () => {
const { getByRole } = render(<Image defaultContent="/url/toto.pn... | @@ -79,4 +82,72 @@ describe("Image Component", () => {
type: "SEND_ACTION_ACTION",
});
});
+ it("should return [undefined, undefined, false] when content prop is not provided", () => { | frontend/taipy-gui/src/components/Taipy/Image.spec.tsx | 26 | TypeScript | 0.643 | suggestion | 80 | 51 | 51 | false | Unit test for Image.tsx | 1,524 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
const { getByRole } = render(<Image defaultContent="/url/toto.png" active={true} defaultLabel="toto" />);
const elt = getByRole("img");
expect(elt).toBeInTheDocument();
});
it("dispatch a well formed message", async () => {
const dispatch = jest.fn();
const state: TaipySt... | ```suggestion
it("URL replaced when content prop is an empty string", () => {
``` | const { getByRole } = render(<Image defaultContent="/url/toto.png" active={true} defaultLabel="toto" />);
const elt = getByRole("img");
expect(elt).toBeInTheDocument();
});
it("dispatch a well formed message", async () => {
const dispatch = jest.fn();
const state: TaipySt... | @@ -79,4 +82,72 @@ describe("Image Component", () => {
type: "SEND_ACTION_ACTION",
});
});
+ it("should return [undefined, undefined, false] when content prop is not provided", () => {
+ const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" />);
+ con... | frontend/taipy-gui/src/components/Taipy/Image.spec.tsx | 26 | TypeScript | 0.643 | suggestion | 87 | 51 | 51 | false | Unit test for Image.tsx | 1,524 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
const dispatch = jest.fn();
const state: TaipyState = INITIAL_STATE;
const { getByRole } = render(
<TaipyContext.Provider value={{ state, dispatch }}>
<Image defaultContent="/url/toto.png" onAction="on_action" />
</TaipyContext.Provider>,
);
... | ```suggestion
it("URL replaced when content prop is a set", () => {
```
Or there's something I don't know | const dispatch = jest.fn();
const state: TaipyState = INITIAL_STATE;
const { getByRole } = render(
<TaipyContext.Provider value={{ state, dispatch }}>
<Image defaultContent="/url/toto.png" onAction="on_action" />
</TaipyContext.Provider>,
);
... | @@ -79,4 +82,72 @@ describe("Image Component", () => {
type: "SEND_ACTION_ACTION",
});
});
+ it("should return [undefined, undefined, false] when content prop is not provided", () => {
+ const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" />);
+ con... | frontend/taipy-gui/src/components/Taipy/Image.spec.tsx | 26 | TypeScript | 0.786 | suggestion | 112 | 51 | 51 | false | Unit test for Image.tsx | 1,524 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
});
it("should return [undefined, undefined, false] when content prop is an empty string", () => {
const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" content="" />);
const img = getByRole("img") as HTMLImageElement;
expect(img.src).toBe("http://localhost/");
... | ```suggestion
it("should return the content prop when it is inline SVG", () => {
``` | });
it("URL replaced when content prop is an empty string", () => {
const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" content="" />);
const img = getByRole("img") as HTMLImageElement;
expect(img.src).toBe("http://localhost/");
});
it("URL replaced whe... | @@ -79,4 +82,72 @@ describe("Image Component", () => {
type: "SEND_ACTION_ACTION",
});
});
+ it("should return [undefined, undefined, false] when content prop is not provided", () => {
+ const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" />);
+ con... | frontend/taipy-gui/src/components/Taipy/Image.spec.tsx | 26 | TypeScript | 0.643 | suggestion | 90 | 51 | 51 | false | Unit test for Image.tsx | 1,524 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
it("should return [undefined, undefined, false] when content prop is a string of length less than 4", () => {
const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" content="abc" />);
const img = getByRole("img") as HTMLImageElement;
expect(img.src).toBe("http://local... | ```suggestion
it("should return the content prop in the general case", () => {
``` | it("URL replaced when content prop is a string of length less than 4", () => {
const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" content="abc" />);
const img = getByRole("img") as HTMLImageElement;
expect(img.src).toBe("http://localhost/abc");
});
it("sho... | @@ -79,4 +82,72 @@ describe("Image Component", () => {
type: "SEND_ACTION_ACTION",
});
});
+ it("should return [undefined, undefined, false] when content prop is not provided", () => {
+ const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" />);
+ con... | frontend/taipy-gui/src/components/Taipy/Image.spec.tsx | 26 | TypeScript | 0.643 | suggestion | 88 | 51 | 51 | false | Unit test for Image.tsx | 1,524 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
const content = "<svg xmlns='http://www.w3.org/2000/svg'></svg>";
const { container } = render(<Image defaultContent="/url/to/default/image.png" content={content} />);
const svg = container.querySelector("svg");
expect(svg?.outerHTML.replace(/"/g, "'")).toBe(content);
});
it("sho... | ```suggestion
it("should render a div when content prop is inline SVG", () => {
``` | const content = "<svg xmlns='http://www.w3.org/2000/svg'></svg>";
const { container } = render(<Image defaultContent="/url/to/default/image.png" content={content} />);
const svg = container.querySelector("svg");
expect(svg?.outerHTML.replace(/"/g, "'")).toBe(content);
});
it("sho... | @@ -79,4 +82,72 @@ describe("Image Component", () => {
type: "SEND_ACTION_ACTION",
});
});
+ it("should return [undefined, undefined, false] when content prop is not provided", () => {
+ const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" />);
+ con... | frontend/taipy-gui/src/components/Taipy/Image.spec.tsx | 26 | TypeScript | 0.643 | suggestion | 89 | 40 | 40 | false | Unit test for Image.tsx | 1,524 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
const { getByRole } = render(
<Image defaultContent="/url/to/default/image.png" content="/url/to/content/image.png" />,
);
const img = getByRole("img") as HTMLImageElement;
expect(img.src).toBe("http://localhost/url/to/content/image.png");
});
it("should render a div ... | ```suggestion
it("should render an img when content prop is not SVG", () => {
``` | const { getByRole } = render(
<Image defaultContent="/url/to/default/image.png" content="/url/to/content/image.png" />,
);
const img = getByRole("img") as HTMLImageElement;
expect(img.src).toBe("http://localhost/url/to/content/image.png");
});
it("should render a div ... | @@ -79,4 +82,72 @@ describe("Image Component", () => {
type: "SEND_ACTION_ACTION",
});
});
+ it("should return [undefined, undefined, false] when content prop is not provided", () => {
+ const { getByRole } = render(<Image defaultContent="/url/to/default/image.png" />);
+ con... | frontend/taipy-gui/src/components/Taipy/Image.spec.tsx | 26 | TypeScript | 0.643 | suggestion | 87 | 34 | 34 | false | Unit test for Image.tsx | 1,524 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
*/
import React from "react";
import { fireEvent, render, waitFor } from "@testing-library/react";
import "@testing-library/jest-dom";
import userEvent from "@testing-library/user-event";
import FileSelector from "./FileSelector";
import { TaipyContext } from "../../context/taipyContext";
import { TaipyState, INITIA... | Could `elt.parentElement?.parentElement` be null?
That seems to be the case considering the changes elsewhere... | */
import React from "react";
import { fireEvent, render, waitFor } from "@testing-library/react";
import "@testing-library/jest-dom";
import userEvent from "@testing-library/user-event";
import FileSelector from "./FileSelector";
import { TaipyContext } from "../../context/taipyContext";
import { TaipyState, INITIA... | @@ -34,7 +34,7 @@ describe("FileSelector Component", () => {
it("displays the right info for string", async () => {
const { getByText } = render(<FileSelector label="toto" defaultLabel="titi" className="taipy-file-selector" />);
const elt = getByText("toto");
- expect(elt.parentElement).to... | frontend/taipy-gui/src/components/Taipy/FileSelector.spec.tsx | 26 | TypeScript | 0.714 | suggestion | 113 | 51 | 51 | false | inactive file selector | 1,533 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
const elt = getByText(defaultMessage);
expect(elt.closest(".notistack-MuiContent-info")).toBeInTheDocument();
});
it("gets favicon URL from document link tags", () => {
const link = document.createElement("link");
link.rel = "icon";
link.href = "/test-icon.png";
d... | ```suggestion
it("closes alert on close button click", async () => {
``` | const elt = getByText(defaultMessage);
expect(elt.closest(".notistack-MuiContent-info")).toBeInTheDocument();
});
it("gets favicon URL from document link tags", () => {
const link = document.createElement("link");
link.rel = "icon";
link.href = "/test-icon.png";
d... | @@ -12,49 +12,191 @@
*/
import React from "react";
-import { render } from "@testing-library/react";
+import { render, screen, waitFor } from "@testing-library/react";
import "@testing-library/jest-dom";
import { SnackbarProvider } from "notistack";
import Alert from "./Alert";
import { AlertMessage } from "... | frontend/taipy-gui/src/components/Taipy/Alert.spec.tsx | 26 | TypeScript | 0.571 | suggestion | 78 | 51 | 51 | false | Unit test for Alert | 1,536 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
);
const linkElement = document.querySelector("link[rel='icon']");
if (linkElement) {
expect(linkElement.getAttribute("href")).toBe("/test-icon.png");
} else {
expect(true).toBe(false);
}
document.head.removeChild(link);
});
it("closes Sna... | ```suggestion
it("Alert disappears when alert type is empty", async () => {
``` | );
const linkElement = document.querySelector("link[rel='icon']");
if (linkElement) {
expect(linkElement.getAttribute("href")).toBe("/test-icon.png");
} else {
expect(true).toBe(false);
}
document.head.removeChild(link);
});
it("closes ale... | @@ -12,49 +12,191 @@
*/
import React from "react";
-import { render } from "@testing-library/react";
+import { render, screen, waitFor } from "@testing-library/react";
import "@testing-library/jest-dom";
import { SnackbarProvider } from "notistack";
import Alert from "./Alert";
import { AlertMessage } from "... | frontend/taipy-gui/src/components/Taipy/Alert.spec.tsx | 26 | TypeScript | 0.714 | suggestion | 85 | 51 | 51 | false | Unit test for Alert | 1,536 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
defaultThreshold?: number
testId?: string
defaultLayout?: string;
layout?: string;
defaultStyle?: string;
style?: string;
width?: string | number;
height?: string | number;
showValue?: boolean;
format?: string;
deltaFormat?: string;
colorMap?: string;
template?: strin... | I'm not sure we want a default value here | defaultThreshold?: number
testId?: string
defaultLayout?: string;
layout?: string;
defaultStyle?: string;
style?: string;
width?: string | number;
height?: string | number;
showValue?: boolean;
format?: string;
deltaFormat?: string;
colorMap?: string;
template?: strin... | @@ -58,7 +60,9 @@ const Metric = (props: MetricProps) => {
const {
width = "100%",
height,
- showValue = true
+ showValue = true,
+ positiveDeltaColor = "#3D9970", | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.071 | suggestion | 41 | 51 | 51 | false | Implement delta_color options | 1,538 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Satoshi-Sh |
console.info(`Error parsing color_map value (metric).\n${(e as Error).message || e}`);
}
return undefined;
}, [props.colorMap, props.max])
const data = useMemo(() => {
const mode = (props.type === "none") ? [] : ["gauge"];
showValue && mode.push("number");
(d... | define only if the value is not undefined | console.info(`Error parsing color_map value (metric).\n${(e as Error).message || e}`);
}
return undefined;
}, [props.colorMap, props.max])
const data = useMemo(() => {
const mode = (props.type === "none") ? [] : ["gauge"];
showValue && mode.push("number");
(d... | @@ -103,7 +107,16 @@ const Metric = (props: MetricProps) => {
reference: typeof value === 'number' && typeof delta === 'number' ? value - delta : undefined,
prefix: extractPrefix(props.deltaFormat),
suffix: extractSuffix(props.deltaFormat),
- ... | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.214 | suggestion | 41 | 51 | 51 | false | Implement delta_color options | 1,538 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Satoshi-Sh |
const baseLayout = useDynamicJsonProperty(props.layout, props.defaultLayout || "", emptyLayout);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);
const theme = useTheme();
const colorMap = useMemo(() => {
try {
const obj = props.colorMap ? JSON.p... | Do you have to specify the symbol ? | const baseLayout = useDynamicJsonProperty(props.layout, props.defaultLayout || "", emptyLayout);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);
const theme = useTheme();
const colorMap = useMemo(() => {
try {
const obj = props.colorMap ? JSON.p... | @@ -88,6 +92,14 @@ const Metric = (props: MetricProps) => {
const mode = (props.type === "none") ? [] : ["gauge"];
showValue && mode.push("number");
(delta !== undefined) && mode.push("delta");
+ const deltaIncreasing = positiveDeltaColor?{
+ symbol: "▲", | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.071 | question | 35 | 51 | 51 | false | Implement delta_color options | 1,538 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Satoshi-Sh |
const mode = (props.type === "none") ? [] : ["gauge"];
showValue && mode.push("number");
(delta !== undefined) && mode.push("delta");
const deltaIncreasing = positiveDeltaColor?{
color: positiveDeltaColor
} : undefined
const deltaDecreasing =negativeDeltaColor... | ```suggestion
increasing: deltaIncreasing,
``` | const mode = (props.type === "none") ? [] : ["gauge"];
showValue && mode.push("number");
(delta !== undefined) && mode.push("delta");
const deltaIncreasing = deltaColor ? {
color: deltaColor == "invert" ? "#FF4136" : deltaColor } : undefined
const deltaDecreasing = de... | @@ -103,7 +113,10 @@ const Metric = (props: MetricProps) => {
reference: typeof value === 'number' && typeof delta === 'number' ? value - delta : undefined,
prefix: extractPrefix(props.deltaFormat),
suffix: extractSuffix(props.deltaFormat),
- ... | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.571 | suggestion | 68 | 51 | 51 | false | Implement delta_color options | 1,538 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | Satoshi-Sh |
const baseLayout = useDynamicJsonProperty(props.layout, props.defaultLayout || "", emptyLayout);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);
const theme = useTheme();
const colorMap = useMemo(() => {
try {
const obj = props.colorMap ? JSON.p... | Where did you find this color?
Is there anyway we can get it dynamically from plotly?
Should the invert value be composted in lower case? | const baseLayout = useDynamicJsonProperty(props.layout, props.defaultLayout || "", emptyLayout);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);
const theme = useTheme();
const colorMap = useMemo(() => {
try {
const obj = props.colorMap ? JSON.p... | @@ -88,6 +92,11 @@ const Metric = (props: MetricProps) => {
const mode = (props.type === "none") ? [] : ["gauge"];
showValue && mode.push("number");
(delta !== undefined) && mode.push("delta");
+ const deltaIncreasing = deltaColor ? {
+ color: deltaColor == "invert" ? "#FF41... | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.429 | question | 138 | 51 | 51 | false | Implement delta_color options | 1,538 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Satoshi-Sh |
return type(base_val)(val)
except Exception:
# forget it
pass
return val
def _filter_iterable(list_val: Iterable, operator: t.Callable, val: t.Any):
if operator is contains:
types = {type(v) for v in list_val}
if len(types) == 1:
... | ```suggestion
_warn(f'Error filtering with "{col_fn or col}": not a valid Python identifier.')
``` | return type(base_val)(val)
except Exception:
# forget it
pass
return val
def _filter_iterable(list_val: Iterable, operator: t.Callable, val: t.Any):
if operator is contains:
types = {type(v) for v in list_val}
if len(types) == 1:
... | @@ -244,14 +244,50 @@ def get_hash():
"contains": contains,
}
+
+def _filter_value(base_val: t.Any, operator: t.Callable, val: t.Any, adapt: t.Optional[t.Callable] = None):
+ if isinstance(base_val, (datetime, date)):
+ base_val = base_val.isoformat()
+ val = adapt(base_val, val) if adapt else val
... | taipy/gui_core/_adapters.py | 26 | Python | 0.857 | suggestion | 108 | 51 | 51 | false | filter with non identifier property names | 1,551 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
@classmethod
def generate_template_map(cls, template_path: Optional[pathlib.Path] = None):
if not template_path:
template_path = pathlib.Path(taipy.__file__).parent.resolve() / "templates"
# Update the template map with the new templates but do not override the existing ones
... | ```suggestion
help="The template used to create the new Taipy application.",
``` |
@classmethod
def generate_template_map(cls, template_path: Optional[pathlib.Path] = None):
if not template_path:
template_path = pathlib.Path(taipy.__file__).parent.resolve() / "templates"
# Update the template map with the new templates but do not override the existing ones
... | @@ -49,10 +49,10 @@ def create_parser(cls):
help="Create a new Taipy application using pre-defined templates.",
)
create_parser.add_argument(
- "--template",
+ "--application",
choices=list(cls._template_map.keys()),
default="default",
- ... | taipy/_cli/_create_cli.py | 26 | Python | 0.643 | suggestion | 94 | 41 | 41 | false | Refactor/#1472 - Update create cli command | 1,556 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied... | `isinstance(value, Iterable)`? I'm thinking numpy arrays... | # the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied... | @@ -26,8 +25,8 @@ class _ArrayDictDataAccessor(_PandasDataAccessor):
def get_supported_classes() -> t.List[str]:
return [t.__name__ for t in _ArrayDictDataAccessor.__types] # type: ignore
- def _get_dataframe(self, value: t.Any) -> t.Union[t.List[pd.DataFrame], pd.DataFrame]:
- if isinstance(... | taipy/gui/data/array_dict_data_accessor.py | 26 | Python | 0.357 | suggestion | 59 | 51 | 51 | false | still preparing for polar in enterprise | 1,583 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
elt = value
else:
elt = lov[0]
var_type = self.__gui._get_unique_type_adapter(type(elt).__name__)
if adapter is None:
adapter = self.__gui._get_adapter_for_type(var_type)
elif var_type == str.__name__ and... | can we say `if default_lov is not None and lov:` ? | elt = value[0]
else:
elt = value
var_type = self.__gui._get_unique_type_adapter(type(elt).__name__)
if adapter is None:
adapter = self.__gui._get_adapter_for_type(var_type)
elif var_type == st... | @@ -427,7 +429,7 @@ def _get_lov_adapter(self, var_name: str, property_name: t.Optional[str] = None,
if adapter is not None:
self.__gui._add_adapter_for_type(var_type, adapter) # type: ignore
- if len(lov) > 0:
+ if default_lov is not None and len(lov) > 0: | taipy/gui/_renderers/builder.py | 26 | Python | 0.357 | question | 50 | 51 | 51 | false | Improve core selector loading | 1,594 | Avaiga/taipy | 12,680 | Python | namnguyen20999 | FredLL-Avaiga |
"jsx": template_str,
"style": (style + os.linesep) if style else "",
"head": head or [],
"context": context or self._gui._get_default_module_name(),
}
)
def _direct_render_json(self, data):
return jsonify(data)
def get... | ```suggestion
from gevent import get_hub, monkey
```
for the linter (including the empty line) | "jsx": template_str,
"style": (style + os.linesep) if style else "",
"head": head or [],
"context": context or self._gui._get_default_module_name(),
}
)
def _direct_render_json(self, data):
return jsonify(data)
def get... | @@ -256,8 +256,8 @@ def _get_async_mode(self) -> str:
def _apply_patch(self):
if self._get_async_mode() == "gevent" and util.find_spec("gevent"):
- from gevent import monkey
-
+ from gevent import monkey, get_hub | taipy/gui/server.py | 26 | Python | 0.714 | suggestion | 111 | 51 | 51 | false | Shutdown taipy gracefully without long traceback | 1,595 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | PrathamGupta06 |
@classmethod
def initialize(cls):
pass
@classmethod
def submit(
cls,
submittable: Submittable,
callbacks: Optional[Iterable[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**propert... | ```suggestion
before returning.<br/>
```
Make sure the line break is also added in the other locations where the next line appears. |
@classmethod
def initialize(cls):
pass
@classmethod
def submit(
cls,
submittable: Submittable,
callbacks: Optional[Iterable[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**propert... | @@ -66,6 +66,7 @@ def submit(
finished in asynchronous mode.
timeout (Union[float, int]): The optional maximum number of seconds to wait for the jobs to be finished
before returning. | taipy/core/_orchestrator/_orchestrator.py | 26 | Python | 0.714 | suggestion | 150 | 51 | 51 | false | Fix/#1602 - Wait with no timeout should wait indefinitely | 1,604 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | trgiangdo |
@classmethod
def initialize(cls):
pass
@classmethod
def submit(
cls,
submittable: Submittable,
callbacks: Optional[Iterable[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**properti... | ```suggestion
If not provided and *wait* is True, the function waits indefinitely.
``` | @classmethod
def initialize(cls):
pass
@classmethod
def submit(
cls,
submittable: Submittable,
callbacks: Optional[Iterable[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**properti... | @@ -66,6 +66,7 @@ def submit(
finished in asynchronous mode.
timeout (Union[float, int]): The optional maximum number of seconds to wait for the jobs to be finished
before returning.
+ If not provided and wait is True, the function waits indefinitely. | taipy/core/_orchestrator/_orchestrator.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | Fix/#1602 - Wait with no timeout should wait indefinitely | 1,604 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | trgiangdo |
cls._check_and_execute_jobs_if_development_mode()
elif wait:
cls._wait_until_job_finished(jobs, timeout)
return submission
@classmethod
def submit_task(
cls,
task: Task,
callbacks: Optional[Iterable[Callable]] = None,
force: bool = False,
... | ```suggestion
If not provided and *wait* is True, the function waits indefinitely.
``` | cls._check_and_execute_jobs_if_development_mode()
elif wait:
cls._wait_until_job_finished(jobs, timeout)
return submission
@classmethod
def submit_task(
cls,
task: Task,
callbacks: Optional[Iterable[Callable]] = None,
force: bool = False,
... | @@ -120,6 +121,7 @@ def submit_task(
in asynchronous mode.
timeout (Union[float, int]): The optional maximum number of seconds to wait for the job
to be finished before returning.
+ If not provided and wait is True, the function waits indefinitely. | taipy/core/_orchestrator/_orchestrator.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | Fix/#1602 - Wait with no timeout should wait indefinitely | 1,604 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | trgiangdo |
"""
from ... import core as tp
return tp.unsubscribe_scenario(callback, params, self)
def submit(
self,
callbacks: Optional[List[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**proper... | ```suggestion
If not provided and *wait* is True, the function waits indefinitely.
``` | """
from ... import core as tp
return tp.unsubscribe_scenario(callback, params, self)
def submit(
self,
callbacks: Optional[List[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**proper... | @@ -609,6 +609,7 @@ def submit(
asynchronous mode.
timeout (Union[float, int]): The optional maximum number of seconds to wait for the jobs to be finished
before returning.
+ If not provided and wait is True, the function waits indefinitely. | taipy/core/scenario/scenario.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | Fix/#1602 - Wait with no timeout should wait indefinitely | 1,604 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | trgiangdo |
"""
from ... import core as tp
return tp.unsubscribe_sequence(callback, params, self)
def submit(
self,
callbacks: Optional[List[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**proper... | ```suggestion
If not provided and *wait* is True, the function waits indefinitely.
``` | """
from ... import core as tp
return tp.unsubscribe_sequence(callback, params, self)
def submit(
self,
callbacks: Optional[List[Callable]] = None,
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**proper... | @@ -312,6 +312,7 @@ def submit(
in asynchronous mode.
timeout (Union[float, int]): The maximum number of seconds to wait for the jobs to be finished before
returning.
+ If not provided and wait is True, the function waits indefinitely. | taipy/core/sequence/sequence.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | Fix/#1602 - Wait with no timeout should wait indefinitely | 1,604 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | trgiangdo |
return False
@_warn_no_core_service("The submitted entity will not be executed until the Core service is running.")
def submit(
entity: Union[Scenario, Sequence, Task],
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**properties,
) -> Submission:
"""S... | ```suggestion
If not provided and *wait* is True, the function waits indefinitely.
``` | return False
@_warn_no_core_service("The submitted entity will not be executed until the Core service is running.")
def submit(
entity: Union[Scenario, Sequence, Task],
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
**properties,
) -> Submission:
"""S... | @@ -241,6 +241,7 @@ def submit(
in asynchronous mode.
timeout (Union[float, int]): The optional maximum number of seconds to wait
for the jobs to be finished before returning.
+ If not provided and wait is True, the function waits indefinitely. | taipy/core/taipy.py | 26 | Python | 0.714 | suggestion | 100 | 51 | 51 | false | Fix/#1602 - Wait with no timeout should wait indefinitely | 1,604 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | trgiangdo |
data_nodes = list(self._input.values()) + list(self._output.values())
return Scope(min(dn.scope for dn in data_nodes)) if len(data_nodes) != 0 else Scope.GLOBAL
@property
def version(self):
return self._version
def submit(
self,
callbacks: Optional[List[Callable]] =... | ```suggestion
If not provided and *wait* is True, the function waits indefinitely.
``` | data_nodes = list(self._input.values()) + list(self._output.values())
return Scope(min(dn.scope for dn in data_nodes)) if len(data_nodes) != 0 else Scope.GLOBAL
@property
def version(self):
return self._version
def submit(
self,
callbacks: Optional[List[Callable]] =... | @@ -232,6 +232,7 @@ def submit(
mode.
timeout (Union[float, int]): The maximum number of seconds to wait for the job to be finished before
returning.
+ If not provided and wait is True, the function waits indefinitely. | taipy/core/task/task.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | Fix/#1602 - Wait with no timeout should wait indefinitely | 1,604 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | trgiangdo |
@classmethod
def _get_all_by(cls, filters: Optional[List[Dict]] = None) -> List[EntityType]:
"""
Returns all entities based on a criteria.
"""
if not filters:
filters = []
return cls._repository._load_all(filters)
@classmethod
def _get(cls, entity: U... | Do we also need to update the docstring for the return type?
The `is_ready_to_run()` method did get an update, but not the others |
@classmethod
def _get_all_by(cls, filters: Optional[List[Dict]] = None) -> List[EntityType]:
"""
Returns all entities based on a criteria.
"""
if not filters:
filters = []
return cls._repository._load_all(filters)
@classmethod
def _get(cls, entity: U... | @@ -125,11 +126,16 @@ def _get(cls, entity: Union[str, EntityType], default=None) -> EntityType:
return default
@classmethod
- def _exists(cls, entity_id: str) -> bool:
+ def _exists(cls, entity_id: str) -> ReasonCollection:
"""
Returns True if the entity id exists. | taipy/core/_manager/_manager.py | 26 | Python | 0.643 | question | 132 | 51 | 51 | false | feature/#1568 update boolean apis to using reason collection | 1,625 | Avaiga/taipy | 12,680 | Python | trgiangdo | toan-quach |
def __init__(self, scenario_id: str):
Reason.__init__(self, f"The scenario {scenario_id} does not belong to any cycle.")
class SubmissionIsNotFinished(Reason, _DataNodeReasonMixin):
"""
The submission is not finished yet.
Attributes:
submission_id (str): The submission identifier.
... | ```suggestion
Reason.__init__(self, f"The status of submission {submission_id} is undefined.")
``` | def __init__(self, scenario_id: str):
Reason.__init__(self, f"The scenario {scenario_id} does not belong to any cycle.")
class SubmissionIsNotFinished(Reason, _DataNodeReasonMixin):
"""
The submission is not finished yet.
Attributes:
submission_id (str): The submission identifier.
... | @@ -155,3 +155,76 @@ class InvalidUploadFile(Reason, _DataNodeReasonMixin):
def __init__(self, file_name: str, datanode_id: str):
Reason.__init__(self, f'The uploaded file {file_name} has invalid data for data node "{datanode_id}"')
_DataNodeReasonMixin.__init__(self, datanode_id)
+
+
+class Enti... | taipy/core/reason/reason.py | 26 | Python | 0.857 | suggestion | 108 | 27 | 27 | false | feature/#1568 update boolean apis to using reason collection | 1,625 | Avaiga/taipy | 12,680 | Python | trgiangdo | toan-quach |
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | This Reason is not related to data nodes. It should not inherited from `_DataNodeReasonMixin`. | """
def __init__(self, file_name: str, datanode_id: str):
Reason.__init__(
self,
f"The uploaded file {file_name} can not be read, "
f'therefore is not a valid data file for data node "{datanode_id}"',
)
_DataNodeReasonMixin.__init__(self, datanode_id)... | @@ -155,3 +155,76 @@ class InvalidUploadFile(Reason, _DataNodeReasonMixin):
def __init__(self, file_name: str, datanode_id: str):
Reason.__init__(self, f'The uploaded file {file_name} has invalid data for data node "{datanode_id}"')
_DataNodeReasonMixin.__init__(self, datanode_id)
+
+
+class Enti... | taipy/core/reason/reason.py | 26 | Python | 0.429 | suggestion | 94 | 158 | 51 | false | feature/#1568 update boolean apis to using reason collection | 1,625 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach |
}
}
return [
[] as string[],
{} as Record<string, ColumnDesc>,
{} as Record<string, string>,
{} as Record<string, string>,
hNan,
false,
];
}, [
active,
editable,
onAdd,
onDelet... | This comment is very confusing. | }
}
return [
[] as string[],
{} as Record<string, ColumnDesc>,
{} as Record<string, string>,
{} as Record<string, string>,
hNan,
false,
];
}, [
active,
editable,
onAdd,
onDelet... | @@ -199,6 +199,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
useDispatchRequestUpdateOnFirstRender(dispatch, id, module, updateVars);
+ // TODO: unexpected behavior, need to check | frontend/taipy-gui/src/components/Taipy/PaginatedTable.tsx | 26 | TypeScript | 0.071 | suggestion | 31 | 51 | 51 | false | Unit test for Paginated Table component | 1,629 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
data={buttonValue as TableValueType}
defaultColumns={buttonColumns}
showAll={true}
onAction="onSelect"
/>
</TaipyContext.Provider>
);
dispatch.mockClear();
const elt = getByText("Button L... | ```suggestion
it("should render correctly when style is applied to columns", async () => {
``` | data={buttonValue as TableValueType}
defaultColumns={buttonColumns}
showAll={true}
onAction="onSelect"
/>
</TaipyContext.Provider>
);
dispatch.mockClear();
const elt = getByText("Button L... | @@ -645,9 +692,96 @@ describe("PaginatedTable Component", () => {
col: "Code",
index: 0,
reason: "button",
- value: "button action"
+ value: "button action",
},
type: "SEND_ACTION_ACTION",
});
});
+ ... | frontend/taipy-gui/src/components/Taipy/PaginatedTable.spec.tsx | 26 | TypeScript | 0.786 | suggestion | 100 | 51 | 51 | false | Unit test for Paginated Table component | 1,629 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
self.__dict__ = sc.__dict__
def __hash__(self):
return hash(self.id)
def __eq__(self, other):
return isinstance(other, Scenario) and self.id == other.id
def __setattr__(self, name: str, value: Any) -> None:
entity_taipy_attributes = [
"_config_id",
... | What if we use `Scenario.__dict__.keys()` here?
Will that also cause a recursion error? |
sc = tp.get(id)
self.__dict__ = sc.__dict__
def __hash__(self):
return hash(self.id)
def __eq__(self, other):
return isinstance(other, Scenario) and self.id == other.id
def __setattr__(self, name: str, value: Any) -> None:
if self.__CHECK_INIT_DONE_ATTR_NAME not i... | @@ -175,11 +176,40 @@ def __hash__(self):
def __eq__(self, other):
return isinstance(other, Scenario) and self.id == other.id
- def __getattr__(self, attribute_name):
- protected_attribute_name = _validate_id(attribute_name)
- if protected_attribute_name in self._properties:
- ... | taipy/core/scenario/scenario.py | 26 | Python | 0.571 | question | 88 | 51 | 51 | false | feature/#1572 attempt to Protect scenario custom properties | 1,642 | Avaiga/taipy | 12,680 | Python | trgiangdo | toan-quach |
def __eq__(self, other):
return isinstance(other, DataNode) and self.id == other.id
def __ne__(self, other):
return not self == other
def __hash__(self):
return hash(self.id)
def __getstate__(self):
return vars(self)
def __setstate__(self, state):
vars(sel... | Does this work?
Raise and catch right away seems weird to me.
```suggestion
if protected_attribute_name in self._properties:
raise AttributeKeyAlreadyExisted(name)
return super().__setattr__(name, value)
``` | return isinstance(other, DataNode) and self.id == other.id
def __ne__(self, other):
return not self == other
def __hash__(self):
return hash(self.id)
def __getstate__(self):
return vars(self)
def __setstate__(self, state):
vars(self).update(state)
@classm... | @@ -346,6 +348,21 @@ def __getstate__(self):
def __setstate__(self, state):
vars(self).update(state)
+ def __setattr__(self, name: str, value: Any) -> None:
+ if self.__CHECK_INIT_DONE_ATTR_NAME not in dir(self) or name in dir(self):
+ return super().__setattr__(name, value)
+ ... | taipy/core/data/data_node.py | 26 | Python | 0.786 | question | 253 | 51 | 51 | false | feature/#1572 attempt to Protect scenario custom properties | 1,642 | Avaiga/taipy | 12,680 | Python | trgiangdo | toan-quach |
id,
owner_id,
parent_ids,
last_edit_date,
edits,
version or _VersionManagerFactory._build_manager()._get_latest_version(),
validity_period,
edit_in_progress,
editor_id,
editor_expiration_date,
... | What is the motivation for this rename?
It is a breaking change. If we want to keep it, it has to be documented in the refman, in the userman and in the release notes. | id,
owner_id,
parent_ids,
last_edit_date,
edits,
version or _VersionManagerFactory._build_manager()._get_latest_version(),
validity_period,
edit_in_progress,
editor_id,
editor_expiration_date,
... | @@ -143,15 +143,15 @@ def __init__(
properties.get(self.__COLLECTION_KEY, "")
]
- self.custom_document = properties[self._CUSTOM_DOCUMENT_PROPERTY]
+ self.custom_mongo_document = properties[self._CUSTOM_DOCUMENT_PROPERTY] | taipy/core/data/mongo.py | 26 | Python | 0.429 | question | 168 | 51 | 51 | false | feature/#1572 attempt to Protect scenario custom properties | 1,642 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach |
return ScenarioId(Scenario.__SEPARATOR.join([Scenario._ID_PREFIX, _validate_id(config_id), str(uuid.uuid4())]))
def __getstate__(self):
return self.id
def __setstate__(self, id):
from ... import core as tp
sc = tp.get(id)
self.__dict__ = sc.__dict__
def __hash__(s... | ```suggestion
try:
if protected_attribute_name not in self._properties and not self._get_attributes(name):
``` | return ScenarioId(Scenario.__SEPARATOR.join([Scenario._ID_PREFIX, _validate_id(config_id), str(uuid.uuid4())]))
def __getstate__(self):
return self.id
def __setstate__(self, id):
from ... import core as tp
sc = tp.get(id)
self.__dict__ = sc.__dict__
def __hash__(s... | @@ -175,22 +178,40 @@ def __hash__(self):
def __eq__(self, other):
return isinstance(other, Scenario) and self.id == other.id
- def __getattr__(self, attribute_name):
- protected_attribute_name = _validate_id(attribute_name)
- if protected_attribute_name in self._properties:
- ... | taipy/core/scenario/scenario.py | 26 | Python | 0.714 | suggestion | 141 | 51 | 51 | false | feature/#1572 attempt to Protect scenario custom properties | 1,642 | Avaiga/taipy | 12,680 | Python | trgiangdo | toan-quach |
from ... import core as tp
sc = tp.get(id)
self.__dict__ = sc.__dict__
def __hash__(self):
return hash(self.id)
def __eq__(self, other):
return isinstance(other, Scenario) and self.id == other.id
def __setattr__(self, name: str, value: Any) -> None:
if sel... | The `protected_attribute_name` is not used outside of the `_get_attributes()` right?
We probably can move the `_validate_id()` inside the `_get_attributes()` to make it cleaner.
```suggestion
def _get_attributes(self, attribute_name) -> Union[Sequence, Task, DataNode]:
protected_attribute_name = _vali... | from ... import core as tp
sc = tp.get(id)
self.__dict__ = sc.__dict__
def __hash__(self):
return hash(self.id)
def __eq__(self, other):
return isinstance(other, Scenario) and self.id == other.id
def __setattr__(self, name: str, value: Any) -> None:
if sel... | @@ -175,22 +178,40 @@ def __hash__(self):
def __eq__(self, other):
return isinstance(other, Scenario) and self.id == other.id
- def __getattr__(self, attribute_name):
- protected_attribute_name = _validate_id(attribute_name)
- if protected_attribute_name in self._properties:
- ... | taipy/core/scenario/scenario.py | 26 | Python | 0.857 | suggestion | 338 | 51 | 51 | false | feature/#1572 attempt to Protect scenario custom properties | 1,642 | Avaiga/taipy | 12,680 | Python | trgiangdo | toan-quach |
assert scenario.additional_data_nodes == {}
assert len(scenario.data_nodes) == 2
assert scenario.data_nodes == {
input_1.config_id: input_1,
output_1.config_id: output_1,
}
assert len(scenario.sequences) == 2
assert scenario.sequence_1 == scenario.sequences["sequence_1"]
asse... | It feels strange to me that
You can read a property through `scenario.key == "value"`
but you cannot write it using `scenario.another_key = "another_value"`
I did not realize that it can be really confusing.
What do you think? Should we just not expose properties as attributes ? | assert len(scenario.data_nodes) == 2
assert scenario.data_nodes == {
input_1.config_id: input_1,
output_1.config_id: output_1,
}
assert len(scenario.sequences) == 2
assert scenario.sequence_1 == scenario.sequences["sequence_1"]
assert scenario.sequence_2 == scenario.sequences["se... | @@ -156,6 +163,29 @@ def test_create_scenario_and_add_sequences():
assert scenario.sequences == {"sequence_1": scenario.sequence_1, "sequence_2": scenario.sequence_2}
+def test_get_set_property_and_attribute():
+ dn_cfg = Config.configure_data_node("bar")
+ s_cfg = Config.configure_scenario("foo", additi... | tests/core/scenario/test_scenario.py | 26 | Python | 0.643 | question | 289 | 51 | 51 | false | feature/#1572 attempt to Protect scenario custom properties | 1,642 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach |
last_edit_date: Optional[datetime] = None,
edits: Optional[List[Edit]] = None,
version: Optional[str] = None,
validity_period: Optional[timedelta] = None,
edit_in_progress: bool = False,
editor_id: Optional[str] = None,
editor_expiration_date: Optional[datetime] =... | I believe we don't need this anymore. Am I correct? | edits: Optional[List[Edit]] = None,
version: Optional[str] = None,
validity_period: Optional[timedelta] = None,
edit_in_progress: bool = False,
editor_id: Optional[str] = None,
editor_expiration_date: Optional[datetime] = None,
**kwargs,
) -> None:
sel... | @@ -174,6 +175,7 @@ def __init__(
self._edits: List[Edit] = edits or []
self._properties: _Properties = _Properties(self, **kwargs)
+ self._init_done = True | taipy/core/data/data_node.py | 26 | Python | 0.214 | question | 51 | 51 | 51 | false | feature/#1572 attempt to Protect scenario custom properties | 1,642 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach |
def __init__(self, config: _Config, collector: IssueCollector):
super().__init__(config, collector)
def _check(self) -> IssueCollector:
scenario_configs = cast(Dict[str, ScenarioConfig], self._config._sections[ScenarioConfig.name])
for scenario_config_id, scenario_config in scenario_co... | I understand why we want to have `isinstance` here but is it really necessary? | def __init__(self, config: _Config, collector: IssueCollector):
super().__init__(config, collector)
def _check(self) -> IssueCollector:
scenario_configs = cast(Dict[str, ScenarioConfig], self._config._sections[ScenarioConfig.name])
for scenario_config_id, scenario_config in scenario_co... | @@ -38,10 +38,33 @@ def _check(self) -> IssueCollector:
self._check_addition_data_node_configs(scenario_config_id, scenario_config)
self._check_additional_dns_not_overlapping_tasks_dns(scenario_config_id, scenario_config)
self._check_tasks_in_sequences_exist_in_scenari... | taipy/core/config/checkers/_scenario_config_checker.py | 26 | Python | 0.357 | question | 79 | 51 | 51 | false | Feature/#1566 - Check children config_id to make sure not overlapping the properties | 1,647 | Avaiga/taipy | 12,680 | Python | toan-quach | trgiangdo |
return self._collector
def _check_task_configs(self, scenario_config_id: str, scenario_config: ScenarioConfig):
self._check_children(
ScenarioConfig,
scenario_config_id,
scenario_config._TASKS_KEY,
scenario_config.tasks,
TaskConfig,
... | What about adding a similar check for sequences?
keys of the scenario_config.sequences dictionary should not overlap data node config ids or task config ids.
@trgiangdo what do you think?
| self._check_comparators(scenario_config_id, scenario_config)
return self._collector
def _check_if_children_config_id_is_overlapping_with_properties(
self, scenario_config_id: str, scenario_config: ScenarioConfig
):
if scenario_config.tasks:
for task in scena... | @@ -38,10 +38,33 @@ def _check(self) -> IssueCollector:
self._check_addition_data_node_configs(scenario_config_id, scenario_config)
self._check_additional_dns_not_overlapping_tasks_dns(scenario_config_id, scenario_config)
self._check_tasks_in_sequences_exist_in_scenari... | taipy/core/config/checkers/_scenario_config_checker.py | 26 | Python | 0.429 | question | 191 | 51 | 51 | false | Feature/#1566 - Check children config_id to make sure not overlapping the properties | 1,647 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
with open(gui_pyi_file, "w") as write_file:
write_file.write(replaced_content)
# ##################################################################################################
# Generate Page Builder pyi file (gui/builder/__init__.pyi)
# #########################################################################... | should this import be first to please the linter ? | with open(gui_pyi_file, "w") as write_file:
write_file.write(replaced_content)
# ##################################################################################################
# Generate Page Builder pyi file (gui/builder/__init__.pyi)
# #########################################################################... | @@ -44,123 +45,152 @@
replace_str = line[line.index(", run_server") : (line.index("**kwargs") + len("**kwargs"))]
# ", run_server: bool = ..., run_in_thread: bool = ..., async_mode: str = ..., **kwargs"
line = line.replace(replace_str, gui_config)
- replaced_content = repla... | tools/gui/generate_pyi.py | 26 | Python | 0.286 | question | 50 | 51 | 51 | false | Improve content of generated pyi for the Page Builder API | 1,653 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | FabienLelaquais |
current[p] = inherited
override(prop_desc, inherit_prop, "type")
override(prop_desc, inherit_prop, "default_value")
override(prop_desc, inherit_prop, "doc")
override(prop_desc, inherit_prop, "signature")
else:
... | is it not better to change viselements.json ? | if p not in current and (inherited := inherits.get(p, None)):
current[p] = inherited
override(prop_desc, inherit_prop, "type")
override(prop_desc, inherit_prop, "default_value")
override(prop_desc, inherit_prop, "doc")
... | @@ -44,123 +45,152 @@
replace_str = line[line.index(", run_server") : (line.index("**kwargs") + len("**kwargs"))]
# ", run_server: bool = ..., run_in_thread: bool = ..., async_mode: str = ..., **kwargs"
line = line.replace(replace_str, gui_config)
- replaced_content = repla... | tools/gui/generate_pyi.py | 26 | Python | 0.143 | question | 45 | 51 | 51 | false | Improve content of generated pyi for the Page Builder API | 1,653 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | FabienLelaquais |
try:
if scenario := core_get(data.id):
return [
scenario.id,
scenario.is_primary,
scenario.config_id,
scenario.creation_date.isoformat(),
scenario.cycle... | No verb in the message? Ever??
No big deal - technical message kind of. | data = super().get()
if isinstance(data, (list, tuple)) and len(data) == 1:
data = data[0]
if isinstance(data, Scenario):
try:
if scenario := core_get(data.id):
return [
scenario.id,
scena... | @@ -84,8 +88,8 @@ def get(self):
(
s.get_simple_label(),
[t.id for t in s.tasks.values()] if hasattr(s, "tasks") else [],
- "" if (reason := is_submittable(s)) else f"Sequence not submittable: {... | taipy/gui_core/_adapters.py | 26 | Python | 0.214 | suggestion | 72 | 51 | 51 | false | take into account ReasonCollection | 1,654 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
import { darkThemeTemplate } from "../../themes/darkThemeTemplate";
const Plot = lazy(() => import("react-plotly.js"));
interface MetricProps extends TaipyBaseProps, TaipyHoverProps {
value?: number;
defaultValue?: number;
delta?: number;
defaultDelta?: number;
type?: string;
min?: number;
... | Should this be removed from factory.py and viselements.json ? | import { darkThemeTemplate } from "../../themes/darkThemeTemplate";
const Plot = lazy(() => import("react-plotly.js"));
interface MetricProps extends TaipyBaseProps, TaipyHoverProps {
value?: number;
defaultValue?: number;
delta?: number;
defaultDelta?: number;
type?: string;
min?: number;
... | @@ -45,8 +45,6 @@ interface MetricProps extends TaipyBaseProps, TaipyHoverProps {
testId?: string;
layout?: string;
defaultLayout?: string;
- style?: string; | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.286 | question | 61 | 51 | 51 | false | Adding logic to handle the issue when height/width too small | 1,664 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
expect(elt).toHaveClass("taipy-progress");
});
it("renders circular progress with value (determinate)", () => {
const { getByRole, getByText } = render(<Progress showValue value={50} />);
const elt = getByRole("progressbar");
const valueText = getByText("50%");
expect(el... | The test label is not really relevant here.
The point would be "Should not render when...".
This 'return null' really is a technical aspect of the implementation. | expect(elt).toHaveClass("taipy-progress");
});
it("renders circular progress with value (determinate)", () => {
const { getByRole, getByText } = render(<Progress showValue value={50} />);
const elt = getByRole("progressbar");
const valueText = getByText("50%");
expect(el... | @@ -12,40 +12,144 @@
*/
import React from "react";
-
import { render } from "@testing-library/react";
import "@testing-library/jest-dom";
-
-import Progress from "./Progress";
+import Progress, { getFlexDirection, getBoxWidth } from "./Progress";
describe("Progress component", () => {
it("renders circula... | frontend/taipy-gui/src/components/Taipy/Progress.spec.tsx | 26 | TypeScript | 0.571 | suggestion | 164 | 51 | 51 | false | New Feature: Enhanced Progress Control | 1,676 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 |
const linearSx = { display: "flex", alignItems: "center" };
const linearPrgSx = { width: "100%", mr: 1 };
const linearTxtSx = { minWidth: 35 };
const circularSx = { position: "relative", display: "inline-flex" };
const circularPrgSx = {
top: 0,
left: 0,
bottom: 0,
right: 0,
position: "absolute",
... | I thought default was "bottom" ? | const linearSx = { display: "flex", alignItems: "center", width: "100%" };
const linearPrgSx = { width: "100%", mr: 1 };
const titleSx = { margin: 1 };
const linearTxtSx = { minWidth: 35 };
const circularSx = { position: "relative", display: "inline-flex" };
const circularPrgSx = {
top: 0,
left: 0,
bottom: ... | @@ -45,51 +49,136 @@ const circularPrgSx = {
justifyContent: "center",
};
+export const getFlexDirection = (titleAnchor: string) => {
+ switch (titleAnchor) {
+ case "top":
+ return "column";
+ case "bottom":
+ return "column-reverse";
+ case "left":
+ re... | frontend/taipy-gui/src/components/Taipy/Progress.tsx | 26 | TypeScript | 0.071 | question | 32 | 51 | 51 | false | New Feature: Enhanced Progress Control | 1,676 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
case "left":
return "row";
case "right":
return "row-reverse";
default:
return "row";
}
};
export const getBoxWidth = (title?: string, titleAnchor?: string) => (title && titleAnchor ? "100%" : "");
const Progress = (props: ProgressBarProps) => {
cons... | sx value should be in a useMemo | case "right":
return "row-reverse";
case "bottom":
default:
return "column-reverse";
}
};
const Progress = (props: ProgressBarProps) => {
const { linear = false, showValue = false, titleAnchor = "bottom" } = props;
const className = useClassNames(props.libCl... | @@ -45,51 +49,136 @@ const circularPrgSx = {
justifyContent: "center",
};
+export const getFlexDirection = (titleAnchor: string) => {
+ switch (titleAnchor) {
+ case "top":
+ return "column";
+ case "bottom":
+ return "column-reverse";
+ case "left":
+ re... | frontend/taipy-gui/src/components/Taipy/Progress.tsx | 26 | TypeScript | 0.143 | suggestion | 31 | 51 | 51 | false | New Feature: Enhanced Progress Control | 1,676 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
case "right":
return "row-reverse";
default:
return "row";
}
};
export const getBoxWidth = (title?: string, titleAnchor?: string) => (title && titleAnchor ? "100%" : "");
const Progress = (props: ProgressBarProps) => {
const { linear = false, showValue = false, titleAnc... | sx => const outside the component | case "bottom":
default:
return "column-reverse";
}
};
const Progress = (props: ProgressBarProps) => {
const { linear = false, showValue = false, titleAnchor = "bottom" } = props;
const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
c... | @@ -45,51 +49,136 @@ const circularPrgSx = {
justifyContent: "center",
};
+export const getFlexDirection = (titleAnchor: string) => {
+ switch (titleAnchor) {
+ case "top":
+ return "column";
+ case "bottom":
+ return "column-reverse";
+ case "left":
+ re... | frontend/taipy-gui/src/components/Taipy/Progress.tsx | 26 | TypeScript | 0.071 | suggestion | 33 | 51 | 51 | false | New Feature: Enhanced Progress Control | 1,676 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
const linearSx = { display: "flex", alignItems: "center", width: "100%" };
const linearPrgSx = { width: "100%", mr: 1 };
const titleSx = { margin: 1 };
const linearTxtSx = { minWidth: 35 };
const circularSx = { position: "relative", display: "inline-flex" };
const circularPrgSx = {
top: 0,
left: 0,
bottom: ... | this could be defined outside the comp | const linearSx = { display: "flex", alignItems: "center", width: "100%" };
const linearPrgSx = { width: "100%", mr: 1 };
const titleSx = { margin: 1 };
const linearTxtSx = { minWidth: 35 };
const circularSx = { position: "relative", display: "inline-flex" };
const circularPrgSx = {
top: 0,
left: 0,
bottom: ... | @@ -46,50 +50,129 @@ const circularPrgSx = {
};
const Progress = (props: ProgressBarProps) => {
- const { linear = false, showValue = false } = props;
+ const { linear = false, showValue = false, titleAnchor = "bottom" } = props;
const className = useClassNames(props.libClassName, props.dynamicClassNam... | frontend/taipy-gui/src/components/Taipy/Progress.tsx | 26 | TypeScript | 0.143 | suggestion | 38 | 51 | 51 | false | New Feature: Enhanced Progress Control | 1,676 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
def parse_properties(self):
self._properties = {
_Element._parse_property_key(k): self._parse_property(k, v) for k, v in self._properties.items()
}
# Get a deepcopy version of the properties
def _deepcopy_properties(self):
return copy.deepcopy(self._properties)
@sta... | this could be `not instance(value, str) and "decimator" in key` => no `Decimator` dependency | def parse_properties(self):
self._properties = {
_Element._parse_property_key(k): self._parse_property(k, v) for k, v in self._properties.items()
}
# Get a deepcopy version of the properties
def _deepcopy_properties(self):
return copy.deepcopy(self._properties)
@sta... | @@ -93,47 +95,66 @@ def _parse_property(self, key: str, value: t.Any) -> t.Any:
return value
if isinstance(value, FunctionType):
if key.startswith("on_"):
- if value.__name__.startswith("<"):
- return value
- return value.__name__
-
- ... | taipy/gui/builder/_element.py | 26 | Python | 0.429 | suggestion | 92 | 51 | 51 | false | Direct object passing for decimator (#1591) | 1,677 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 |
def parse_properties(self):
self._properties = {
_Element._parse_property_key(k): self._parse_property(k, v) for k, v in self._properties.items()
}
# Get a deepcopy version of the properties
def _deepcopy_properties(self):
return copy.deepcopy(self._properties)
@sta... | May be a little comment on that specific property name test?
Like... "Properties that hold backend-only object".
So far, only 'decimator' shows up, but that may change in the future don't you think?
| # Convert property value to string/function
def parse_properties(self):
self._properties = {
_Element._parse_property_key(k): self._parse_property(k, v) for k, v in self._properties.items()
}
# Get a deepcopy version of the properties
def _deepcopy_properties(self):
... | @@ -93,47 +94,66 @@ def _parse_property(self, key: str, value: t.Any) -> t.Any:
return value
if isinstance(value, FunctionType):
if key.startswith("on_"):
- if value.__name__.startswith("<"):
- return value
- return value.__name__
-
- ... | taipy/gui/builder/_element.py | 26 | Python | 0.5 | question | 202 | 51 | 51 | false | Direct object passing for decimator (#1591) | 1,677 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | dinhlongviolin1 |
return self._flask.test_client()
def _run_notebook(self):
self._is_running = True
self._ws.run(self._flask, host=self._host, port=self._port, debug=False, use_reloader=False)
def _get_async_mode(self) -> str:
return self._ws.async_mode
def _apply_patch(self):
if se... | Are you supposing that the first element of the tuple is lesser than the second one ? | return self._flask.test_client()
def _run_notebook(self):
self._is_running = True
self._ws.run(self._flask, host=self._host, port=self._port, debug=False, use_reloader=False)
def _get_async_mode(self) -> str:
return self._ws.async_mode
def _apply_patch(self):
if se... | @@ -267,17 +267,25 @@ def _apply_patch(self):
if not patcher.is_monkey_patched("time"):
monkey_patch(time=True)
- def _get_random_port(self): # pragma: no cover
+ def _get_random_port(self, port_auto_ranges: t.Optional[t.List[t.Union[int, t.Tuple[int, int]]]] = None): # pragma: n... | taipy/gui/server.py | 26 | Python | 0.214 | question | 85 | 51 | 51 | false | port auto ranges (#1519) | 1,679 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 |
continue
new_line = ""
last_index = 0
# Opening tags
m = _Preprocessor.__OPENING_TAG_RE.search(line)
if m is not None:
tag = "part"
properties: List[Tuple[str, str]] = []
if m.group(2):
... | ```suggestion
_warn(f"Failed to recognized block tag '{tag}' in line {line_count}. Check that you are closing the tag properly with '|>' if it is a control element.") # noqa: E501
``` | continue
new_line = ""
last_index = 0
# Opening tags
m = _Preprocessor.__OPENING_TAG_RE.search(line)
if m is not None:
tag = "part"
properties: List[Tuple[str, str]] = []
if m.group(2):
... | @@ -100,7 +111,7 @@ def run(self, lines: List[str]) -> List[str]:
line += f' {property[0]}="{prop_value}"'
line += _MarkdownFactory._TAIPY_END + new_line_delimeter
else:
- _warn(f"Invalid tag name '{tag}' in line {line_count}.")
+ ... | taipy/gui/_renderers/_markdown/preproc.py | 26 | Python | 0.786 | bug | 206 | 51 | 51 | false | fix pipe warning (#467) | 1,684 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | dinhlongviolin1 |
}
if (changeDelay > 0) {
if (delayCall.current > 0) {
clearTimeout(delayCall.current);
}
delayCall.current = window.setTimeout(() => {
delayCall.current = -1;
dispatch(createSendUpdateActi... | why val.tostring() ? if val is a number, all good ... | : numberSx,
[props.width]
);
const updateValueWithDelay = useCallback(
(value: number | string) => {
if (changeDelay === -1) {
return;
}
if (changeDelay === 0) {
// Workaround using microtask to ensure the value... | @@ -112,6 +112,7 @@ const Input = (props: TaipyInputProps) => {
val = max;
}
setValue(val.toString());
+ dispatch(createSendUpdateAction(updateVarName, val.toString(), module, onChange, propagate)); | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.214 | question | 53 | 51 | 51 | false | Update number visual element with stepper button & shift key | 1,706 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
max,
onChange,
propagate,
min,
changeDelay,
]
);
const roundBasedOnStep = useMemo(() => {
const stepString = (step || 1).toString();
const decimalPlaces = stepString.includes(".") ? stepString.split(".")[1].length : 0;
... | you can dispatch from the setValue inner function
That allows to *not* depend on the value ie lee re-render ... | clearTimeout(delayCall.current);
delayCall.current = -1;
dispatch(createSendUpdateAction(updateVarName, val, module, onChange, propagate));
} else if (changeDelay === -1) {
dispatch(createSendUpdateAction(updateVarName, val,... | @@ -171,24 +175,18 @@ const Input = (props: TaipyInputProps) => {
const handleStepperMouseDown = useCallback(
(event: React.MouseEvent<HTMLButtonElement>, increment: boolean) => {
- setValue((prevValue) => {
- const newValue = calculateNewValue(
- prevValue,
... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.357 | suggestion | 112 | 51 | 51 | false | Update number visual element with stepper button & shift key | 1,706 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
const handleAction = useCallback(
(evt: KeyboardEvent<HTMLDivElement>) => {
if (evt.shiftKey && type === "number") {
if (evt.key === "ArrowUp") {
let val =
Number(evt.currentTarget.querySelector("input")?.value || 0) +
... | I don't think `value` is the right thing here ? | });
return;
}
if (delayCall.current > 0) {
clearTimeout(delayCall.current);
}
delayCall.current = window.setTimeout(() => {
delayCall.current = -1;
dispatch(createSendUpdateAction(updateVarNam... | @@ -121,8 +122,10 @@ const Input = (props: TaipyInputProps) => {
val = min;
}
setValue(val.toString());
+ dispatch(createSendUpdateAction(updateVarName, val.toString(), module, onChange, propagate));
evt.preventDe... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.214 | question | 47 | 51 | 51 | false | Update number visual element with stepper button & shift key | 1,706 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
const active = useDynamicProperty(props.active, props.defaultActive, true);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);
const step = useDynamicProperty(props.step, prop... | you don't need to set delayCall if changeDelay == 0 | const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
const active = useDynamicProperty(props.active, props.defaultActive, true);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined);
const step = useDynamicProperty(props.step, prop... | @@ -80,14 +80,47 @@ const Input = (props: TaipyInputProps) => {
const min = useDynamicProperty(props.min, props.defaultMin, undefined);
const max = useDynamicProperty(props.max, props.defaultMax, undefined);
- const textSx = useMemo(() => props.width ? {...numberSx, maxWidth: getCssSize(props.width)} : n... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.286 | suggestion | 51 | 51 | 51 | false | Update number visual element with stepper button & shift key | 1,706 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
if (changeDelay === -1) {
return;
}
if (changeDelay === 0) {
delayCall.current = window.setTimeout(() => {
dispatch(createSendUpdateAction(updateVarName, value, module, onChange, propagate));
}, 0.1);
... | idem
and I think you don't need the setTimeout if handleInput is only called by user interaction (ie not in a setState) | if (changeDelay === -1) {
return;
}
if (changeDelay === 0) {
// Workaround using microtask to ensure the value is updated before the next action to avoid the bad setState behavior
Promise.resolve().then(() => {
dispa... | @@ -80,14 +80,47 @@ const Input = (props: TaipyInputProps) => {
const min = useDynamicProperty(props.min, props.defaultMin, undefined);
const max = useDynamicProperty(props.max, props.defaultMax, undefined);
- const textSx = useMemo(() => props.width ? {...numberSx, maxWidth: getCssSize(props.width)} : n... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.571 | suggestion | 120 | 51 | 51 | false | Update number visual element with stepper button & shift key | 1,706 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
if (changeDelay > 0) {
if (delayCall.current > 0) {
clearTimeout(delayCall.current);
}
delayCall.current = window.setTimeout(() => {
delayCall.current = -1;
dispatch(createSendUpdateAction(updateVarNa... | And I don't think we want to call the onAction when the user presses Arrow up or down ? | const handleAction = useCallback(
(evt: KeyboardEvent<HTMLDivElement>) => {
if (evt.shiftKey && type === "number") {
if (evt.key === "ArrowUp") {
let val =
Number(evt.currentTarget.querySelector("input")?.value || 0) +
... | @@ -114,6 +147,8 @@ const Input = (props: TaipyInputProps) => {
val = max;
}
setValue(val.toString());
+ updateValueWithDelay(val);
+ onAction && dispatch(createSendActionNameAction(id, module, onAction, evt.key, up... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.286 | question | 87 | 51 | 51 | false | Update number visual element with stepper button & shift key | 1,706 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 |
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Should the exception be added to the reason?
Especially useful on user function | path (str): The path of the file to upload to the data node.
upload_checker (Optional[Callable[[str, Any], bool]]): A function to check if the upload is allowed.
The function takes the title of the upload data and the data itself as arguments and returns
True if t... | @@ -135,7 +135,16 @@ def _upload(self, path: str, upload_checker: Optional[Callable[[str, Any], bool]
return reason_collection
if upload_checker is not None:
- if not upload_checker(upload_path.name, upload_data):
+ try:
+ can_upload = upload_checker(upload_p... | taipy/core/data/_file_datanode_mixin.py | 26 | Python | 0.429 | suggestion | 79 | 161 | 47 | false | Feature - Add try catch around the upload_checker call | 1,732 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | trgiangdo |
**properties (dict[str, any]): A keyworded variable length list of additional arguments.
Returns:
The new default scenario configuration.
"""
@staticmethod
def set_default_data_node_configuration(
storage_type: str, scope: Optional[Scope] = None, validity_period... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | **properties (dict[str, any]): A keyworded variable length list of additional arguments.
Returns:
The new default scenario configuration.
"""
@staticmethod
def set_default_data_node_configuration(
storage_type: str, scope: Optional[Scope] = None, validity_period... | @@ -267,7 +267,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 265 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
@classmethod
def configure_data_node(
cls,
id: str,
storage_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**properties,
) -> "DataNodeConfig":
"""Configure a new data node configuration.
... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | The new data node configuration.
"""
@classmethod
def configure_data_node(
cls,
id: str,
storage_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**properties,
) -> "DataNodeConfig":
... | @@ -318,7 +318,7 @@ class Config:
`(Config.)set_default_data_node_configuration()^`).
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is co... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
@classmethod
def configure_csv_data_node(
cls,
id: str,
default_path: Optional[str] = None,
encoding: Optional[str] = None,
has_header: Optional[bool] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optio... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | Returns:
The new data node configuration.
""" # noqa: E501
@classmethod
def configure_csv_data_node(
cls,
id: str,
default_path: Optional[str] = None,
encoding: Optional[str] = None,
has_header: Optional[bool] = None,
exposed_type: Op... | @@ -351,7 +351,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
@classmethod
def configure_json_data_node(
cls,
id: str,
default_path: Optional[str] = None,
encoding: Optional[str] = None,
encoder: Optional[json.JSONEncoder] = None,
decoder: Optional[json.JSONDecoder] = None,
scope: Optional[Scope] = None,
val... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | If *validity_period* is set to None, the data node is always up-to-date.
**properties (dict[str, any]): A keyworded variable length list of additional arguments.
Returns:
The new CSV data node configuration.
""" # noqa: E501
@classmethod
def configure_j... | @@ -383,7 +383,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
validity_period: Optional[timedelta] = None,
**properties,
) -> "DataNodeConfig":
"""Configure a new Parquet data node configuration.
Parameters:
id (str): The unique identifier of the new Parquet data node configuration.
default_path (Optional[str]): The def... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | id: str,
default_path: Optional[str] = None,
engine: Optional[str] = None,
compression: Optional[str] = None,
read_kwargs: Optional[Dict] = None,
write_kwargs: Optional[Dict] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
... | @@ -426,7 +426,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
def configure_excel_data_node(
cls,
id: str,
default_path: Optional[str] = None,
has_header: Optional[bool] = None,
sheet_name: Optional[Union[List[str], str]] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: ... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | [page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
If *validity_period* is set to None, the data node is always up-to-date.
**properties (dict[str, any]): A keyworded variable length list o... | @@ -460,7 +460,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
cls,
id: str,
read_fct: Optional[Callable] = None,
write_fct: Optional[Callable] = None,
read_fct_args: Optional[List] = None,
write_fct_args: Optional[List] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**prop... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | relevant tasks will run even if they are skippable (see the Task configuration
[page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
If *validity_period* is set to None, the data node is a... | @@ -495,7 +495,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
Returns:
The new Generic data node configuration.
""" # noqa: E501
@classmethod
def configure_in_memory_data_node(
cls,
id: str,
default_data: Optional[Any] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | The provided function must have at least one parameter that receives the data to be written.
read_fct_args (Optional[List]): The list of arguments that are passed to the function
*read_fct* to read data.
write_fct_args (Optional[List]): The list of arguments that ... | @@ -523,7 +523,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
""" # noqa: E501
@classmethod
def configure_pickle_data_node(
cls,
id: str,
default_path: Optional[str] = None,
default_data: Optional[Any] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**properties,
) ->... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | default_data (Optional[any]): The default data of the data nodes instantiated from
this in_memory data node configuration.
If provided, note that the default_data will be stored as a configuration attribute.
So it is designed to handle small data values like p... | @@ -554,7 +554,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
db_name (str): The database name, or the name of the SQLite database file.
db_engine (str): The database engine. Possible values are *"sqlite"*, *"mssql"*, *"mysql"*,
or *"postgresql"*.
table_name (str): The name of the SQL table.
db_username (Optional[str... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | table_name: str,
db_username: Optional[str] = None,
db_password: Optional[str] = None,
db_host: Optional[str] = None,
db_port: Optional[int] = None,
db_driver: Optional[str] = None,
sqlite_folder_path: Optional[str] = None,
sqlite_file_extension: Optional[... | @@ -611,7 +611,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
write_query_builder (Callable): A callback function that takes the data as an input parameter
and returns a list of SQL queries to be executed when writing data to the data node.
append_query_builder (Optional[Callable]): A callback function that takes the data as an input parame... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | db_password: Optional[str] = None,
db_host: Optional[str] = None,
db_port: Optional[int] = None,
db_driver: Optional[str] = None,
sqlite_folder_path: Optional[str] = None,
sqlite_file_extension: Optional[str] = None,
db_extra_args: Optional[Dict[str, Any]] = None,... | @@ -674,7 +674,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
) -> "DataNodeConfig":
"""Configure a new Mongo collection data node configuration.
Parameters:
id (str): The unique identifier of the new Mongo collection data node configuration.
db_name (str): The database name.
collection_name (str): The collection in the dat... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | If *validity_period* is set to None, the data node is always up-to-date.
**properties (dict[str, any]): A keyworded variable length list of additional arguments.
Returns:
The new SQL data node configuration.
""" # noqa: E501
@classmethod
def configure_mo... | @@ -722,7 +722,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
aws_access_key: str,
aws_secret_access_key: str,
aws_s3_bucket_name: str,
aws_s3_object_key: str,
aws_region: Optional[str] = None,
aws_s3_object_parameters: Optional[Dict[str, Any]] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelt... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | The default value is "localhost".
db_port (Optional[int]): The database port.<br/>
The default value is 27017.
db_driver (Optional[str]): The database driver.
db_extra_args (Optional[dict[str, any]]): A dictionary of additional arguments to be passed
... | @@ -759,7 +759,7 @@ class Config:
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considered stal... | taipy/config/config.pyi | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
mode: Optional[str] = None,
version_number: Optional[str] = None,
force: Optional[bool] = None,
**properties,
) -> "CoreSection":
"""Configure the Orchestrator service.
Parameters:
root_folder (Optional[str]): Path of the base folder for the taipy applica... | ```suggestion
[Versioning management](../../userman/advanced_features/versioning/index.md)
documentation page for more details.
``` | ) -> "JobConfig":
"""Configure job execution.
Parameters:
mode (Optional[str]): The job execution mode.
Possible values are: *"standalone"* or *"development"*.
max_nb_of_workers (Optional[int, str]): Parameter used only in *"standalone"* mode.
... | @@ -881,7 +881,7 @@ class Config:
mode (Optional[str]): Indicates the mode of the version management system.
Possible values are *"development"* or *"experiment"*. On Enterprise edition of Taipy,
*production* mode is also available. Please refer to the
- [Ve... | taipy/config/config.pyi | 26 | Python | 0.786 | suggestion | 166 | 36 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
# Assign default value to optional properties if not defined by user
if self._OPTIONAL_PROPERTIES.get(self._storage_type):
for optional_property, default_value in self._OPTIONAL_PROPERTIES[self._storage_type].items():
if default_value is not None and self._properties.get(opti... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | # Assign default value to optional properties if not defined by user
if self._OPTIONAL_PROPERTIES.get(self._storage_type):
for optional_property, default_value in self._OPTIONAL_PROPERTIES[self._storage_type].items():
if default_value is not None and self._properties.get(opti... | @@ -411,7 +411,7 @@ def _set_default_configuration(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node ... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
@classmethod
def _configure(
cls,
id: str,
storage_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**properties,
) -> "DataNodeConfig":
"""Configure a new data node configuration.
Parame... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` |
return cls.__configure(id, source_configuration.storage_type, scope, validity_period, **properties)
@classmethod
def _configure(
cls,
id: str,
storage_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
... | @@ -470,7 +470,7 @@ def _configure(
`(Config.)set_default_data_node_configuration()^`).
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is ... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
@classmethod
def _configure_csv(
cls,
id: str,
default_path: Optional[str] = None,
encoding: Optional[str] = None,
has_header: Optional[bool] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timed... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | return configuration_map[storage_type](id=id, scope=scope, validity_period=validity_period, **properties)
return cls.__configure(id, storage_type, scope, validity_period, **properties)
@classmethod
def _configure_csv(
cls,
id: str,
default_path: Optional[str] = None... | @@ -521,7 +521,7 @@ def _configure_csv(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considere... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
@classmethod
def _configure_json(
cls,
id: str,
default_path: Optional[str] = None,
encoding: Optional[str] = None,
encoder: Optional[json.JSONEncoder] = None,
decoder: Optional[json.JSONDecoder] = None,
scope: Optional[Scope] = None,
validity_per... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | if has_header is not None:
properties[cls._OPTIONAL_HAS_HEADER_CSV_PROPERTY] = has_header
if exposed_type is not None:
properties[cls._OPTIONAL_EXPOSED_TYPE_CSV_PROPERTY] = exposed_type
return cls.__configure(id, DataNodeConfig._STORAGE_TYPE_VALUE_CSV, scope, validity_pe... | @@ -563,7 +563,7 @@ def _configure_json(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is consider... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
validity_period: Optional[timedelta] = None,
**properties,
) -> "DataNodeConfig":
"""Configure a new Parquet data node configuration.
Parameters:
id (str): The unique identifier of the new Parquet data node configuration.
default_path (Optional[str]): The def... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | id: str,
default_path: Optional[str] = None,
engine: Optional[str] = None,
compression: Optional[str] = None,
read_kwargs: Optional[Dict] = None,
write_kwargs: Optional[Dict] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
... | @@ -616,7 +616,7 @@ def _configure_parquet(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is consi... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
def _configure_excel(
cls,
id: str,
default_path: Optional[str] = None,
has_header: Optional[bool] = None,
sheet_name: Optional[Union[List[str], str]] = None,
exposed_type: Optional[str] = None,
scope: Optional[Scope] = None,
validity_period: Optional[... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | if read_kwargs is not None:
properties[cls._OPTIONAL_READ_KWARGS_PARQUET_PROPERTY] = read_kwargs
if write_kwargs is not None:
properties[cls._OPTIONAL_WRITE_KWARGS_PARQUET_PROPERTY] = write_kwargs
if exposed_type is not None:
properties[cls._OPTIONAL_EXPOSED_T... | @@ -664,7 +664,7 @@ def _configure_excel(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is conside... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
cls,
id: str,
read_fct: Optional[Callable] = None,
write_fct: Optional[Callable] = None,
read_fct_args: Optional[List] = None,
write_fct_args: Optional[List] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelta] = None,
**prop... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | properties[cls._OPTIONAL_DEFAULT_PATH_EXCEL_PROPERTY] = default_path
if has_header is not None:
properties[cls._OPTIONAL_HAS_HEADER_EXCEL_PROPERTY] = has_header
if sheet_name is not None:
properties[cls._OPTIONAL_SHEET_NAME_EXCEL_PROPERTY] = sheet_name
if expo... | @@ -709,7 +709,7 @@ def _configure_generic(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is consi... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
properties[cls._OPTIONAL_WRITE_FUNCTION_ARGS_GENERIC_PROPERTY] = write_fct_args
return cls.__configure(id, DataNodeConfig._STORAGE_TYPE_VALUE_GENERIC, scope, validity_period, **properties)
@classmethod
def _configure_in_memory(
cls,
id: str,
default_data: Optional[A... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | [page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
If *validity_period* is set to None, the data node is always up-to-date.
**properties (dict[str, any]): A keyworded variable length list o... | @@ -747,7 +747,7 @@ def _configure_in_memory(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is con... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
return cls.__configure(id, DataNodeConfig._STORAGE_TYPE_VALUE_IN_MEMORY, scope, validity_period, **properties)
@classmethod
def _configure_pickle(
cls,
id: str,
default_path: Optional[str] = None,
default_data: Optional[Any] = None,
scope: Optional[Scope] = None,... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | scope (Optional[Scope^]): The scope of the in_memory data node configuration.<br/>
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the va... | @@ -782,7 +782,7 @@ def _configure_pickle(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is consid... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
db_name (str): The database name, or the name of the SQLite database file.
db_engine (str): The database engine. Possible values are *"sqlite"*, *"mssql"*, *"mysql"*,
or *"postgresql"*.
table_name (str): The name of the SQL table.
db_username (Optional[str... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | table_name: str,
db_username: Optional[str] = None,
db_password: Optional[str] = None,
db_host: Optional[str] = None,
db_port: Optional[int] = None,
db_driver: Optional[str] = None,
sqlite_folder_path: Optional[str] = None,
sqlite_file_extension: Optional[... | @@ -845,7 +845,7 @@ def _configure_sql_table(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is con... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
write_query_builder (Callable): A callback function that takes the data as an input parameter
and returns a list of SQL queries to be executed when writing data to the data node.
append_query_builder (Optional[Callable]): A callback function that takes the data as an input parame... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | db_password: Optional[str] = None,
db_host: Optional[str] = None,
db_port: Optional[int] = None,
db_driver: Optional[str] = None,
sqlite_folder_path: Optional[str] = None,
sqlite_file_extension: Optional[str] = None,
db_extra_args: Optional[Dict[str, Any]] = None,... | @@ -936,7 +936,7 @@ def _configure_sql(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is considere... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
) -> "DataNodeConfig":
"""Configure a new Mongo collection data node configuration.
Parameters:
id (str): The unique identifier of the new Mongo collection data node configuration.
db_name (str): The database name.
collection_name (str): The collection in the dat... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` | properties[cls._OPTIONAL_DB_EXTRA_ARGS_SQL_PROPERTY] = db_extra_args
if exposed_type is not None:
properties[cls._OPTIONAL_EXPOSED_TYPE_SQL_PROPERTY] = exposed_type
return cls.__configure(id, DataNodeConfig._STORAGE_TYPE_VALUE_SQL, scope, validity_period, **properties)
@cla... | @@ -1015,7 +1015,7 @@ def _configure_mongo_collection(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data no... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
aws_access_key: str,
aws_secret_access_key: str,
aws_s3_bucket_name: str,
aws_s3_object_key: str,
aws_region: Optional[str] = None,
aws_s3_object_parameters: Optional[Dict[str, Any]] = None,
scope: Optional[Scope] = None,
validity_period: Optional[timedelt... | ```suggestion
relevant tasks will run even if they are skippable (see the
[Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)
for more details).
``` |
if custom_document is not None:
properties[cls._OPTIONAL_CUSTOM_DOCUMENT_MONGO_PROPERTY] = custom_document
if db_username is not None:
properties[cls._OPTIONAL_USERNAME_MONGO_PROPERTY] = db_username
if db_password is not None:
properties[cls._OPTIONAL_PASSWOR... | @@ -1077,7 +1077,7 @@ def _configure_s3_object(
The default value is `Scope.SCENARIO`.
validity_period (Optional[timedelta]): The duration since the last edit date for which the data node can be
considered up-to-date. Once the validity period has passed, the data node is c... | taipy/core/config/data_node_config.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
import threading
import typing as t
from ._warnings import _warn
from .gui import Gui
from .state import State
def download(
state: State, content: t.Any, name: t.Optional[str] = "", on_action: t.Optional[t.Union[str, t.Callable]] = ""
):
"""Download content to the client.
Arguments:
state (Sta... | ```suggestion
- a buffer (such as a `bytes` object): if the size of the buffer is smaller than the
``` |
import threading
import typing as t
from ._warnings import _warn
from .gui import Gui
from .state import State
def download(
state: State, content: t.Any, name: t.Optional[str] = "", on_action: t.Optional[t.Union[str, t.Callable]] = ""
):
"""Download content to the client.
Arguments:
state (Sta... | @@ -34,7 +34,7 @@ def download(
- a string: the value must be an existing path name to the file that gets downloaded or
the URL to the resource you want to download.
- a buffer (such as a `bytes` object): if the size of the buffer is smaller than | taipy/gui/gui_actions.py | 26 | Python | 0.714 | suggestion | 112 | 51 | 51 | false | Doc/#1007 improve doc navigability | 1,743 | Avaiga/taipy | 12,680 | Python | jrobinAV | FlorianJacta |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.