Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 150e5ce

Browse files
committed
use config.every rather than config.last for configHandlers
1 parent c994f83 commit 150e5ce

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

java2python/compiler/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def configHandler(self, part, suffix='Handler', default=None):
173173
def configHandlers(self, part, suffix='Handlers'):
174174
""" Returns config handlers for this type of template """
175175
name = '{0}{1}{2}'.format(self.typeName, part, suffix)
176-
return imap(self.toIter, self.config.last(name, ()))
176+
return imap(self.toIter, chain(*self.config.every(name, [])))
177177

178178
def dump(self, fd, level=0):
179179
""" Writes the Python source code for this template to the given file. """

test/configs/Class10.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from java2python.config.default import modulePrologueHandlers
2-
3-
modulePrologueHandlers += [
1+
modulePrologueHandlers = [
42
'from java2python.mod.include.overloading import overloaded',
53
'from abc import ABCMeta, abstractmethod',
64
]

test/configs/Interface1.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from java2python.config.default import modulePrologueHandlers
2-
3-
modulePrologueHandlers += [
1+
modulePrologueHandlers = [
42
"from abc import ABCMeta, abstractmethod",
53
]

test/configs/defaults.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
from java2python.config import default
4-
5-
6-
modulePrologueHandlers = default.modulePrologueHandlers + [
3+
modulePrologueHandlers = [
74
'from java2python.mod.include.classmethod import classmethod_ as classmethod',
85
'from java2python.mod.include.overloading import overloaded',
96
'from abc import ABCMeta, abstractmethod',

0 commit comments

Comments
 (0)