Commits

Walter Dörwald committed 374af53

Strip trailing whitespace.

Comments (0)

Files changed (25)

src/ll/__init__.py

 ## http://pages.cpsc.ucalgary.ca/~aycock/spark/
 ##
 ##  Copyright (c) 1998-2002 John Aycock
-##  
+##
 ##  Permission is hereby granted, free of charge, to any person obtaining
 ##  a copy of this software and associated documentation files (the
 ##  "Software"), to deal in the Software without restriction, including
 ##  distribute, sublicense, and/or sell copies of the Software, and to
 ##  permit persons to whom the Software is furnished to do so, subject to
 ##  the following conditions:
-##  
+##
 ##  The above copyright notice and this permission notice shall be
 ##  included in all copies or substantial portions of the Software.
-##  
+##
 ##  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 ##  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 ##  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 		os.dup2(si.fileno(), sys.stdin.fileno())
 		os.dup2(so.fileno(), sys.stdout.fileno())
 		os.dup2(se.fileno(), sys.stderr.fileno())
-	
+
 	def handlesighup(self, signum, frame):
 		"""
 		Handle a ``SIG_HUP`` signal: Reopen standard file descriptors.
 		# Finish up with the current stdout/stderr
 		sys.stdout.flush()
 		sys.stderr.flush()
-	
+
 		# Do first fork
 		try:
 			pid = os.fork()
 				sys.exit(0) # Exit first parent
 		except OSError, exc:
 			sys.exit("{0}: fork #1 failed: ({1}) {2}\n".format(sys.argv[0], exc.errno, exc.strerror))
-	
+
 		# Decouple from parent environment
 		os.chdir("/")
 		os.umask(0)
 		os.setsid()
-	
+
 		# Do second fork
 		try:
 			pid = os.fork()
 				sys.exit(0) # Exit second parent
 		except OSError, exc:
 			sys.exit("{0}: fork #2 failed: ({1}) {2}\n".format(sys.argv[0], exc.errno, exc.strerror))
-	
+
 		# Now I am a daemon!
-	
+
 		# Switch user
 		self.switchuser(self.options.user, self.options.group)
 
 		# Redirect standard file descriptors (will belong to the new user)
 		self.openstreams()
-	
+
 		# Write pid file (will belong to the new user)
 		if self.options.pidfile is not None:
 			open(self.options.pidfile, "wb").write(str(os.getpid()))
 		output = ["arg {0}{1}".format(i, format(arg)) for (i, arg) in enumerate(self.getargs())]
 		for (argname, arg) in self.getkwargs().iteritems():
 			output.append("arg {0}{1}".format(argname, format(arg)))
-			
+
 		if output:
 			output = " with {0}".format(", ".join(output))
 		else:
 			text = "0"
 		else:
 			rest = delta.seconds
-	
+
 			(rest, secs) = divmod(rest, 60)
 			(rest, mins) = divmod(rest, 60)
 			rest += delta.days*24
-	
+
 			secs += delta.microseconds/1000000.
 			if rest:
 				text = "{0:d}:{1:02d}:{2:06.3f}h".format(rest, mins, secs)
 			self.filesread = 0
 			self.byteswritten = 0
 			self.fileswritten = 0
-	
+
 			self.buildno += 1 # increment build number so that actions that stored the old one can detect a new build round
-	
+
 			for target in targets:
 				data = self._get(target, bigcrunch)
 			now = datetime.datetime.utcnow()
-	
+
 			if self.showsummary:
 				args = []
 				self.write(

src/ll/nightshade.py

 def httpdate(dt):
 	"""
 	Return a string suitable for a "Last-Modified" and "Expires" header.
