mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[BE] Add flake8-logging-format linter (#94840)
Follow up to #94708 Pull Request resolved: https://github.com/pytorch/pytorch/pull/94840 Approved by: https://github.com/ezyang
This commit is contained in:
parent
dc4f2af6f6
commit
b46b2e35d4
5
.flake8
5
.flake8
|
|
@ -1,5 +1,6 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
select = B,C,E,F,P,T4,W,B9
|
enable-extensions = G
|
||||||
|
select = B,C,E,F,G,P,T4,W,B9
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
# C408 ignored because we like the dict keyword argument syntax
|
# C408 ignored because we like the dict keyword argument syntax
|
||||||
# E501 is not flexible enough, we're using B950 instead
|
# E501 is not flexible enough, we're using B950 instead
|
||||||
|
|
@ -12,6 +13,8 @@ ignore =
|
||||||
B007,B008,
|
B007,B008,
|
||||||
# these ignores are from flake8-comprehensions; please fix!
|
# these ignores are from flake8-comprehensions; please fix!
|
||||||
C407
|
C407
|
||||||
|
# these ignores are from flake8-logging-format; please fix!
|
||||||
|
G001,G002,G003,G004,G100,G101,G200,G201,G202
|
||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
__init__.py: F401
|
__init__.py: F401
|
||||||
torch/utils/cpp_extension.py: B950
|
torch/utils/cpp_extension.py: B950
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ init_command = [
|
||||||
'flake8-bugbear==20.1.4',
|
'flake8-bugbear==20.1.4',
|
||||||
'flake8-comprehensions==3.3.0',
|
'flake8-comprehensions==3.3.0',
|
||||||
'flake8-executable==2.0.4',
|
'flake8-executable==2.0.4',
|
||||||
|
'flake8-logging-format==0.9.0',
|
||||||
'flake8-pyi==20.5.0',
|
'flake8-pyi==20.5.0',
|
||||||
'mccabe==0.6.1',
|
'mccabe==0.6.1',
|
||||||
'pycodestyle==2.6.0',
|
'pycodestyle==2.6.0',
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ flake8==3.8.2
|
||||||
flake8-bugbear==20.1.4
|
flake8-bugbear==20.1.4
|
||||||
flake8-comprehensions==3.3.0
|
flake8-comprehensions==3.3.0
|
||||||
flake8-executable==2.0.4
|
flake8-executable==2.0.4
|
||||||
|
flake8-logging-format==0.9.0
|
||||||
git+https://github.com/malfet/flake8-coding.git
|
git+https://github.com/malfet/flake8-coding.git
|
||||||
flake8-pyi==20.5.0
|
flake8-pyi==20.5.0
|
||||||
mccabe==0.6.1
|
mccabe==0.6.1
|
||||||
|
|
|
||||||
|
|
@ -491,7 +491,7 @@ class _NnapiSerializer:
|
||||||
raise Exception("Flexible size is not supported for this operand.")
|
raise Exception("Flexible size is not supported for this operand.")
|
||||||
if s < 0:
|
if s < 0:
|
||||||
# runtime flex
|
# runtime flex
|
||||||
LOG.warn(f"Operand {oper} has runtime flex shape")
|
LOG.warning(f"Operand {oper} has runtime flex shape")
|
||||||
return op_id, oper
|
return op_id, oper
|
||||||
|
|
||||||
def get_tensor_operand_or_constant(self, jitval, dim_order=DimOrder.PRESUMED_CONTIGUOUS):
|
def get_tensor_operand_or_constant(self, jitval, dim_order=DimOrder.PRESUMED_CONTIGUOUS):
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ def _calc___package__(globals):
|
||||||
spec = globals.get("__spec__")
|
spec = globals.get("__spec__")
|
||||||
if package is not None:
|
if package is not None:
|
||||||
if spec is not None and package != spec.parent:
|
if spec is not None and package != spec.parent:
|
||||||
_warnings.warn(
|
_warnings.warn( # noqa: G010
|
||||||
"__package__ != __spec__.parent " f"({package!r} != {spec.parent!r})",
|
"__package__ != __spec__.parent " f"({package!r} != {spec.parent!r})",
|
||||||
ImportWarning,
|
ImportWarning,
|
||||||
stacklevel=3,
|
stacklevel=3,
|
||||||
|
|
@ -70,7 +70,7 @@ def _calc___package__(globals):
|
||||||
elif spec is not None:
|
elif spec is not None:
|
||||||
return spec.parent
|
return spec.parent
|
||||||
else:
|
else:
|
||||||
_warnings.warn(
|
_warnings.warn( # noqa: G010
|
||||||
"can't resolve package from __spec__ or __package__, "
|
"can't resolve package from __spec__ or __package__, "
|
||||||
"falling back on __name__ and __path__",
|
"falling back on __name__ and __path__",
|
||||||
ImportWarning,
|
ImportWarning,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user