[
https://issues.apache.org/jira/browse/PROTON-2320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17266027#comment-17266027
]
ASF GitHub Bot commented on PROTON-2320:
----------------------------------------
jiridanek commented on a change in pull request #285:
URL: https://github.com/apache/qpid-proton/pull/285#discussion_r558292655
##########
File path: tools/python/mllib/__init__.py
##########
@@ -43,43 +45,47 @@
from . import transforms
from . import parsers
+
def transform(node, *args):
- result = node
- for t in args:
- if isinstance(t, CLASS_TYPES):
- t = t()
- result = result.dispatch(t)
- return result
+ result = node
+ for t in args:
+ if isinstance(t, CLASS_TYPES):
+ t = t()
+ result = result.dispatch(t)
+ return result
+
class Resolver:
- def __init__(self, path):
- self.path = path
+ def __init__(self, path):
+ self.path = path
+
+ def resolveEntity(self, publicId, systemId):
+ for p in self.path:
+ fname = os.path.join(p, systemId)
+ if os.path.exists(fname):
+ source = InputSource(systemId)
+ source.setByteStream(open(fname))
+ return source
+ return InputSource(systemId)
- def resolveEntity(self, publicId, systemId):
- for p in self.path:
- fname = os.path.join(p, systemId)
- if os.path.exists(fname):
- source = InputSource(systemId)
- source.setByteStream(open(fname))
- return source
- return InputSource(systemId)
def xml_parse(filename, path=()):
- if sys.version_info[0:2] == (2,3):
- # XXX: this is for older versions of python
- source = "file://%s" % os.path.abspath(filename)
- else:
- source = filename
- h = parsers.XMLParser()
- p = xml.sax.make_parser()
- p.setContentHandler(h)
- p.setErrorHandler(ErrorHandler())
- p.setEntityResolver(Resolver(path))
- p.parse(source)
- return h.parser.tree
+ if sys.version_info[0:2] == (2, 3):
+ # XXX: this is for older versions of python
+ source = "file://%s" % os.path.abspath(filename)
Review comment:
#288
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Apply autofixes to resolve some flake8 code formatting issues
> -------------------------------------------------------------
>
> Key: PROTON-2320
> URL: https://issues.apache.org/jira/browse/PROTON-2320
> Project: Qpid Proton
> Issue Type: Task
> Components: python-binding
> Affects Versions: proton-c-0.33.0
> Reporter: Jiri Daněk
> Assignee: Jiri Daněk
> Priority: Major
> Fix For: proton-c-0.34.0
>
>
> Python code in Proton does not follow PEP8. There are automated tools which
> can reformat the code to be more compliant (fix indentation, add spaces
> around operators, ...).
> {noformat}
> pip install autopep8
> for f in `find -name "*.py"`; do autopep8 --in-place $f; done
> {noformat}
> Autopep8 has several level of "aggressiveness". The least aggressive setting
> only changes whitespace. At a more aggressive setting, autopep8 will also
> rewrite some code constructs.
> My plan is to commit this in several stages. Avoid mixing manual changes and
> automatically generated changes in a single commit. Push the whitespace
> changes first and only then let autopep8 to be more creative; otherwise the
> rewrites get drowned in the huge initial diff.
> I don't want to add flake8 to CI jobs just yet; I want to wait a few days
> with that.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]