-	
+
 	:var:`dt` is a :class:`datetime.datetime` object. If ``:var:`dt`.tzinfo`` is
 	:const:`None` :var:`dt` is assumed to be in the local timezone (using the
 	current UTC offset which might be different from the one used by :var:`dt`).
 	"""
 	:class:`Connect` objects can be used as decorators that wraps a function
 	that needs a database connection.
-	
+
 	If calling the wrapped function results in a database exception that has
 	been caused by a lost connection to the database or similar problems,
 	the function is retried with a new database connection.
 		:var:`p_encoding` (a string), :var:`p_etag` (a string) and
 		:var:`p_cachecontrol` (a string) are mapped to the appropriate CherryPy
 		response headers. If :var:`p_etag` is not specified a value is calculated.
-	
+
 		If the procedure/function raised a PL/SQL exception with a code between
 		20200 and 20599, 20000 will be substracted from this value and the
 		resulting value will be used as the HTTP response code, i.e. 20404 will

src/ll/orasql/__init__.py

 				if mode == "create" or mode == "flat":
 					for subobj in do(obj):
 						yield subobj
-	
+
 				if not obj.ismview(self):
 					# Primary key
 					if schema == "all":
 					for rec2 in cursor.fetchall():
 						for subobj in do(PrimaryKey(rec2.constraint_name, rec2.owner, self)):
 							yield subobj
-	
+
 					# Comments
 					if schema == "all":
 						cursor.execute("select column_name from all_tab_columns where owner=:owner and table_name=:name order by column_id", owner=rec.owner, name=rec.table_name)
 					decode((select count(*) from all_arguments where owner = nvl(:owner, user) and lower(object_name) = lower(:object_name) and lower(package_name) = lower(:package_name) and argument_name is null), 0, 'procedure', 'function') as object_type
 				from
 					all_procedures
-				where 
+				where
 					lower(procedure_name) = lower(:object_name) and
 					lower(owner) = lower(nvl(:owner, user)) and
 					lower(object_name) = lower(:package_name)
 		yield "name"
 		yield "owner"
 		yield "connection"
-	
+
 		if mode == "detail":
 			yield "cdate()"
 			yield "udate()"
 	def _isroot(self, url):
 		path = url.path
 		return len(path) == 0 or (len(path) == 1 and not path[0])
-		
+
 	def _istype(self, url):
 		path = url.path
 		return len(path) == 1 or (len(path) == 2 and not path[1])
-		
+
 	def isdir(self, url):
 		return self._isroot(url) or self._istype(url)
 

src/ll/orasql/scripts/oradiff.py

 			if "$" in obj.name or obj.name.startswith("SYS_EXPORT_SCHEMA_"):
 				return False
 			return True
-	
+
 		for (i, obj) in enumerate(connection.iterobjects(mode="flat", schema="user")):
 			keepdef = keep(obj)
 			if options.verbose:

src/ll/orasql/scripts/oradrop.py

 	connection = orasql.connect(args[0])
 
 	term = not options.execute
-	
+
 	cs = s4connectstring(connection.connectstring())
 
 	def keep(obj):

src/ll/scripts/ucat.py

 	p.add_option("-v", "--verbose", dest="verbose", help="Be verbose?", action="store_true", default=False)
 	p.add_option("-r", "--recursive", dest="recursive", help="Copy stuff recursively?", action="store_true", default=False)
 	p.add_option("-x", "--ignoreerrors", dest="ignoreerrors", help="Ignore errors?", action="store_true", default=False)
-	
+
 	(options, args) = p.parse_args(args)
 	if len(args) < 1:
 		p.error("need at least one url")

src/ll/scripts/ucp.py

 				if options.verbose:
 					msg = astyle.style_default(astyle.style_url(str(urlwrite)), " (", str(size), " bytes)")
 					stderr.writeln(msg)
-				
+
 
 
 	colors = ("yes", "no", "auto")
 	p.add_option("-g", "--group", dest="group", help="group id or name for target files")
 	p.add_option("-r", "--recursive", dest="recursive", help="Copy stuff recursively?", action="store_true", default=False)
 	p.add_option("-x", "--ignoreerrors", dest="ignoreerrors", help="Ignore errors?", action="store_true", default=False)
-	
+
 	(options, args) = p.parse_args(args)
 	if len(args) < 2:
 		p.error("need at least one source url and one target url")

src/ll/scripts/uls.py

 	p.add_option("-s", "--human-readable-sizes", dest="human", help="Output human readable sizes?", action="store_true")
 	p.add_option("-r", "--recursive", dest="recursive", help="Recursive listing?", action="store_true")
 	p.add_option("-w", "--spacing", dest="spacing", help="Spacing between columns", type="int", default=3)
-	
+
 	(options, args) = p.parse_args(args)
 
 	if options.color == "yes":

src/ll/sisyphus.py

 class Job(object):
 	"""
 	A Job object executes a task once.
