Commits

Takafumi Arakaki committed f27a806

Cleaned up source code

Comments (0)

Files changed (8)

         Make new DictTable filtered by fnmatch given fnmatch patterns
         """
         newdt = DictTable()
+
         def filtered(name):
             return self._gene_dict(
                 self.get_nested_fnmatch(name, key_list, *args, **kwds))
         # use last ASCII character to say deficit value should come at last.
         # maybe i should change this later using the `cmp` function.
         deficit = chr(255)
+
         def key(name):
             vals = []
             for keystr in key_list:
         # use repr(val) because val can be "unhashable type" such as list
         return len(set([repr(val) for val in iterative])) == 1
 
-
-
     @staticmethod
     def _filter_by_re_list(keyiter, include=None, exclude=None):
         """
         from texttable import Texttable
         table = Texttable()
         deco = 0
-        if deco_border: deco |= Texttable.BORDER
-        if deco_header: deco |= Texttable.HEADER
-        if deco_hlines: deco |= Texttable.HLINES
-        if deco_vlines: deco |= Texttable.VLINES
+        if deco_border:
+            deco |= Texttable.BORDER
+        if deco_header:
+            deco |= Texttable.HEADER
+        if deco_hlines:
+            deco |= Texttable.HLINES
+        if deco_vlines:
+            deco |= Texttable.VLINES
         table.set_deco(deco)
 
         sortedkey = sorted(diffdict)
                 yield ([key_cand] + k0, v0)
 
 
-
 def get_nested_fnmatch(dct, dictpath, sep='.'):
     """
     Get a element from nested dictionary

neorg/tests/test_data.py

         assert_eq(dt_desired=dt_desired, dt_filtered=dt_filtered)
 
 
-
 class CheckGridDict(CheckData):
 
     @staticmethod
         for key in product(*gd.axes):
             vals = [v for (k, v) in key_val if k == key]
             assert gd[key] == vals
-            expr  = 'gd[key] == gd[%s]' % ']['.join(map(repr, key))
+            expr = 'gd[key] == gd[%s]' % ']['.join(map(repr, key))
             assert eval(expr, {'gd': gd, 'key': key})
 
 

neorg/tests/test_verutils.py

             assert (
                 NEOrgVersion('{0}.{1}.{2}'.format(i, j, k)) ==
                 NEOrgVersion('{0}.{1}.{2}'.format(i, j, k)))
-            for ijk0 in [(i-1, j, k),
-                         (i, j-1, k),
-                         (i, j, k-1)]:
+            for ijk0 in [(i - 1, j, k),
+                         (i, j - 1, k),
+                         (i, j, k - 1)]:
                 assert (
                     NEOrgVersion('{0}.{1}.{2}'.format(i, j, k)) >
                     NEOrgVersion('{0}.{1}.{2}'.format(*ijk0)))
         assert (
             NEOrgVersion('{0}.{1}.{2}.dev{3}'.format(i, j, k, l)) ==
             NEOrgVersion('{0}.{1}.{2}.dev{3}'.format(i, j, k, l)))
-        for ijkl0 in [(i-1, j, k, l),
-                      (i, j-1, k, l),
-                      (i, j, k-1, l),
-                      (i, j, k, l-1)]:
+        for ijkl0 in [(i - 1, j, k, l),
+                      (i, j - 1, k, l),
+                      (i, j, k - 1, l),
+                      (i, j, k, l - 1)]:
             assert (
                 NEOrgVersion('{0}.{1}.{2}.dev{3}'.format(i, j, k, l)) >
                 NEOrgVersion('{0}.{1}.{2}.dev{3}'.format(*ijkl0)))

neorg/tests/test_web.py

         if b.startswith('/'):
             path = b
         elif path == '' or path.endswith('/'):
-            path +=  b
+            path += b
         else:
             path += '/' + b
     return path
         assert page_html in response.data
         delete_path = urljoin('/', page_path, "_delete")
         assert '<form action="%s"' % delete_path in response.data
-        assert '<input type="submit" name="yes" value="Yes" />' in response.data
+        assert ('<input type="submit" name="yes" value="Yes" />'
+                in response.data)
         assert '<input type="submit" name="no" value="No" />' in response.data
 
     def test_confirm_delete(self):
 
     def check_old(self, page_path, page_text, num_update=5):
         (hist_response, page_text_history,
-         )= self.check_history(page_path, page_text, num_update)
+         ) = self.check_history(page_path, page_text, num_update)
         old_links = re.findall('<a href="(.*_old/[0-9]*)">',
                                hist_response.data)
         assert len(page_text_history) == len(old_links)
         response = self.get_search_response(query)
         assert_raises(AssertionError,
                       self.assert_page_path_in_search_result,
-                      page_path, response)  #no match
+                      page_path, response)  # no match
 
     def test_jump_to_descendants(self):
         page_path = 'TestJumpToDesc/SubPage'
                 "http://localhost/TestJumpToDesc/NoSubPage/_edit")
 
 
-
 class TestNEOrgWebWithEmptyDB(TestNEOrgWebSlow):
 
     def test_system_info(self):

neorg/tests/test_wiki.py

 
     data = [
         ({'args': ['ex/data*/file.pickle'],
-          'data': 'a b',},
+          'data': 'a b'},
          data_file_tree_1,
          []),
         ({'args': ['data*/file.pickle'],
 
     data = [
         ({'args': ['ex/data*/file.pickle'],
-          'data': 'a b',},
+          'data': 'a b'},
          data_file_tree_1,
          []),
         ({'args': ['data*/file.pickle'],
             assert 'link(s)' not in page_html
 
 
-
 class TestGridImages(CheckData):
 
     data_file_tree_1 = dict(
                 "page_html must contains %d of '%s'" % (val, key))
 
 
-
 class TestConvTexts(CheckData):
 
     # texts/*.txt should be converted w/o system error
             flash('No change was found.')
             return redirect(url_for("page", page_path=page_path))
         g.db.execute(
-            'insert or replace into pages (page_path, page_text) values (?, ?)',
+            'insert or replace into pages (page_path, page_text)'
+            ' values (?, ?)',
             [page_path, page_text])
         g.db.execute(
             'insert into page_history (page_path, page_text) values (?, ?)',
         if node.hasattr('sort'):
             data_table.sort_names_by_values(node.get('sort'))
 
-        diff_data =  data_table.diff(include=node.get('include'),
-                                     exclude=node.get('exclude'))
+        diff_data = data_table.diff(include=node.get('include'),
+                                    exclude=node.get('exclude'))
 
         keylist = sorted(diff_data)
         table_header = [''] + keylist
     option_spec.update(_FTYPE_OPTIONS)
     has_content = False
 
-
     def run(self):
         # naming note:
         #     - *_syspath is system path
     option_spec.update(_FTYPE_OPTIONS)
     has_content = False
 
-
     def run(self):
         # naming note:
         #     - *_syspath is system path
         table['classes'].append('neorg-grid-images-outmost')
         return [table]
 
+
 class ListPages(Directive):
     _dirc_name = 'list-pages'
 
         "Programming Language :: Python",
         "Topic :: Scientific/Engineering",
         ],
-    entry_points = {
+    entry_points={
         'console_scripts': ['neorg = neorg.commands:main']},
     command_options={
         'build_sphinx': {  # specify the help document