Skip to content

Commit a5ebf4f

Browse files
edhinardMichaReiser
authored andcommitted
add conventional xml.etree.ElementTree import alias (#12455)
1 parent 3898d73 commit a5ebf4f

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

crates/ruff/tests/snapshots/show_settings__display_default_settings.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ linter.flake8_import_conventions.aliases = {
260260
seaborn = sns,
261261
tensorflow = tf,
262262
tkinter = tk,
263+
xml.etree.ElementTree = ET,
263264
}
264265
linter.flake8_import_conventions.banned_aliases = {}
265266
linter.flake8_import_conventions.banned_from = []

crates/ruff_linter/src/rules/flake8_import_conventions/settings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const CONVENTIONAL_ALIASES: &[(&str, &str)] = &[
2424
("plotly.express", "px"),
2525
("polars", "pl"),
2626
("pyarrow", "pa"),
27+
("xml.etree.ElementTree", "ET"),
2728
];
2829

2930
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize, CacheKey)]

crates/ruff_workspace/src/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ pub struct Flake8ImportConventionsOptions {
13061306
/// The conventional aliases for imports. These aliases can be extended by
13071307
/// the [`extend-aliases`](#lint_flake8-import-conventions_extend-aliases) option.
13081308
#[option(
1309-
default = r#"{"altair": "alt", "matplotlib": "mpl", "matplotlib.pyplot": "plt", "numpy": "np", "pandas": "pd", "seaborn": "sns", "tensorflow": "tf", "tkinter": "tk", "holoviews": "hv", "panel": "pn", "plotly.express": "px", "polars": "pl", "pyarrow": "pa"}"#,
1309+
default = r#"{"altair": "alt", "matplotlib": "mpl", "matplotlib.pyplot": "plt", "numpy": "np", "pandas": "pd", "seaborn": "sns", "tensorflow": "tf", "tkinter": "tk", "holoviews": "hv", "panel": "pn", "plotly.express": "px", "polars": "pl", "pyarrow": "pa", "xml.etree.ElementTree": "ET"}"#,
13101310
value_type = "dict[str, str]",
13111311
scope = "aliases",
13121312
example = r#"

0 commit comments

Comments
 (0)