-	
+
 	The job announces its presence (and its process id) in a file that is stored
 	in the :dir:`~/run` directory. Logs will be created in the :dir:`~/log`
 	directory (This can be changes by deriving new subclasses).
 #  Copyright (c) 1998-2002 John Aycock
-#  
+#
 #  Permission is hereby granted, free of charge, to any person obtaining
 #  a copy of this software and associated documentation files (the
 #  "Software"), to deal in the Software without restriction, including
 #  distribute, sublicense, and/or sell copies of the Software, and to
 #  permit persons to whom the Software is furnished to do so, subject to
 #  the following conditions:
-#  
+#
 #  The above copyright notice and this permission notice shall be
 #  included in all copies or substantial portions of the Software.
-#  
+#
 #  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 #  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 #  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 	def parse(self, tokens):
 		sets = [ [(1,0), (2,0)] ]
 		self.links = {}
-		
+
 		for i in xrange(len(tokens)):
 			sets.append([])
 
 				htmlspecials.plaintable(
 					toxic.code("""
 						set @i = 1;
-				   
+
 						declare @row_name varchar(100);
 						declare person_cursor cursor for
 							select name from person where name like @search
 					""")
 				)
 			)
-			return e.convert(converter) 
+			return e.convert(converter)
 
 	print toxic.xml2sqs(search().conv().string(encoding"us-ascii")).encode("us-ascii")
 
 
 	``"addlist"``
 		Append the object in register :attr:`r2` to the list in register :attr:`r1`.
-	
+
 	``"adddict"``
 		Add a new entry to the dictionary in register :attr:`r1`. The object in
 		:attr:`r2` is the key and the object in register :attr:`r3` is the value.
-	
+
 	``"updatedict"``
 		Update the dictionary in register :attr:`r1` with the items from the
 		dictionary in :attr:`r2`.
-	
+
 	``"loadvar"``:
 		Load the variable named :attr:`arg` into the register :attr:`r1`.
 
 		:class:`Template` remains uninitialized, otherwise :var:`source` will be
 		compiled (using :var:`startdelim` and :var:`enddelim` as the tag
 		delimiters).
-		
+
 		"""
 		self.startdelim = startdelim
 		self.enddelim = enddelim
 class ForParser(ExprParser):
 	emptyerror = "loop expression required"
 	start = "for"
-	
+
 	@spark.production('for ::= name in expr0')
 	def for0(self, iter, _0, cont):
 		return For(iter.start, cont.end, iter, cont)
 def httpdate(dt):
 	"""
 	Return a string suitable for a "Last-Modified" and "Expires" header.
-	
+
 	:var:`dt` is a :class:`datetime.datetime` object in UTC.
 	"""
 	return "{1}, {0.day:02d} {2:3} {0.year:4} {0.hour:02}:{0.minute:02}:{0.second:02} GMT".format(dt, weekdayname[dt.weekday()], monthname[dt.month])
 		"""
 		Create the directory :var:`url`.
 		"""
-		
+
 	@misc.notimplemented
 	def makedirs(self, url, mode=0777):
 		"""
 				if isdir:
 					for subchild in _walk(base, relchildname, pattern, which):
 						yield subchild
-	
+
 		def walk(filename, pattern=None):
 			return _walk(filename, "", pattern, (True, True))
 
 	"""
 	A :class:`Resource` is a base class that provides a file-like interface
 	to local and remote files, URLs and other resources.
-	
+
 	Attributes
 	----------
 	Each resource object has the following attributes:
 		else:
 			remotepython = None
 			nice = None
-			
+
 		context = getcontext(context)
 		if context is threadlocalcontext.__class__.context:
 			raise ValueError("ssh URLs need a custom context")
 		"""
 		def __get__(self):
 			return self._path.startswith("/")
-	
+
 		def __set__(self, isabs):
 			isabs = bool(isabs)
 			if isabs != self._path.startswith("/"):
 					self._path = "/" + self._path
 				else:
 					self._path = self._path[1:]
-	
+
 		def __delete__(self):
 			if self._path.startswith("/"):
 				self._path = self._path[1:]
 
 		def __set__(self, path):
 			self._setpathorsegments(path)
