Hello,
I've been looking into using PyLint on some of my programs, just as a
best practices kind of thing.
Here's a snippet:
#================================================= =====================
if __name__ == '__main__':
parser = optparse.OptionParser(usage='usage: %prog [OPTIONS]')
parser.add_option('-c', '--config',
action='store',
type='string',
dest='configFilename',
help='config file containing defaults')
(options, args) = parser.parse_args()
#================================================= =====================
Now, PyLint reports the following convention warnings:
C:158: Invalid name "parser" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
C:170: Invalid name "options" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
C:170: Invalid name "args" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
Which style convention is it referring to? Should these really be all
caps?
Thank you,
Mick 2 2817
Mick Charles Beaver wrote:
Hello,
I've been looking into using PyLint on some of my programs, just as a
best practices kind of thing.
Here's a snippet:
#================================================= =====================
if __name__ == '__main__':
parser = optparse.OptionParser(usage='usage: %prog [OPTIONS]')
parser.add_option('-c', '--config',
action='store',
type='string',
dest='configFilename',
help='config file containing defaults')
(options, args) = parser.parse_args()
#================================================= =====================
Now, PyLint reports the following convention warnings:
C:158: Invalid name "parser" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
C:170: Invalid name "options" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
C:170: Invalid name "args" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
Which style convention is it referring to? Should these really be all
caps?
There's a style convention that global constants at file scope are
defined in all caps.
Personally, I do all my optparsing in a special function rather than in
the __name__ == '__main__' block.
--
Michael Hoffman mi**@cs.wisc.edu (Mick Charles Beaver) writes:
Here's a snippet:
pylint is reporting line numbers. Can you show us line numbers for
this snippet?
#================================================= =====================
if __name__ == '__main__':
parser = optparse.OptionParser(usage='usage: %prog [OPTIONS]')
parser.add_option('-c', '--config',
action='store',
type='string',
dest='configFilename',
help='config file containing defaults')
(options, args) = parser.parse_args()
#================================================= =====================
Now, PyLint reports the following convention warnings:
C:158: Invalid name "parser" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
C:170: Invalid name "options" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
C:170: Invalid name "args" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$)
These warnings are for line 158 and line 170, which covers a range of
13 lines. Your code snippet is only 8 lines long. So at least one of
those two lines that have warnings reported are not in the code you've
shown to us.
--
\ "Too many Indians spoil the golden egg." -- Sir Joh |
`\ Bjelke-Petersen |
_o__) |
Ben Finney This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Exits Funnel |
last post by:
Hello,
I'm a little confused about where I should include header files and was
wondering whether there was some convention. Imagine I've written a
class foo and put the definition in foo.h and...
|
by: Brian L. Troutwine |
last post by:
I've recently developed a need for a python source code re-formatter,
ideally conforming to the sort of style that pylint enforces. I don't
know of any, and my googling wasn't very productive. Does...
|
by: Michael Yanowitz |
last post by:
Hello:
I ran the new pylint and my code and I had a few questions on why those
are warnings or what I can do to fix them:
1) W: 0: Too many lines in module (1587)
Why is 1587 considered too...
|
by: Tuomas |
last post by:
#!/usr/bin/python
"""test pydev_0.9.3/../pylint"""
__revision__ = "test_mod 0.1 by TV 06/10/22"
lst =
lst = map(lambda x: x.strip(), lst)
result = """
No config file found, using default...
|
by: Alan Isaac |
last post by:
I am brand new to pylint.
As a tab user, I want the tabs warning turned off.
How?
Larger question:
where is the config file format documented?
Thanks,
Alan Isaac
|
by: montyphyton |
last post by:
Some recent posts about Python programming style got me thinking.
Since we have the PEP 8 which gives some guidelines about the style to
be used, do we have any program that can check for...
|
by: dmitrey |
last post by:
Hi all,
I have Eric 4.1.1, pylint and Eric pylint plugin installed, but I
cannot find how to use pylint from Eric IDE GUI.
Does anyone know?
Thank you in advance, D.
|
by: Stefan Rank |
last post by:
on 31.07.2008 11:29 Diez B. Roggisch said the following:
<snip>
<snip>
Three installations of pylint 0.14.0 that I have access to from here:
pylint.bat 0.14.0,
astng 0.17.2, common 0.27.0...
|
by: Astley Le Jasper |
last post by:
I'm still learning python and would like to know what's a good way of
organizing code.
I am writing some scripts to scrape a number of different website that
hold similar information and then...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |