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.Option Parser(usage='u sage: %prog [OPTIONS]')
parser.add_opti on('-c', '--config',
action='store',
type='string',
dest='configFil ename',
help='config file containing defaults')
(options, args) = parser.parse_ar gs()
#============== =============== =============== =============== ===========
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 2872
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.Option Parser(usage='u sage: %prog [OPTIONS]')
parser.add_opti on('-c', '--config',
action='store',
type='string',
dest='configFil ename',
help='config file containing defaults')
(options, args) = parser.parse_ar gs()
#============== =============== =============== =============== ===========
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.ed u (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.Option Parser(usage='u sage: %prog [OPTIONS]')
parser.add_opti on('-c', '--config',
action='store',
type='string',
dest='configFil ename',
help='config file containing defaults')
(options, args) = parser.parse_ar gs()
#============== =============== =============== =============== ===========
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 the implementation of its
member functions in foo.cpp (which obviously #inludes foo.h) and further
assume that it depends on a class bar which is defined in bar.h.
It seems that there are the following two scenarios:
|
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 anyone know
of anything? Stand-alone or vim based both work for me, though
stand-alone would be preferable.
|
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 many lines? Would there be necessarily be an
advantage to split it up into 2 or 3 files? Can I up the limit?
2) C: 0: Missing required attribute "__revision__"
|
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 configuration
************* Module test_mod
|
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 violations of these
guidelines within the source code? I understand that there are a lot
of code beautifiers out there, but i haven't seen one specially
tailored for Python... Is there even a desire in Python community for
a program like this (by Python...
|
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
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45)
|
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 collating it all together. Obviously
each site needs to be handled differently, but once the information is
collected then more generic functions can be used.
Is it best to have it all in one script or split it into per site
scripts that can then...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |