1. Jonathan Eunice
  2. simplere


Jonathan Eunice  committed e7149b6

Tweaks for PEP8 conformance, version number bump to escape Python installer gotchas.

  • Participants
  • Parent commits 79214f5
  • Branches default

Comments (0)

Files changed (5)

File CHANGES.rst

View file
+  * Cleaned up source for better PEP8 conformance
+  * Bumped version number to 1.0 as part of move to `semantic 
+    versioning <http://semver.org>`_, or at least enough of it so
+    as to not screw up Python installation procedures (which don't
+    seem to understand 0.401 is a lesser version that 0.5, because
+    401 > 5).


View file
+include MANIFEST.in
+include README.rst
+include CHANGES.rst
+include pytest.ini
+include tox.ini
+recursive-include simplere *.py
+recursive-include test *.py

File README.rst

View file
-Python regular expressions are powerful, but the language's lack of an *en passant*
+Python regular expressions are powerful, but the language's
+lack of an *en passant*
 (in passing)
 assignment requires a preparatory
 motion and then a test::
 With ``simplere``, you can do it in fewer steps::
-    from simplere import Re
+    from simplere import *
+    if match / re.search(pattern, some_string):
+        print match[1]
+Or with an object-orented style:
     if some_string in Re(pattern):
         print Re._[1]
-``pattern`` here would typically be a string, but it can also be a pre-existing
-compiled regular expression. ``Re`` objects are `memoized
-<http://en.wikipedia.org/wiki/Memoization>`_ for efficiency, so they so they're
-only compiled once, regardless of how many times they're mentioned in the
+Re Objects
+``Re`` objects are `memoized
+<http://en.wikipedia.org/wiki/Memoization>`_ for efficiency, so they compile their
+pattern just once, regardless of how many times they're mentioned in a
 Note that the ``in`` test turns the sense of the matching around (compared to

File setup.py

View file
-    version='0.4',
+    version='1.0',
     author='Jonathan Eunice',
     description='Simpler, cleaner access to regular expressions. Globs too.',

File simplere/core.py

View file
 also simpler access to globs.
-from mementos import MementoMetaclass, with_metaclass    
-import sys, re, fnmatch
+from mementos import MementoMetaclass, with_metaclass
+import sys
+import re
+import fnmatch
 _PY3 = sys.version_info[0] == 3
 if _PY3:
     basestring = str
 class ReMatch(object):
     An easier-to-use proxy for regular expression match objects. Ideally this
     would be a subclass of the re module's match object, but their type
     change the name of the match group or access the underlying property thus:
     def __init__(self, match=None):
         self._match = match
         self._groupdict = None
         __bool__ = _bool
         __nonzero__ = _bool
     def __getattr__(self, name):
         if self._match is None:
-            raise AttributeError("Empty match has no such attribute '{}'".format(name))
+            raise AttributeError(
+                "Empty match has no such attribute '{}'".format(name))
         if self._groupdict is None:
             self._groupdict = self._match.groupdict()
     def __getitem__(self, index):
         return self._match.group(index)
     def __div__(self, other):
         Define the div (/) operation for en passant usage.
         return self.re.subn(regrouped(repl), string, *args, **kwargs)
     def escape(self, *args, **kwargs):
-        return self.re.escape(*args, **kwargs)
+        return self.re.escape(*args, **kwargs)        
 class Glob(with_metaclass(MementoMetaclass, object)):