-	
+
 		def __delete__(self):
 			self.clear()
 
 			if self._segments is None:
 				self._segments = self._path2segments(self._path)
 			return self._segments
-	
+
 		def __set__(self, path):
 			self._setpathorsegments(path)
 
 				return self[-1]
 			except IndexError:
 				return None
-	
+
 		def __set__(self, file):
 			"""
 			Setting the filename preserves the parameter in the last segment.
 				self[-1] = file
 			else:
 				self.segments = [file]
-	
+
 		def __delete__(self):
 			"""
 			Deleting the filename preserves the parameter in the last segment.
 				if pos != -1:
 					ext = segment[pos+1:]
 			return ext
-	
+
 		def __set__(self, ext):
 			if ext is None:
 				del self.ext
 				else:
 					segment = segment + "." + ext
 				self[-1] = segment
-	
+
 		def __delete__(self):
 			segments = self.segments
 			if segments:
 					if self._checkscheme(scheme): # if the scheme is illegal assume there is none (e.g. "/foo.php?x=http://www.bar.com", will *not* have the scheme "/foo.php?x=http")
 						self.scheme = scheme # the info about what we have to expect in the rest of the URL can be found in self.reg now
 						url = url[pos+1:]
-	
+
 				# find the fragment (RFC2396, Section 4.1)
 				if self.reg.usefrag:
 					# the fragment itself may not contain a "#", so find the last "#"
 					if pos != -1:
 						self.frag = _unescape(url[pos+1:])
 						url = url[:pos]
-	
+
 				if self.reg.usehierarchy:
 					# find the query (RFC2396, Section 3.4)
 					pos = url.rfind("?")
 		"""
 		Join :var:`self` with another (possible relative) :class:`URL`
 		:var:`other`, to form a new :class:`URL`.
-		
+
 		:var:`other` may be a :class:`str`, :class:`unicode` or :class:`URL`
 		object. It may be :const:`None` (referring to the "current document")
 		in which case :var:`self` will be returned. It may also be a list or

src/ll/xist/scripts/__init__.py

 ##
 ## All Rights Reserved
 ##
-## See ll/__init__.py for the license
+## See ll/__init__.py for the license

src/ll/xist/scripts/xml2xsc.py

 		node = etree.parse(stream).getroot()
 	else:
 		raise ValueError("unknown parser {0!r}".format(parser))
-	
+
 	return etree2xnd(sims, node)
 
 

test/test_ansistyle.py

 	assert "".join(c.feed("hinz")) == "\033[36mhinz"
 	c.popcolor()
 	assert "".join(c.feed("kunz")) == "\033[0mkunz"
-	
+

test/test_misc.py

 	assert misc.item(e, -11, 42) == 42
 
 	iterable = [17, 23, 37]
-	
+
 	# Wrong arguments
 	py.test.raises(TypeError, misc.item)
 	py.test.raises(TypeError, misc.item, [])

test/test_url_open.py

 					assert u1.group() == group
 					assert u2.owner() == owner
 					assert u2.group() == group
-		
+
 					u2.chown(owner, group)
 					assert u1.owner() == owner
 					assert u1.group() == group

test/test_xist_sims.py

 
 		e = el1()
 		e.bytes()
-	
+
 		e = el1(u"gurk")
 		e.bytes()
 		w = recwarn.pop(sims.EmptyElementWithContentWarning)
-	
+
 		e = el1(php.php(u"gurk"))
 		e.bytes()
 		w = recwarn.pop(sims.EmptyElementWithContentWarning)
-	
+
 		e = el1(xsc.Comment(u"gurk"))
 		e.bytes()
 		w = recwarn.pop(sims.EmptyElementWithContentWarning)
-	
+
 		e = el1(el1())
 		e.bytes()
 		w = recwarn.pop(sims.EmptyElementWithContentWarning)
 			xmlns = "ns2"
 
 		el11.model = sims.Elements(el11, el21)
-	
+
 		e = el11()
 		e.bytes()
-	
+
 		e = el11(u"foo")
 		e.bytes()
 		w = recwarn.pop(sims.IllegalTextWarning)
-	
+
 		e = el11(php.php(u"gurk"))
 		e.bytes()
-	
+
 		e = el11(xsc.Comment(u"gurk"))
 		e.bytes()
-	
+
 		e = el11(el11())
 		e.bytes()
-	
+
 		e = el11(el21())
 		e.bytes()
-	
+
 		e = el11(el12())
 		e.bytes()
 		w = recwarn.pop(sims.WrongElementWarning)
-	
+
 		e = el11(el22())
 		e.bytes()
 		w = recwarn.pop(sims.WrongElementWarning)
 			xmlns = "ns2"
 
 		el11.model = sims.ElementsOrText(el11, el21)
-	
+
 		e = el11()
 		e.bytes()
-	
+
 		e = el11(u"foo")
 		e.bytes()
-	
+
 		e = el11(php.php(u"gurk"))
 		e.bytes()
-	
+
 		e = el11(xsc.Comment(u"gurk"))
 		e.bytes()
-	
+
 		e = el11(el11())
 		e.bytes()
-	
+
 		e = el11(el21())
 		e.bytes()
-	
+
 		e = el11(el12())
 		e.bytes()
 		w = recwarn.pop(sims.WrongElementWarning)
-	
+
 		e = el11(el22())
 		e.bytes()
 		w = recwarn.pop(sims.WrongElementWarning)
 
 		e = el1()
 		e.bytes()
-	
+
 		e = el1(u"foo")
 		e.bytes()
-	
+
 		e = el1(php.php(u"gurk"))
 		e.bytes()
-	
+
 		e = el1(xsc.Comment(u"gurk"))
 		e.bytes()
-	
+
 		e = el1(el1())
 		e.bytes()
 		w = recwarn.pop(sims.ElementWarning)
 
 		e = el1()
 		e.bytes()
-	
+
 		e = el1(u"foo")
 		e.bytes()
 		w = recwarn.pop(sims.IllegalTextWarning)
-	
+
 		e = el1(php.php(u"gurk"))
 		e.bytes()
-	
+
 		e = el1(xsc.Comment(u"gurk"))
 		e.bytes()
-	
+
 		e = el1(el1())
 		e.bytes()
 		w = recwarn.pop(sims.ElementWarning)
-	
+
 		# Elements from a different namespace are OK
 		e = el1(el2())
 		e.bytes()

test/test_xist_toxic.py

 		htmlspecials.plaintable(
 			toxic.code(u"""
 				set @i = 1;
