1# This Pylint rcfile contains a best-effort configuration to uphold the
2# best-practices and style described in the Google Python style guide:
3#   https://google.github.io/styleguide/pyguide.html
4#
5# Its canonical open-source location is:
6#   https://google.github.io/styleguide/pylintrc
7
8[MASTER]
9
10# Add files or directories to the blacklist. They should be base names, not
11# paths.
12ignore=third_party
13
14# Add files or directories matching the regex patterns to the blacklist. The
15# regex matches against base names, not paths.
16ignore-patterns=
17
18# Pickle collected data for later comparisons.
19persistent=no
20
21# List of plugins (as comma separated values of python modules names) to load,
22# usually to register additional checkers.
23load-plugins=
24
25# Use multiple processes to speed up Pylint.
26jobs=4
27
28# Allow loading of arbitrary C extensions. Extensions are imported into the
29# active Python interpreter and may run arbitrary code.
30unsafe-load-any-extension=no
31
32# A comma-separated list of package or module names from where C extensions may
33# be loaded. Extensions are loading into the active Python interpreter and may
34# run arbitrary code
35extension-pkg-whitelist=
36
37
38[MESSAGES CONTROL]
39
40# Only show warnings with the listed confidence levels. Leave empty to show
41# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
42confidence=
43
44# Enable the message, report, category or checker with the given id(s). You can
45# either give multiple identifier separated by comma (,) or put this option
46# multiple time (only on the command line, not in the configuration file where
47# it should appear only once). See also the "--disable" option for examples.
48#enable=
49
50# Disable the message, report, category or checker with the given id(s). You
51# can either give multiple identifiers separated by comma (,) or put this
52# option multiple times (only on the command line, not in the configuration
53# file where it should appear only once).You can also use "--disable=all" to
54# disable everything first and then reenable specific checks. For example, if
55# you want to run only the similarities checker, you can use "--disable=all
56# --enable=similarities". If you want to run only the classes checker, but have
57# no Warning level messages displayed, use"--disable=all --enable=classes
58# --disable=W"
59disable=abstract-method,
60        apply-builtin,
61        arguments-differ,
62        attribute-defined-outside-init,
63        backtick,
64        bad-option-value,
65        basestring-builtin,
66        buffer-builtin,
67        c-extension-no-member,
68        consider-using-enumerate,
69        cmp-builtin,
70        cmp-method,
71        coerce-builtin,
72        coerce-method,
73        delslice-method,
74        div-method,
75        duplicate-code,
76        eq-without-hash,
77        execfile-builtin,
78        file-builtin,
79        filter-builtin-not-iterating,
80        fixme,
81        getslice-method,
82        global-statement,
83        hex-method,
84        idiv-method,
85        implicit-str-concat-in-sequence,
86        import-error,
87        import-self,
88        import-star-module-level,
89        inconsistent-return-statements,
90        input-builtin,
91        intern-builtin,
92        invalid-str-codec,
93        locally-disabled,
94        long-builtin,
95        long-suffix,
96        map-builtin-not-iterating,
97        misplaced-comparison-constant,
98        missing-function-docstring,
99        metaclass-assignment,
100        next-method-called,
101        next-method-defined,
102        no-absolute-import,
103        no-else-break,
104        no-else-continue,
105        no-else-raise,
106        no-else-return,
107        no-init,  # added
108        no-member,
109        no-name-in-module,
110        no-self-use,
111        nonzero-method,
112        oct-method,
113        old-division,
114        old-ne-operator,
115        old-octal-literal,
116        old-raise-syntax,
117        parameter-unpacking,
118        print-statement,
119        raising-string,
120        range-builtin-not-iterating,
121        raw_input-builtin,
122        rdiv-method,
123        reduce-builtin,
124        relative-import,
125        reload-builtin,
126        round-builtin,
127        setslice-method,
128        signature-differs,
129        standarderror-builtin,
130        suppressed-message,
131        sys-max-int,
132        too-few-public-methods,
133        too-many-ancestors,
134        too-many-arguments,
135        too-many-boolean-expressions,
136        too-many-branches,
137        too-many-instance-attributes,
138        too-many-locals,
139        too-many-nested-blocks,
140        too-many-public-methods,
141        too-many-return-statements,
142        too-many-statements,
143        trailing-newlines,
144        unichr-builtin,
145        unicode-builtin,
146        unnecessary-pass,
147        unpacking-in-except,
148        useless-else-on-loop,
149        useless-object-inheritance,
150        useless-suppression,
151        using-cmp-argument,
152        wrong-import-order,
153        xrange-builtin,
154        zip-builtin-not-iterating,
155
156
157[REPORTS]
158
159# Set the output format. Available formats are text, parseable, colorized, msvs
160# (visual studio) and html. You can also give a reporter class, eg
161# mypackage.mymodule.MyReporterClass.
162output-format=text
163
164# Put messages in a separate file for each module / package specified on the
165# command line instead of printing them on stdout. Reports (if any) will be
166# written in a file name "pylint_global.[txt|html]". This option is deprecated
167# and it will be removed in Pylint 2.0.
168files-output=no
169
170# Tells whether to display a full report or only the messages
171reports=no
172
173# Python expression which should return a note less than 10 (10 is the highest
174# note). You have access to the variables errors warning, statement which
175# respectively contain the number of errors / warnings messages and the total
176# number of statements analyzed. This is used by the global evaluation report
177# (RP0004).
178evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
179
180# Template used to display messages. This is a python new-style format string
181# used to format the message information. See doc for all details
182#msg-template=
183
184
185[BASIC]
186
187# Good variable names which should always be accepted, separated by a comma
188good-names=main,_
189
190# Bad variable names which should always be refused, separated by a comma
191bad-names=
192
193# Colon-delimited sets of names that determine each other's naming style when
194# the name regexes allow several styles.
195name-group=
196
197# Include a hint for the correct naming format with invalid-name
198include-naming-hint=no
199
200# List of decorators that produce properties, such as abc.abstractproperty. Add
201# to this list to register other decorators that produce valid properties.
202property-classes=abc.abstractproperty,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl
203
204# Regular expression matching correct function names
205function-rgx=^(?:(?P<exempt>setUp|tearDown|setUpModule|tearDownModule)|(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$
206
207# Regular expression matching correct variable names
208variable-rgx=^[a-z][a-z0-9_]*$
209
210# Regular expression matching correct constant names
211const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
212
213# Regular expression matching correct attribute names
214attr-rgx=^_{0,2}[a-z][a-z0-9_]*$
215
216# Regular expression matching correct argument names
217argument-rgx=^[a-z][a-z0-9_]*$
218
219# Regular expression matching correct class attribute names
220class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
221
222# Regular expression matching correct inline iteration names
223inlinevar-rgx=^[a-z][a-z0-9_]*$
224
225# Regular expression matching correct class names
226class-rgx=^_?[A-Z][a-zA-Z0-9]*$
227
228# Regular expression matching correct module names
229module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$
230
231# Regular expression matching correct method names
232method-rgx=(?x)^(?:(?P<exempt>_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$
233
234# Regular expression which should only match function or class names that do
235# not require a docstring.
236no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$
237
238# Minimum line length for functions/classes that require docstrings, shorter
239# ones are exempt.
240docstring-min-length=10
241
242
243[TYPECHECK]
244
245# List of decorators that produce context managers, such as
246# contextlib.contextmanager. Add to this list to register other decorators that
247# produce valid context managers.
248contextmanager-decorators=contextlib.contextmanager,contextlib2.contextmanager
249
250# Tells whether missing members accessed in mixin class should be ignored. A
251# mixin class is detected if its name ends with "mixin" (case insensitive).
252ignore-mixin-members=yes
253
254# List of module names for which member attributes should not be checked
255# (useful for modules/projects where namespaces are manipulated during runtime
256# and thus existing member attributes cannot be deduced by static analysis. It
257# supports qualified module names, as well as Unix pattern matching.
258ignored-modules=
259
260# List of class names for which member attributes should not be checked (useful
261# for classes with dynamically set attributes). This supports the use of
262# qualified names.
263ignored-classes=optparse.Values,thread._local,_thread._local
264
265# List of members which are set dynamically and missed by pylint inference
266# system, and so shouldn't trigger E1101 when accessed. Python regular
267# expressions are accepted.
268generated-members=
269
270
271[FORMAT]
272
273# Maximum number of characters on a single line.
274max-line-length=80
275
276# TODO(https://github.com/PyCQA/pylint/issues/3352): Direct pylint to exempt
277# lines made too long by directives to pytype.
278
279# Regexp for a line that is allowed to be longer than the limit.
280ignore-long-lines=(?x)(
281  ^\s*(\#\ )?<?https?://\S+>?$|
282  ^\s*(from\s+\S+\s+)?import\s+.+$)
283
284# Allow the body of an if to be on the same line as the test if there is no
285# else.
286single-line-if-stmt=yes
287
288# List of optional constructs for which whitespace checking is disabled. `dict-
289# separator` is used to allow tabulation in dicts, etc.: {1  : 1,\n222: 2}.
290# `trailing-comma` allows a space between comma and closing bracket: (a, ).
291# `empty-line` allows space-only lines.
292no-space-check=
293
294# Maximum number of lines in a module
295max-module-lines=99999
296
297# String used as indentation unit.  The internal Google style guide mandates 2
298# spaces.  Google's externaly-published style guide says 4, consistent with
299# PEP 8.  Here, we use 2 spaces, for conformity with many open-sourced Google
300# projects (like TensorFlow).
301indent-string='  '
302
303# Number of spaces of indent required inside a hanging  or continued line.
304indent-after-paren=4
305
306# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
307expected-line-ending-format=
308
309
310[MISCELLANEOUS]
311
312# List of note tags to take in consideration, separated by a comma.
313notes=TODO
314
315
316[STRING]
317
318# This flag controls whether inconsistent-quotes generates a warning when the
319# character used as a quote delimiter is used inconsistently within a module.
320check-quote-consistency=yes
321
322
323[VARIABLES]
324
325# Tells whether we should check for unused import in __init__ files.
326init-import=no
327
328# A regular expression matching the name of dummy variables (i.e. expectedly
329# not used).
330dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_)
331
332# List of additional names supposed to be defined in builtins. Remember that
333# you should avoid to define new builtins when possible.
334additional-builtins=
335
336# List of strings which can identify a callback function by name. A callback
337# name must start or end with one of those strings.
338callbacks=cb_,_cb
339
340# List of qualified module names which can have objects that can redefine
341# builtins.
342redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools
343
344
345[LOGGING]
346
347# Logging modules to check that the string format arguments are in logging
348# function parameter format
349logging-modules=logging,absl.logging,tensorflow.io.logging
350
351
352[SIMILARITIES]
353
354# Minimum lines number of a similarity.
355min-similarity-lines=4
356
357# Ignore comments when computing similarities.
358ignore-comments=yes
359
360# Ignore docstrings when computing similarities.
361ignore-docstrings=yes
362
363# Ignore imports when computing similarities.
364ignore-imports=no
365
366
367[SPELLING]
368
369# Spelling dictionary name. Available dictionaries: none. To make it working
370# install python-enchant package.
371spelling-dict=
372
373# List of comma separated words that should not be checked.
374spelling-ignore-words=
375
376# A path to a file that contains private dictionary; one word per line.
377spelling-private-dict-file=
378
379# Tells whether to store unknown words to indicated private dictionary in
380# --spelling-private-dict-file option instead of raising a message.
381spelling-store-unknown-words=no
382
383
384[IMPORTS]
385
386# Deprecated modules which should not be used, separated by a comma
387deprecated-modules=regsub,
388                   TERMIOS,
389                   Bastion,
390                   rexec,
391                   sets
392
393# Create a graph of every (i.e. internal and external) dependencies in the
394# given file (report RP0402 must not be disabled)
395import-graph=
396
397# Create a graph of external dependencies in the given file (report RP0402 must
398# not be disabled)
399ext-import-graph=
400
401# Create a graph of internal dependencies in the given file (report RP0402 must
402# not be disabled)
403int-import-graph=
404
405# Force import order to recognize a module as part of the standard
406# compatibility libraries.
407known-standard-library=
408
409# Force import order to recognize a module as part of a third party library.
410known-third-party=enchant, absl
411
412# Analyse import fallback blocks. This can be used to support both Python 2 and
413# 3 compatible code, which means that the block might have code that exists
414# only in one or another interpreter, leading to false positives when analysed.
415analyse-fallback-blocks=no
416
417
418[CLASSES]
419
420# List of method names used to declare (i.e. assign) instance attributes.
421defining-attr-methods=__init__,
422                      __new__,
423                      setUp
424
425# List of member names, which should be excluded from the protected access
426# warning.
427exclude-protected=_asdict,
428                  _fields,
429                  _replace,
430                  _source,
431                  _make
432
433# List of valid names for the first argument in a class method.
434valid-classmethod-first-arg=cls,
435                            class_
436
437# List of valid names for the first argument in a metaclass class method.
438valid-metaclass-classmethod-first-arg=mcs
439
440
441[EXCEPTIONS]
442
443# Exceptions that will emit a warning when being caught. Defaults to
444# "Exception"
445overgeneral-exceptions=StandardError,
446                       Exception,
447                       BaseException
448