Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Proposed code clean-up diff...
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
dasnyderx  
View profile  
 More options Nov 18 2009, 3:30 pm
From: dasnyderx <dasnyd...@gmail.com>
Date: Wed, 18 Nov 2009 12:30:28 -0800 (PST)
Local: Wed, Nov 18 2009 3:30 pm
Subject: Proposed code clean-up diff...
In an effort to learn and mess with Python, I came across and began
using RSSDler.  However, looking through the code and the log/debug
messages were as mess.  So, I would like to propose the following
patch to clean up the code and messages.  The bulk of the patch
consists of:

- (Attempts at) proper punctuation.
- Proper capitalization.
- Reformatting of the helpMessage parts and components.
Standardization of the options expected types, default value display,
and general cleanup.
- Standardization of the strings in the code (e.g., u""" for
documentation strings (with one exception), u" for all other strings)

There were also portions of the program (both messages, documentation,
and code) which I reformatted so that they stayed within a standard 80-
column viewing area.

The diff is as follows:
-------8><-------------
--- rssdler.py.org      2009-11-18 14:46:11.102706000 -0500
+++ src/rssdler.py      2009-11-18 14:42:40.590487000 -0500
@@ -1,13 +1,13 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-"""An RSS broadcatching script
-(podcasts, videocasts, torrents, or, if you really wanted, web
pages."""
+"""An RSS broadcatching script
+(podcasts, videocasts, torrents, or, if you really wanted, web
pages)"""

 from __future__ import division

 __version__ = u"0.4.2"

-__author__ = u"""lostnihilist <lostnihilist _at_ gmail _dot_ com> or
+__author__ = u"""lostnihilist <lostnihilist _at_ gmail _dot_ com> or
 "lostnihilist" on #libtorr...@irc.worldforge.org"""
 __copyright__ = u"""RSSDler - RSS Broadcatcher
 Copyright (C) 2007, 2008, lostnihilist
@@ -48,7 +48,7 @@
 try: import xml.dom.minidom as minidom
 except ImportError: minidom = None

-if not sys.path.count(''): sys.path.insert(0, '')
+if not sys.path.count(''): sys.path.insert(0, '')

 import feedparser
 try: import mechanize
@@ -58,12 +58,12 @@
 # == Globals ==
 # # # # #
 # Reminders of potential import globals elsewhere.
-resource = None #daemon
+resource = None # daemon
 userFunctions = None
-sqlite3 = None #Firefox3 cookies
+sqlite3 = None # Firefox3 cookies

 # Rest of Globals
-configFile = os.path.expanduser(os.path.join('~','.rssdler',
'config.txt'))
+configFile = os.path.expanduser(os.path.join('~', '.rssdler',
'config.txt'))
 downloader = None
 rss = None
 saved = None
@@ -73,345 +73,350 @@
 _runOnce = None
 _USER_AGENT = u"RSSDler %s" % __version__
 # ~ defined helps with feedburner feeds
-percentQuoteDict = {u'!': u'%21', u' ': u'%20', u'#': u'%23', u'%':
u'%25',
-  u'$': u'%24', u"'": u'%27', u'&': u'%26', u')': u'%29', u'(':
u'%28',
-  u'+': u'%2B', u'*': u'%2A', u',': u'%2C', u'=': u'%3D', u'@':
u'%40',
-  u';': u'%3B', u':': u'%3A', u']': u'%5D', u'[': u'%5B', u'?':
u'%3F',
+percentQuoteDict = {u'!': u'%21', u' ': u'%20', u'#': u'%23', u'%':
u'%25',
+  u'$': u'%24', u"'": u'%27', u'&': u'%26', u')': u'%29', u'(':
u'%28',
+  u'+': u'%2B', u'*': u'%2A', u',': u'%2C', u'=': u'%3D', u'@':
u'%40',
+  u';': u'%3B', u':': u'%3A', u']': u'%5D', u'[': u'%5B', u'?':
u'%3F',
   u'!':u'%7E'}
-percentunQuoteDict = dict(((j,i) for (i,j) in percentQuoteDict.items
()))
-netscapeHeader= """# HTTP Cookie File
+percentunQuoteDict = dict(((j, i) for (i, j) in percentQuoteDict.items
()))
+netscapeHeader = """# HTTP Cookie File
 # http://www.netscape.com/newsref/std/cookie_spec.html
 # This is a generated file!  Do not edit.\n\n"""
-commentConfig = u"""# default config filename is config.txt in
~/.rssdler
-# lines (like this one) starting with # are comments and
-# will be ignored by the config parser
-# the only required section (though the program won't do much without
others)
-# sections are denoted by a line starting with [
-# then the name of the section, then ending with ]
-# so this is the global section
+commentConfig = u"""# Default config filename is config.txt in
~/.rssdler.
+# Lines (like this one) starting with # are comments and
+# will be ignored by the config parser.
+# The only required section (though the program won't do much without
others).
+# Sections are denoted by a line starting with [, the name of the
section,
+# then ending with ].
+# So this is the global section.
 [global]
-# download files to this directory. Defaults to the working
directory.
+# Download files to this directory.  Defaults to the working
directory.
 downloadDir = /home/user/downloads

-# makes this the 'working directory' of RSSDler. anytime you specify
a filename
+# Makes this the 'working directory' of RSSDler.  Anytime you specify
a filename
 # without an absolute path, it will be relative to this, this s the
default:
 workingDir = /home/user/.rssdler

-# if a file is smaller than this, it will not be downloaded.
-# if filesize cannot be determined, this is ignored.
-# Specified in MB. Remember 1024 MB == 1GB
-# 0 means no minimum, as does "None" (w/o the quotes)
+# If a file is smaller than this, it will not be downloaded.
+# If filesize cannot be determined, this is ignored.
+# Specified in MB.  Remember 1024 MB == 1GB.
+# 0 means no minimum, as does "None" (w/o the quotes).
 minSize = 10

-# if a file is larger than this, it will not be downloaded.  Default
is None
-# though this line is ignored because it starts with a #
+# If a file is larger than this, it will not be downloaded.  Default
is None.
+# Though this line is ignored because it starts with a #.
 # maxSize = None

-# write messages to a log file. 0 is off, 1 is just error messages,
-# 3 tells you when yo download something, 5 is very, very wordy.
(default = 0)
+# Write messages to a log file.  0 is off, 1 is just error messages,
+# 3 tells you when you download something, 5 is very, very wordy.
(default = 0).
 log = 0
-# where to write those log messages (default 'downloads.log')
+# Where to write those log messages (default 'downloads.log').
 logFile = downloads.log

-# like log, only prints to the screen (errors to stderr, other to
stdout)
-# default 3
+# Like log, only prints to the screen (errors to stderr, other to
stdout).
+# Default is 3
 verbose = 3

