Skip to content

Commit

Permalink
Improving displaying of yregex. Avoiding unecessary imports when cons…
Browse files Browse the repository at this point in the history
…tructing yregex code.
  • Loading branch information
iogf committed Jan 23, 2022
1 parent 33138ae commit 83c9b27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions crocs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def hasop(self, instance):
return True
return False

def iswrapper(self):
return False

def instref(self, argrefs):
count = argrefs.setdefault(self.__class__, 0)
name = '%s%s' % (self.__class__.__name__.lower(), count)
Expand Down Expand Up @@ -92,8 +95,9 @@ def group_imports(self, argrefs):
if ind.__class__ is not type)

for ind in classes:
names = groups.setdefault(ind.__class__.__module__, set())
names.add(ind.__class__.__name__)
if ind.iswrapper() is False:
groups.setdefault(ind.__class__.__module__,
set()).add(ind.__class__.__name__)
return groups

def mkcode(self, argrefs=dict()):
Expand Down Expand Up @@ -169,6 +173,9 @@ def mkregex(self):
def hasop(self, instance):
return False

def iswrapper(self):
return True

def instref(self, argrefs):
count = argrefs.setdefault(self.__class__, 0)
argrefs[self] = "'%s'" % self.args[0]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

from distutils.core import setup
setup(name="crocs",
version="3.2.0",
version="3.2.1",
packages=["crocs", ],
scripts = ['yregex'],
author="Iury O. G. Figueiredo",
Expand Down

0 comments on commit 83c9b27

Please sign in to comment.