From 4cb35068209d03b37e33a16a96fb601eb5bc176b Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 7 Jul 2012 00:16:15 -0400 Subject: [PATCH] Update copyright notice; some additions. --- LICENSE | 2 +- mwparserfromhell/__init__.py | 4 ++-- mwparserfromhell/node.py | 2 +- mwparserfromhell/parameter.py | 2 +- mwparserfromhell/parser.py | 2 +- mwparserfromhell/string_mixin.py | 6 +++--- mwparserfromhell/template.py | 2 +- mwparserfromhell/text.py | 2 +- mwparserfromhell/wikicode.py | 6 +++++- setup.py | 2 +- tests/test_parameter.py | 6 +++--- tests/test_parser.py | 2 +- tests/test_template.py | 2 +- 13 files changed, 22 insertions(+), 18 deletions(-) diff --git a/LICENSE b/LICENSE index f89e1a9..49b719e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2012 by Ben Kurtovic +Copyright (C) 2012 Ben Kurtovic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/mwparserfromhell/__init__.py b/mwparserfromhell/__init__.py index 0ae3ac2..c332e97 100644 --- a/mwparserfromhell/__init__.py +++ b/mwparserfromhell/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -27,7 +27,7 @@ outrageously powerful parser for `MediaWiki `_ wikicode. """ __author__ = "Ben Kurtovic" -__copyright__ = "Copyright (C) 2012 by Ben Kurtovic" +__copyright__ = "Copyright (C) 2012 Ben Kurtovic" __license__ = "MIT License" __version__ = "0.1.dev" __email__ = "ben.kurtovic@verizon.net" diff --git a/mwparserfromhell/node.py b/mwparserfromhell/node.py index b99b2c6..e27652a 100644 --- a/mwparserfromhell/node.py +++ b/mwparserfromhell/node.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/mwparserfromhell/parameter.py b/mwparserfromhell/parameter.py index 948ca6e..6ab0319 100644 --- a/mwparserfromhell/parameter.py +++ b/mwparserfromhell/parameter.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/mwparserfromhell/parser.py b/mwparserfromhell/parser.py index eff4bde..a6d283c 100644 --- a/mwparserfromhell/parser.py +++ b/mwparserfromhell/parser.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/mwparserfromhell/string_mixin.py b/mwparserfromhell/string_mixin.py index 0794733..ba2c7c6 100644 --- a/mwparserfromhell/string_mixin.py +++ b/mwparserfromhell/string_mixin.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -24,10 +24,10 @@ __all__ = ["StringMixIn"] class StringMixIn(object): def __str__(self): - return str(unicode(self)) + return unicode(self).encode("utf8") def __repr__(self): - return repr(unicode(self)) + return repr(unicode(self).encode("utf8")) def __lt__(self, other): if isinstance(other, unicodeingMixin): diff --git a/mwparserfromhell/template.py b/mwparserfromhell/template.py index 110f94b..334a8ab 100644 --- a/mwparserfromhell/template.py +++ b/mwparserfromhell/template.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/mwparserfromhell/text.py b/mwparserfromhell/text.py index a8327ac..a30af76 100644 --- a/mwparserfromhell/text.py +++ b/mwparserfromhell/text.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/mwparserfromhell/wikicode.py b/mwparserfromhell/wikicode.py index 68af8da..bb32216 100644 --- a/mwparserfromhell/wikicode.py +++ b/mwparserfromhell/wikicode.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -182,6 +182,10 @@ class Wikicode(StringMixIn): def filter_text(self, recursive=False, matches=None, flags=FLAGS): return list(self.ifilter_text(recursive, matches, flags)) + def normalize(self): + ## Create a deep copy of self ## + return normalized + def show_tree(self): marker = object() # Random object we can find with certainty in a list print "\n".join(self._show_tree(self, [], marker)) diff --git a/setup.py b/setup.py index bf1365b..7495956 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/test_parameter.py b/tests/test_parameter.py index 46013ac..2d5515b 100644 --- a/tests/test_parameter.py +++ b/tests/test_parameter.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -102,12 +102,12 @@ class TestParameter(unittest.TestCase): # add param # add template left # add template right - + self.assertEquals(param * 3, Parameter(param.name, param.value * 3, param.templates * 3)) self.assertEquals(3 * param, Parameter(param.name, 3 * param.value, 3 * param.templates)) - + # add param inplace # add template implace # add str inplace diff --git a/tests/test_parser.py b/tests/test_parser.py index 66a9a32..0c989b8 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/test_template.py b/tests/test_template.py index ba15e6e..b006033 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012 by Ben Kurtovic +# Copyright (C) 2012 Ben Kurtovic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal