Patchwork [2,of,4] demandimport: insert empty line per method

login
register
mail settings
Submitter Yuya Nishihara
Date May 24, 2017, 3:38 p.m.
Message ID <d9a46f311039ea73791d.1495640315@mimosa>
Download mbox | patch
Permalink /patch/20881/
State Accepted
Headers show

Comments

Yuya Nishihara - May 24, 2017, 3:38 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1493616416 -32400
#      Mon May 01 14:26:56 2017 +0900
# Node ID d9a46f311039ea73791d530d7dae8d05803decaf
# Parent  43dcc4aba63fb8af43758cb9ed89ae19bd95c4fa
demandimport: insert empty line per method

_demandmod class is getting bigger, and I don't want to put more things in
a dense form.

Patch

diff --git a/hgdemandimport/demandimportpy2.py b/hgdemandimport/demandimportpy2.py
--- a/hgdemandimport/demandimportpy2.py
+++ b/hgdemandimport/demandimportpy2.py
@@ -69,6 +69,7 @@  class _demandmod(object):
     Specify 1 as 'level' argument at construction, to import module
     relatively.
     """
+
     def __init__(self, name, globals, locals, level):
         if '.' in name:
             head, rest = name.split('.', 1)
@@ -79,6 +80,7 @@  class _demandmod(object):
         object.__setattr__(self, r"_data",
                            (head, globals, locals, after, level, set()))
         object.__setattr__(self, r"_module", None)
+
     def _extend(self, name):
         """add to the list of submodules to load"""
         self._data[3].append(name)
@@ -144,13 +146,16 @@  class _demandmod(object):
         if self._module:
             return "<proxied module '%s'>" % self._data[0]
         return "<unloaded module '%s'>" % self._data[0]
+
     def __call__(self, *args, **kwargs):
         raise TypeError("%s object is not callable" % repr(self))
+
     def __getattribute__(self, attr):
         if attr in ('_data', '_extend', '_load', '_module', '_addref'):
             return object.__getattribute__(self, attr)
         self._load()
         return getattr(self._module, attr)
+
     def __setattr__(self, attr, val):
         self._load()
         setattr(self._module, attr, val)