rspec/rules/S2823/python/rule.adoc

52 lines
825 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
``++__all__++`` is used to define the list of module's names that should be imported when ``++from package import *++`` is used. For that reason, it may only contain strings.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,python]
2021-04-28 16:49:39 +02:00
----
class MyClass:
pass
__all__ = [
MyClass # Noncompliant
]
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,python]
2021-04-28 16:49:39 +02:00
----
class MyClass:
pass
__all__ = [
"MyClass"
]
----
2021-04-28 16:49:39 +02:00
== See
* https://docs.python.org/3/tutorial/modules.html#importing-from-a-package[Python documentation - Importing * From a Package]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]