-			   
+
 				declare @row_name varchar(100);
 				declare person_cursor cursor for
 					select name from person where name like @search

test/test_xist_url.py

 	assert node.bytes(base="root:about/us.html") == b'<img src="../images/gurk.gif" />'
 
 
-def test_fancyurl():	
+def test_fancyurl():
 	node = html.a("gurk", href=("http://", jsp.expression("server")))
 	assert node.bytes(base="root:about/us.html") == b'<a href="http://<%= server %>">gurk</a>'
 
 
-def test_replaceurls():	
+def test_replaceurls():
 	node = html.div("gurk", style="background-image: url(gurk.gif);")
 	node.attrs.style.replaceurls(lambda u: url.URL("http://www.example.org")/u)
 	assert str(node.attrs.style) == "background-image: url(http://www.example.org/gurk.gif)"

test/test_xist_xfind.py

 	yield check, [node[0]], u"align", u"ri", u"ef"
 	yield check, [], u"align", u"ri", u"en"
 	yield check, [], u"align", u"x"
-	yield check, [], u"gurk", u"", 
+	yield check, [], u"gurk", u"",
 
 
 def test_attrstartswith():

test/test_xml_codec.py

 		result = (u"", u"", u"", u"", u"", u"", u"", u"\u1234", u"", u"", u"", u"a")
 		check_partial(decoder, u"\u1234a".encode("utf-32"), *result)
 		decoder.reset()
-	
+
 		# Fake utf-32 stored big endian
 		check_partial(decoder, u"\ufeff\u1234a".encode("utf-32-be"), *result)
 		decoder.reset()
-	
+
 		# Fake utf-32 stored little endian
 		check_partial(decoder, u"\ufeff\u1234a".encode("utf-32-le"), *result)
 		decoder.reset()
 
 	# No recursion
 	py.test.raises(ValueError, u"<?xml version='1.0' encoding='xml'?><gurk/>".encode, "xml")
-	
+