Visitar URL original
[`flake8-import-conventions`] Add `datetime as dt` as a conventional … · astral-sh/ruff@dba1bc8 · GitHub
Skip to content

Commit dba1bc8

Browse files
committed
[flake8-import-conventions] Add datetime as dt as a conventional alias (ICN001) (#28790)
Summary -- Closes #28604 by adding the alias. This alias is now being recommended in the CPython docs for 3.13+. See https://docs.python.org/3.13/library/datetime.html#datetime.timedelta as one of many examples on the page. Test Plan -- Updated existing test
1 parent ef23c9c commit dba1bc8

16 files changed

Lines changed: 180 additions & 126 deletions

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_extend_from_shared_config.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ linter.flake8_gettext.function_names = [
137137
linter.flake8_implicit_str_concat.allow_multiline = true
138138
linter.flake8_import_conventions.aliases = {
139139
altair = alt,
140+
datetime = dt,
140141
holoviews = hv,
141142
matplotlib = mpl,
142143
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ linter.flake8_gettext.function_names = [
139139
linter.flake8_implicit_str_concat.allow_multiline = true
140140
linter.flake8_import_conventions.aliases = {
141141
altair = alt,
142+
datetime = dt,
142143
holoviews = hv,
143144
matplotlib = mpl,
144145
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_preview_enabled.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ linter.flake8_gettext.function_names = [
141141
linter.flake8_implicit_str_concat.allow_multiline = true
142142
linter.flake8_import_conventions.aliases = {
143143
altair = alt,
144+
datetime = dt,
144145
holoviews = hv,
145146
matplotlib = mpl,
146147
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_target_version_override.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ linter.flake8_gettext.function_names = [
141141
linter.flake8_implicit_str_concat.allow_multiline = true
142142
linter.flake8_import_conventions.aliases = {
143143
altair = alt,
144+
datetime = dt,
144145
holoviews = hv,
145146
matplotlib = mpl,
146147
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ linter.flake8_gettext.function_names = [
138138
linter.flake8_implicit_str_concat.allow_multiline = true
139139
linter.flake8_import_conventions.aliases = {
140140
altair = alt,
141+
datetime = dt,
141142
holoviews = hv,
142143
matplotlib = mpl,
143144
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above_with_tool.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ linter.flake8_gettext.function_names = [
139139
linter.flake8_implicit_str_concat.allow_multiline = true
140140
linter.flake8_import_conventions.aliases = {
141141
altair = alt,
142+
datetime = dt,
142143
holoviews = hv,
143144
matplotlib = mpl,
144145
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above-2.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ linter.flake8_gettext.function_names = [
137137
linter.flake8_implicit_str_concat.allow_multiline = true
138138
linter.flake8_import_conventions.aliases = {
139139
altair = alt,
140+
datetime = dt,
140141
holoviews = hv,
141142
matplotlib = mpl,
142143
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ linter.flake8_gettext.function_names = [
137137
linter.flake8_implicit_str_concat.allow_multiline = true
138138
linter.flake8_import_conventions.aliases = {
139139
altair = alt,
140+
datetime = dt,
140141
holoviews = hv,
141142
matplotlib = mpl,
142143
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_no_target_fallback.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ linter.flake8_gettext.function_names = [
137137
linter.flake8_implicit_str_concat.allow_multiline = true
138138
linter.flake8_import_conventions.aliases = {
139139
altair = alt,
140+
datetime = dt,
140141
holoviews = hv,
141142
matplotlib = mpl,
142143
matplotlib.pyplot = plt,

‎crates/ruff/tests/cli/snapshots/cli__show_settings__display_default_settings.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ linter.flake8_gettext.function_names = [
946946
linter.flake8_implicit_str_concat.allow_multiline = true
947947
linter.flake8_import_conventions.aliases = {
948948
altair = alt,
949+
datetime = dt,
949950
holoviews = hv,
950951
matplotlib = mpl,
951952
matplotlib.pyplot = plt,

0 commit comments

Comments
 (0)