-# the place where a cookie file can be found. Default None.
+# The place where a cookie file can be found.  Default is None.
 cookieFile = /home/user/.mozilla/firefox/user/cookies.txt

-# type of cookie file to be found at above location. default
MozillaCookieJar
+# Type of cookie file to be found at above location.  Default is
MozillaCookieJar.
 cookieType = MozillaCookieJar
-# other possible types are:
+# Other possible types are:
 # LWPCookieJar, Safari, Firefox3, KDE
-# only works if urllib = False and mechanize is installed
+# Only works if urllib = False and mechanize is installed.
 # cookieType = MSIECookieJar

-#how long to wait between checking feeds (in minutes). Default 15.
+# How long to wait between checking feeds (in minutes).  Default is
15.
 scanMins = 10

-# how long to wait between http requests (in seconds). Default 0
+# How long to wait between http requests (in seconds).  Default is 0.
 sleepTime = 2

-# to exit after scanning all the feeds, or to keep looping. Default
False.
+# To exit after scanning all the feeds, or to keep looping.  Default
is False.
 runOnce = True

-# set to true to avoid having to install mechanize.
-# side effects described in help. Default False.
-# will fallback to a sane value if mechanize is not installed
+# Set to true to avoid having to install mechanize.
+# Side effects described in help.  Default is False.
+# Will fallback to a sane value if mechanize is not installed.
 urllib = True

-# the rest of the global options are described in the help,
-# let's move on to a thread
+# The rest of the global options are described in the help,
+# let's move on to a thread.

 ###################
-# each section represents a feed, except for the one called global.
-# this is the thread: somesite
+# Each section represents a feed, except for the one called global.
+# This is the thread: somesite
 ###################
 [somesite]
-# just link to the feed
+# The link to the feed.
 link = http://somesite.com/rss.xml

-# Default None, defers to maxSize in global, otherwise,
-# files larger than this size (in MB) will not be downloaded
-# only applies to the specific thread
-# if set to 0, means no maximum and overrides global option
+# Default is None, defers to maxSize in global, otherwise,
+# files larger than this size (in MB) will not be downloaded.
+# Only applies to the specific thread.
+# If set to 0, means no maximum and overrides global option.
 maxSize = 2048

-# like maxSize, only file smaller than this will not be downloaded
-# if set to 0, means no minimum, like maxSize. in MB.
+# Like maxSize, only file smaller than this will not be downloaded.
+# If set to 0, means no minimum, like maxSize.  In MB.
 minSize = 10

-# if specified, will download files in this thread to this directory
+# If specified, will download files in this thread to this directory.
 directory = /home/user/someotherfiles

-# if you do not know what regular expressions are, stop now, do not
pass go,
-# do not collect USD200 (CAN195)
-# google "regular expressions tutorial" and find one that suits your
needs
-# one with an emphasis on Python may be to your advantage
+# If you do not know what regular expressions are, stop now, do not
pass go,
+# do not collect USD200 (CAN195).
+# Google "regular expressions tutorial" and find one that suits your
needs.
+# One with an emphasis on Python may be to your advantage.

 # Now, without any of the download<x> or regEx options (detailed
below)
-# every item in the rss feed will be downloaded,
-# provided that it has not previously been downloaded
-# all the regular expression should be specified in lower case
+# every item in the RSS feed will be downloaded,
+# provided that it has not previously been downloaded.
+# All the regular ...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dasnyderx  
View profile  
 More options Nov 18 2009, 3:34 pm
From: dasnyderx <dasnyd...@gmail.com>
Date: Wed, 18 Nov 2009 12:34:24 -0800 (PST)
Local: Wed, Nov 18 2009 3:34 pm
Subject: Re: Proposed code clean-up diff...
Hmmm, it looks like the paste or the submission to the group messed
with the formatting of the patch.  If you'd like a tarball of the
diff, contact me at this address or (better yet) dasnyderx _at_ yahoo
_dot_ com.

Cheers,
David

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Derr  
View profile  
 More options Nov 19 2009, 10:33 am
From: Brian Derr <bder...@gmail.com>
Date: Thu, 19 Nov 2009 07:33:04 -0800
Local: Thurs, Nov 19 2009 10:33 am
Subject: Re: [rssdler] Re: Proposed code clean-up diff...

I haven't looked through the whole thing yet, but thanks for taking a stab
at this. The few pieces that I looked at looked good. The code was
definitely in need of some TLC.

bd

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »