summaryrefslogtreecommitdiff
path: root/tablib/packages
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-03-02 08:42:53 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2019-03-02 08:42:53 -0800
commitb057cdf05e4b9d20f6e1743fc9c63d32c54f1908 (patch)
tree0028b3683bdf022bb1e0676abdca3588de5c1362 /tablib/packages
parenta10327a2833da8eee952d8b832afc33c3c55b282 (diff)
downloadtablib-b057cdf05e4b9d20f6e1743fc9c63d32c54f1908.tar.gz
Trim trailing white space throughout the project
Many editors clean up trailing white space on save. By removing it all in one go, it helps keep future diffs cleaner by avoiding spurious white space changes on unrelated lines.
Diffstat (limited to 'tablib/packages')
-rw-r--r--tablib/packages/dbfpy3/record.py2
-rw-r--r--tablib/packages/markup3.py36
2 files changed, 19 insertions, 19 deletions
diff --git a/tablib/packages/dbfpy3/record.py b/tablib/packages/dbfpy3/record.py
index 73b6952..d301476 100644
--- a/tablib/packages/dbfpy3/record.py
+++ b/tablib/packages/dbfpy3/record.py
@@ -220,7 +220,7 @@ class DbfRecord(object):
def toString(self):
"""Return string packed record values."""
# for (_def, _dat) in zip(self.dbf.header.fields, self.fieldData):
-#
+#
return "".join([" *"[self.deleted]] + [
_def.encodeValue(_dat)
diff --git a/tablib/packages/markup3.py b/tablib/packages/markup3.py
index 1973c00..a4fc637 100644
--- a/tablib/packages/markup3.py
+++ b/tablib/packages/markup3.py
@@ -33,7 +33,7 @@ class element:
self.tag = tag.lower( )
else:
self.tag = tag.upper( )
-
+
def __call__( self, *args, **kwargs ):
if len( args ) > 1:
raise ArgumentError( self.tag )
@@ -42,14 +42,14 @@ class element:
if self.parent is not None and self.parent.class_ is not None:
if 'class_' not in kwargs:
kwargs['class_'] = self.parent.class_
-
+
if self.parent is None and len( args ) == 1:
x = [ self.render( self.tag, False, myarg, mydict ) for myarg, mydict in _argsdicts( args, kwargs ) ]
return '\n'.join( x )
elif self.parent is None and len( args ) == 0:
x = [ self.render( self.tag, True, myarg, mydict ) for myarg, mydict in _argsdicts( args, kwargs ) ]
return '\n'.join( x )
-
+
if self.tag in self.parent.twotags:
for myarg, mydict in _argsdicts( args, kwargs ):
self.render( self.tag, False, myarg, mydict )
@@ -63,7 +63,7 @@ class element:
raise DeprecationError( self.tag )
else:
raise InvalidElementError( self.tag, self.parent.mode )
-
+
def render( self, tag, single, between, kwargs ):
"""Append the actual tags to content."""
@@ -89,7 +89,7 @@ class element:
self.parent.content.append( out )
else:
return out
-
+
def close( self ):
"""Append a closing tag unless element has only opening tag."""
@@ -128,11 +128,11 @@ class page:
these two keyword arguments may be used to select
the set of valid elements in 'xml' mode
invalid elements will raise appropriate exceptions
-
+
separator -- string to place between added elements, defaults to newline
-
+
class_ -- a class that will be added to every element if defined"""
-
+
valid_onetags = [ "AREA", "BASE", "BR", "COL", "FRAME", "HR", "IMG", "INPUT", "LINK", "META", "PARAM" ]
valid_twotags = [ "A", "ABBR", "ACRONYM", "ADDRESS", "B", "BDO", "BIG", "BLOCKQUOTE", "BODY", "BUTTON",
"CAPTION", "CITE", "CODE", "COLGROUP", "DD", "DEL", "DFN", "DIV", "DL", "DT", "EM", "FIELDSET",
@@ -163,7 +163,7 @@ class page:
self.deptags += list(map( str.lower, self.deptags ))
self.mode = 'strict_html'
elif mode == 'loose_html':
- self.onetags = valid_onetags + deprecated_onetags
+ self.onetags = valid_onetags + deprecated_onetags
self.onetags += list(map( str.lower, self.onetags ))
self.twotags = valid_twotags + deprecated_twotags
self.twotags += list(map( str.lower, self.twotags ))
@@ -187,12 +187,12 @@ class page:
return element( attr, case=self.case, parent=self )
def __str__( self ):
-
+
if self._full and ( self.mode == 'strict_html' or self.mode == 'loose_html' ):
end = [ '</body>', '</html>' ]
else:
end = [ ]
-
+
return self.separator.join( self.header + self.content + self.footer + end )
def __call__( self, escape=False ):
@@ -232,7 +232,7 @@ class page:
lang -- language, usually a two character string, will appear
as <html lang='en'> in html mode (ignored in xml mode)
-
+
css -- Cascading Style Sheet filename as a string or a list of
strings for multiple css files (ignored in xml mode)
@@ -306,7 +306,7 @@ class page:
def css( self, filelist ):
"""This convenience function is only useful for html.
It adds css stylesheet(s) to the document via the <link> element."""
-
+
if isinstance( filelist, str ):
self.link( href=filelist, rel='stylesheet', type='text/css', media='all' )
else:
@@ -339,10 +339,10 @@ class _oneliner:
"""An instance of oneliner returns a string corresponding to one element.
This class can be used to write 'oneliners' that return a string
immediately so there is no need to instantiate the page class."""
-
+
def __init__( self, case='lower' ):
self.case = case
-
+
def __getattr__( self, attr ):
if attr.startswith("__") and attr.endswith("__"):
raise AttributeError(attr)
@@ -353,9 +353,9 @@ upper_oneliner = _oneliner( case='upper' )
def _argsdicts( args, mydict ):
"""A utility generator that pads argument list and dictionary values, will only be called with len( args ) = 0, 1."""
-
+
if len( args ) == 0:
- args = None,
+ args = None,
elif len( args ) == 1:
args = _totuple( args[0] )
else:
@@ -418,7 +418,7 @@ _escape = escape
def unescape( text ):
"""Inverse of escape."""
-
+
if isinstance( text, str ):
if '&amp;' in text:
text = text.replace( '&amp;', '&' )