代码拉取完成,页面将自动刷新
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2025)
#
# 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 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.
# See the License for the specific language governing permissions and
# limitations under the License.
# In addition to the standard set of exclusions, omit all tests:
extend-exclude = [
# Autogenerated files:
"lib/streamlit/proto",
"lib/streamlit/emojis.py",
"lib/streamlit/material_icon_names.py",
# File with an expected compilation error:
"e2e_playwright/compilation_error_dialog.py",
# Ignore frontend directory:
"frontend/**",
]
target-version = 'py39'
line-length = 88
[format]
docstring-code-format = true
docstring-code-line-length = "dynamic"
line-ending = "lf"
[lint]
# We activate all rules and only ignore the rules that we don't want to enforce
# or that are not relevant for our codebase.
select = ["ALL"]
ignore = [
# Rules planned to be supported in the future:
"EM101", # Checks for the use of string literals in exception constructors.
"EM102", # Checks for the use of f-strings in exception constructors.
"TRY003", # Checks for exception messages that are not defined in the exception class itself.
# Ignored rule sets:
"DTZ", # Checks for usage of unsafe naive datetime class.
"PTH", # Enforces usage of pathlib.
"C90", # Checks for McCabe complexity.
"FBT", # Forbids boolean positional arguments.
"SLF", # Checks unexpected for private member access.
"BLE", # Checks for blind except statements.
"CPY", # Checks for copyright statement.
"DOC", # Checks for correct docstring format.
# Ignored rules:
"B904", # Checks for raise statements in exception handlers that lack a from clause.
"PYI041", # Checks for parameter annotations that contain redundant unions between builtin numeric types (e.g., int | float).
"PYI051", # Checks for redundant unions between a Literal and a builtin supertype of that Literal.
"PD901", # Checks for usage of `df` variable name.
"PIE790", # Checks for unnecessary pass statements.
"TD003", # Checks for missing issue link in TODO comment.
"TD002", # Checks for missing author in TODO comment.
"D100", # Checks for missing docstring in public module.
"D101", # Checks for missing docstring in public class.
"D102", # Checks for missing docstring in public method.
"D103", # Checks for missing docstring in public function.
"D104", # Checks for missing docstring in public package.
"D105", # Checks for missing docstring in magic method.
"D106", # Checks for missing docstring in public nested class.
"D107", # Checks for missing docstring in __init__.
"D205", # Checks for missing blank line after docstring summary.
"D401", # Checks for docstring to start with imperative mood.
"D202", # Checks for no-blank line after docstring.
"FIX002", # Checks todo comments (which we want to allow).
"PGH003", # Checks for blanket type ignore.
"PLR2004", # Checks for numerical values that could be put into a constant.
"PLR0904", # Checks for classes with too many public methods.
"PLR0911", # Checks for functions with too many return statements.
"PLR0912", # Checks for functions with too many branches.
"PLR0913", # Checks for functions with too many arguments.
"PLR0914", # Checks for functions with too many local variables.
"PLR0915", # Checks for functions with too many statements.
"PLR0916", # Checks for too many boolean expressions in if statements.
"A002", # Checks if function argument shadows a Python builtin.
"TRY300", # Checks for return statements in try blocks.
"ANN401", # Checks that `any` is not used as an annotation.
"SIM105", # Enforces use of contextlib.suppress.
"SIM108", # Enforces ternary operators instead of if-else.
"SIM115", # Enforces context manager for opening files.
"SIM117", # Enforces single with statement with multiple contexts.
"SIM905", # Enforces list instead of st.split.
"COM812", # Checks for absence of trailing commas. Not recommended with formatter.
"COM819", # Checks for presence of prohibited trailing commas. Not recommended with formatter.
"RSE102", # Checks for unnecessary parentheses on raised exceptions.
"RET504", # Checks for assignments that immediately precede a return of the assigned variable (too opinionated).
"PT012", # Checks for pytest.raises context managers with multiple statements.
"PT019", # Checks for tests that should use @pytest.mark.usefixtures (incompatible with unittest.patch)
]
exclude = [
# pympler is a vendored dependency that doesn't conform to our linting rules:
"lib/streamlit/vendor/**",
]
extend-safe-fixes = ["TC002", "TC003"]
[lint.per-file-ignores]
# Only add ignores for entire folders here. To ignore rules in individual
# files, use the noqa ignore comment on top of the given file.
"e2e_playwright/**" = [
"T20",
"B018",
"PD",
"PERF",
"N999",
"S",
"TRY",
"NPY002",
]
"lib/tests/**" = [
"PD",
"D",
"INP",
"PERF",
"N",
"ARG",
"S",
"TRY",
"ANN",
"NPY002",
]
"scripts/**" = ["T20", "INP", "PERF", "S", "TRY002"]
[lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
[lint.isort]
known-first-party = ["streamlit", "shared", "tests", "e2e_playwright"]
[lint.pydocstyle]
convention = "numpy"
[lint.pycodestyle]
# Allow lines (e.g. comments) up to 120 characters instead of 88,
# which works well with Github.
max-line-length = 120
[lint.flake8-comprehensions]
# Allow dict calls that make use of keyword arguments (e.g., dict(a=1, b=2)).
allow-dict-calls-with-keyword-arguments = true
[lint.flake8-unused-arguments]
# Ignore unused variadic argument, like *args and **kwargs.
ignore-variadic-names = true
[lint.flake8-annotations]
# Allow missing return annotation on functions that return None:
suppress-none-returning = true
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。