Ejemplo n.º 1
0
    def test_code_style_src(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2:
            warnings.warn(
                "skipping test_code_style because of Python 2 or " + sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
        check_pep8(src_, fLOG=fLOG, extended=[("fLOG", _extended_refactoring)],
                   pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                                  'W0231', 'W0212', 'C0111', 'W0107'),
                   skip=["Redefining built-in 'iter'",
                         "iter_rows.py:340",
                         "translation_class.py",
                         "translation_to_python.py:118",
                         "translation_to_python.py:185",
                         "translation_to_python.py:244",
                         "node_visitor_translator.py:74: E1111",
                         "R1720",
                         ]
                   )
Ejemplo n.º 2
0
    def test_flake8_test(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2 or "Anaconda" in sys.executable \
                or "condavir" in sys.executable:
            warnings.warn("skipping test_flake8 because of Python 2 or " +
                          sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        test = os.path.normpath(os.path.join(
            thi,
            "..",
        ))
        check_pep8(test,
                   fLOG=fLOG,
                   neg_filter="temp_.*",
                   skip=[
                       "src' imported but unused",
                       "skip_' imported but unused",
                       "skip__' imported but unused",
                       "skip___' imported but unused",
                   ],
                   extended=[("fLOG", _extended_refactoring)],
                   max_line_length=320)
Ejemplo n.º 3
0
 def test_style_test(self):
     fLOG(__file__,
          self._testMethodName,
          OutputPrint=__name__ == "__main__")
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(
         thi,
         "..",
     ))
     check_pep8(test,
                fLOG=fLOG,
                neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'C0111', 'W0703'),
                skip=[
                    "src' imported but unused",
                    "skip_' imported but unused",
                    "skip__' imported but unused",
                    "skip___' imported but unused",
                    "Unused variable 'skip_'",
                    "imported as skip_",
                    "Unused import src",
                    "Unused import clr",
                    "Unable to import 'CSharPyMLExtension'",
                    "Unable to import 'System'",
                    "Module 'clr' has no 'AddReference' member",
                    "Unable to import 'System.Collections.Generic'",
                    "Instance of 'tuple' has no 'target' member",
                    "Instance of 'tuple' has no 'data' member",
                    'if __name__ == "__main__":',
                ])
Ejemplo n.º 4
0
def _private_test_style_test(fLOG,
                             run_lint,
                             verbose=False,
                             pattern=".*[.]py$"):
    thi = os.path.abspath(os.path.dirname(__file__))
    test_ = os.path.normpath(os.path.join(thi, "..", "..", '_unittests'))
    check_pep8(test_,
               fLOG=fLOG,
               neg_pattern="(temp_.*)|(.*test_parse_code.*[.]py)",
               verbose=verbose,
               pattern=pattern,
               run_lint=run_lint,
               pylint_ignore=(
                   'C0103',
                   'C1801',
                   'R0201',
                   'R1705',
                   'W0108',
                   'W0613',
                   'C0111',
                   'W0622',
                   'W0612',
                   'C0412',
                   'W0621',
                   'W0125',
                   'E1127',
                   'E1101',
                   'W1402',
                   'W0212',
               ),
               skip=[])
Ejemplo n.º 5
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_, fLOG=fLOG, run_cmd_filter=_run_cmd_filter,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'R0911', 'W0201', 'W070', 'W0622', 'R1702',
                               'C0111', 'W0703', 'C0200'),
                neg_pattern='.*MokadiGrammar_((frParser)|(frListener)|(frLexer))[.]py$',
                skip=["Unable to import 'ensae_teaching_cs.pythonnet'",
                      "treant_wrapper.py:38: W0603",
                      "No name 'imwrite' in module 'cv2'",
                      "No name 'VideoCapture' in module 'cv2'",
                      "pydata2016.py:77: W0612",
                      "mokadi_mails.py:42: W0612",
                      "Unable to import 'pymmails.grabber'",
                      "mokadi_action_slides.py:84: W0612",
                      "gui_mokadi_process.py:13: W0612",
                      "Redefining name 'fLOG' from outer scope",
                      "Access to member 'thread_listen' before its definition",
                      "Instance of 'Exception' has no 'strerror'",
                      "Instance of 'Exception' has no 'errno'",
                      "gui_mokadi.py:129",
                      "gui_mokadi.py:78: W0612",
                      "Unused variable 'ensae_teaching_cs'",
                      "Unable to import 'ensae_teaching_cs'",
                      "Unable to import 'pygame'",
                      "Unable to import 'pygame.camera'",
                      "Unable to import 'cv2'",
                      "Unable to import 'keyring'",
                      "Unable to import 'pyaudio'",
                      ])
Ejemplo n.º 6
0
 def check_pep8_error_file():
     check_pep8(this, fLOG=fLOG, recursive=False,
                pylint_ignore=('C0111', 'R0201', 'C0103'),
                pattern="test_check_pep8_sample.py",
                neg_pattern="##",
                skip=["test_check_pep8_sample.py:15",
                      "test_check_pep8_sample.py:18"])
Ejemplo n.º 7
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R1705', 'W0108', 'W0613',
                               'R1702', 'W0212', 'W0201', 'C0415', 'C0209',
                               'R1736'),
                skip=[
                    "Redefining built-in 'iter'",
                    "data_jcdecaux.py:597: W0612",
                    "data_jcdecaux.py:465: W0612",
                    "data_jcdecaux.py:457: W0612",
                    "data_jcdecaux.py:457: W0612",
                    "data_jcdecaux.py:435: W0612",
                    "data_jcdecaux.py:435: W0612",
                    "data_jcdecaux.py:302: W0123",
                    "linkedin_access.py:302: E1123",
                    "linkedin_access.py:302: E1123",
                    "linkedin_access.py:302: E1123",
                    "linkedin_access.py:155: R1710",
                    "linkedin_access.py:239: E1101",
                    "linkedin_access.py:236: E1101",
                    "linkedin_access.py:214: E1101",
                    "linkedin_access.py:260: E1101",
                ])
Ejemplo n.º 8
0
 def test_style_test_faq(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=print, neg_pattern="temp_.*",
                pattern=".*faq.*[.]py$",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'C0412', 'C0411', 'C0414',
                               'C0415'),
                skip=["src' imported but unused",
                      "skip_' imported but unused",
                      "skip__' imported but unused",
                      "skip___' imported but unused",
                      "Unused variable 'skip_'",
                      "imported as skip_",
                      "Redefining built-in 'input'",
                      "Non-iterable value prange",
                      "E1101: Module 'torch' has no ",
                      "E1101: Class 'mem_flags' has no ",
                      "W0221: Parameters differ from overridden 'forward'",
                      "E0401: Unable to import 'pycuda",
                      "E0401: Unable to import 'pyopencl'",
                      "E0401: Unable to import 'torch'",
                      "E1101: Instance of 'Variable' has no 'data' member",
                      "E0401: Unable to import 'keras",
                      ])
Ejemplo n.º 9
0
 def test_style_src(self):
     fLOG(__file__,
          self._testMethodName,
          OutputPrint=__name__ == "__main__")
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(
         src_,
         fLOG=fLOG,
         pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                        'W0613', 'C011111'),
         skip=[
             "Unable to import 'CSharPyExtension'",
             "Unable to import 'System'",
             "Module 'clr' has no 'AddReference' member",
             "Unable to import 'System.Collections.Generic'",
             "Unable to import 'DynamicCS'",
             "No name 'AddReference' in module 'clr'",
             "csmagics.py:113: W0703",
             "add_reference.py:14: W0703",
             "No name 'version_c' in module 'src.csharpyml.cparts.cmodule'",
             "Unable to import 'CSharPyMLExtension'",
             'W0212: Access to a protected member _obj',
             'add_reference.py:21: W0703',
             "Unable to import 'src.csharpyml.cparts.cmodule'",
         ])
Ejemplo n.º 10
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'C0111', 'W0201', 'W0212', 'E0203',
                               'W0107', 'C0415', 'R1730', 'R1731'),
                skip=[
                    "Too many nested blocks",
                    "Module 'numpy.random' has no 'RandomState' member",
                    "Value 'sch' is unsubscriptable",
                    "Instance of 'tuple' has no ",
                    "Instance of '_Stat' has no 'next_nodes' member",
                    "completion.py:125: W0612",
                    "Parameters differ from overridden '",
                    "do not assign a lambda expression, use a def",
                    "Module 'matplotlib.cm' has no 'rainbow' member",
                    "Value 'self.label' is unsubscriptable",
                    "Unused variable 'count_edge_left'",
                    "Unused variable 'k' ",
                    "Redefining built-in 'format'",
                    "poulet.py:146: C0200",
                    "Unable to import 'pygame'",
                ])
Ejemplo n.º 11
0
def _private_test_style_src(fLOG, run_lint, verbose=False, pattern=".*[.]py$"):
    thi = os.path.abspath(os.path.dirname(__file__))
    src_ = os.path.normpath(os.path.join(thi, ".."))
    check_pep8(
        src_,
        fLOG=fLOG,
        neg_pattern='.*((Parser)|(Lexer)|(Listener)|(antlr_grammar_use))[.]py$',
        verbose=verbose,
        pattern=pattern,
        run_lint=run_lint,
        pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                       'C0111', 'W0622', 'W0612', 'C0412', 'W0621', 'W0212',
                       'R1704', 'W0622', 'W0201', 'R1710', 'W0703', 'R1703',
                       'R0911', 'R0912', 'R0915', 'E0203', 'C0302', 'C0200',
                       'R1702', 'E1101', 'R0914', 'W0123', 'W0123', 'W0107'),
        skip=[
            "http_retrieve.py:191: W0703",
            "astock.py:135: W0703",
            "astock.py:229: W0703",
            "http_retrieve.py:192: W0703",
            "Class 'DatabaseCore' has no 'SCRIPT_LOOKUP'",
            "sql_interface.py:18: W0231",
            "file_text_binary.py:680: W0102",
            "sql_interface_database.py:20: W0231",
            "table_formula.py:108: W0631",
            "R0401: Cyclic import (src.pyensae.sql.sql_interface",
            "database_core2.py:230: R1714",
        ])
Ejemplo n.º 12
0
    def test_flake8_test(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2 or "Anaconda" in sys.executable \
                or "condavir" in sys.executable:
            warnings.warn(
                "skipping test_flake8 because of Python 2 or " + sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        test = os.path.normpath(os.path.join(thi, "..", ))
        check_pep8(test, fLOG=fLOG, neg_filter="temp_.*",
                   skip=["src' imported but unused",
                         "skip_' imported but unused",
                         "skip__' imported but unused",
                         "skip___' imported but unused",
                         "skip____' imported but unused",
                         "skip_____' imported but unused",
                         "skip______' imported but unused",
                         "skip_______' imported but unused",
                         ],
                   extended=[("fLOG", _extended_refactoring)],
                   max_line_length=320)
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111'),
                skip=[])
Ejemplo n.º 14
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=fLOG, neg_pattern="((temp_.*)|(.*test_videodl_noenv4_face.*))",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0212', 'W0622', 'W0107',
                               'C0415'),
                skip=[])
Ejemplo n.º 15
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'E1101', 'W0201', 'W0107', 'C0415',
                               'R1725', 'W0707', 'R1732'))
Ejemplo n.º 16
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0107'),
                skip=["Unable to import 'keyring'",
                      ])
Ejemplo n.º 17
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'W0223', 'W1202', "W0221", 'W0107',
                               'C0415'),
                skip=["Instance of 'Database' has no 'isMSSQL' member"])
Ejemplo n.º 18
0
    def test_style_test(self):
        thi = os.path.abspath(os.path.dirname(__file__))
        test = os.path.normpath(os.path.join(
            thi,
            "..",
        ))
        skip = [
            "src' imported but unused",
            "skip_' imported but unused",
            "skip__' imported but unused",
            "skip___' imported but unused",
            "Unused variable 'skip_'",
            "imported as skip_",
            "Unused import src",
            "Module 'pygame' has no 'init' member",
            "Module 'pygame' has no 'NOFRAME' member",
            "Class 'mem_flags' has no ",
            "Module 'torch' has no ",
            "Module 'numpy.random' has no 'RandomState' ",
            "Unable to import 'onemod' ",
            "Redefining built-in 'filter' ",
            "Redefining built-in 'input'",
            "Unused variable 'n'",
            "Redefining name 'path' from outer scope",
            "Unused variable 'i'",
            "Unable to import 'System",
            "Module 'src.ensae_teaching_cs.pythonnet.",
            "Unused variable 'skip___'",
            "Module 'pygame' has no 'quit'",
            "Unable to import 'primes'",
            "Parameters differ from overridden 'forward' method",
            "test_data_competition.py:3",
            "test_data_competition.py:1",
            "Redefining name 'src' from outer scope",
            "Unable to import 'pycuda.",
            "Unable to import 'pyopencl'",
            "Unused import clr",
            "Unused variable 'clr'",
            "Unable to import 'clr'",
            "Module 'clr' has no 'AddReference' member",
            "test_SKIP_torch.py:67: E1123",
            "test_SKIP_torch.py:102: E1101",
            "test_SKIP_torch.py:104: E1101",
        ]

        if is_travis_or_appveyor() == "appveyor":
            skip.extend(["Unable to import 'fairtest'"])

        check_pep8(
            test,
            fLOG=fLOG,
            neg_pattern="temp_.*",
            skip=skip,
            # run_cmd_filter=self.run_cmd_filter,
            pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                           'W0613', 'C0111', 'C0200', 'C0122', "W0123",
                           'W0703', 'W0212', 'W0201', 'R1711', 'R1714'))
Ejemplo n.º 19
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(
         thi,
         "..",
     ))
     check_pep8(test,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'C0111'),
                skip=[])
Ejemplo n.º 20
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "onnxcustom"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R1705', 'W0108', 'W0613',
                               'C3001', 'W0201', 'W0221', 'E0632', 'R1702',
                               'W0212', 'W0223', 'W0107', "R1720", 'R1732',
                               'C0209', 'C0302'),
                skip=[])
Ejemplo n.º 21
0
    def test_flake8_src(self):
        fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2 or "Anaconda" in sys.executable or "condavir" in sys.executable:
            warnings.warn("skipping test_flake8 because of Python 2 or " + sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
        check_pep8(src_, fLOG=fLOG, extended=[("fLOG", _extended_refactoring)])
Ejemplo n.º 22
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_, fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0703', 'W0223', 'W0107'),
                skip=["Redefining built-in 'filter'",
                      "geocoding.py:174: E0702",
                      "elections.py:298: W0603",
                      ])
Ejemplo n.º 23
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0107', 'C0415'),
                skip=["Instance of 'tuple' has no ",
                      "R1720",
                      "R0914",
                      ])
Ejemplo n.º 24
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "wrapclib"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'W0212'),
                skip=[
                    "gitsrc/re2", "gitsrc\\re", "gitsrc/benchlog",
                    "gitsrc\\benchlog"
                ])
Ejemplo n.º 25
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0212', 'W0212', 'W0107', 'C0415'),
                skip=["Module 'pygame' has no 'init' member",
                      "Module 'pygame' has no 'MOUSEBUTTONUP' member",
                      "test_graph_distance.py:122: W0612",
                      "Instance of 'tuple' has no '",
                      "Unable to import 'pygame'",
                      ])
Ejemplo n.º 26
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "mlinsights"))
     check_pep8(src_, fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'W0201', 'W0221', 'E0632', 'R1702', 'W0212', 'W0223',
                               'W0107', "R1720"),
                skip=["categories_to_integers.py:174: W0640",
                      "E0401: Unable to import 'mlinsights.mlmodel.piecewise_tree_regression_criterion",
                      "setup.py:",
                      "[E731]",
                      ])
Ejemplo n.º 27
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*", run_cmd_filter=_run_cmd_filter,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0703', 'C0122', 'W0101', 'R1707', 'C0330',
                               'W0611'),
                skip=["Unable to import 'ensae_teaching_cs.pythonnet'",
                      "Redefining name 'path' from outer scope",
                      "Unable to import 'keyring'",
                      "W0143: Comparing against a callable",
                      ])
Ejemplo n.º 28
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0107', 'C0111', 'R1702', 'C0415', "R1720"),
                skip=["Instance of 'tuple' has no",
                      "[E402] module level import",
                      "E0611: No name '_test_criterion_",
                      "E0611: No name 'SimpleRegressorCriterion'",
                      "E0611: No name 'piecewise_tree_",
                      ])
Ejemplo n.º 29
0
    def test_style_test(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        thi = os.path.abspath(os.path.dirname(__file__))
        test = os.path.normpath(os.path.join(thi, "..", ))
        skip = ["src' imported but unused",
                "skip_' imported but unused",
                "skip__' imported but unused",
                "skip___' imported but unused",
                "Unused variable 'skip_'",
                "imported as skip_",
                "Module 'pygame' has no 'init' member",
                "Module 'pygame' has no 'NOFRAME' member",
                "Class 'mem_flags' has no ",
                "Module 'torch' has no ",
                "Module 'numpy.random' has no 'RandomState' ",
                "Unable to import 'onemod' ",
                "Redefining built-in 'filter' ",
                "Redefining built-in 'input'",
                "Unused variable 'n'",
                "Redefining name 'path' from outer scope",
                "Unused variable 'i'",
                "Unable to import 'System",
                "Module 'ensae_teaching_cs.pythonnet.",
                "Unused variable 'skip___'",
                "Module 'pygame' has no 'quit'",
                "Unable to import 'primes'",
                "Parameters differ from overridden 'forward' method",
                "test_data_competition.py:3",
                "test_data_competition.py:1",
                "Redefining name 'src' from outer scope",
                "Unable to import 'pycuda.",
                "Unable to import 'pyopencl'",
                "Unused import clr",
                "Unused variable 'clr'",
                "Unable to import 'clr'",
                "Module 'clr' has no 'AddReference' member",
                "test_SKIP_torch.py:67: E1123",
                "test_SKIP_torch.py:102: E1101",
                "test_SKIP_torch.py:104: E1101",
                "R1720",
                ]

        if is_travis_or_appveyor() == "appveyor":
            skip.extend(["Unable to import 'fairtest'"])

        check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*", skip=skip,
                   verbose=False, run_cmd_filter=_run_cmd_filter,
                   pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                                  'C0111', 'C0200', 'C0122', "W0123", 'W0703',
                                  'W0212', 'W0201', 'R1711', 'R1714', 'W0107'))
Ejemplo n.º 30
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(
         thi,
         "..",
     ))
     check_pep8(test,
                fLOG=fLOG,
                neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R1705', 'W0108', 'W0613',
                               'C3001', 'C0111', 'W0107', 'C0111', 'R1702',
                               'C0415', "R1720", 'R1732', 'C0209', 'C0302'),
                skip=[])
Ejemplo n.º 31
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(
         os.path.join(thi, "..", "..", "pandas_streaming"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'W0212', 'W0703', 'W0107'),
                skip=[
                    "Too many nested blocks",
                    "Module 'numpy.random' has no 'RandomState' member",
                    "dataframe_split.py:60: [E731]",
                ])
Ejemplo n.º 32
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(
         thi,
         "..",
     ))
     check_pep8(test,
                fLOG=fLOG,
                neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0703', 'C0415', 'C0209', 'R1736'),
                skip=[
                    "Redefining built-in 'iter'",
                ])
Ejemplo n.º 33
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "mlprodict"))
     check_pep8(src_, fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'R1702', 'W0212', 'W0640', 'W0223', 'W0201',
                               'W0622', 'C0123', 'W0107'),
                skip=["Instance of 'tuple' has no ",
                      "do not compare types, use 'isinstance()'",
                      "Instance of 'AutoAction' has no 'children' member",
                      "gactions.py:225: R1711",
                      "gactions.py:238: E1128",
                      "R1720",
                      ])
Ejemplo n.º 34
0
    def test_flake8_src(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2 or "Anaconda" in sys.executable \
                or "condavir" in sys.executable:
            warnings.warn("skipping test_flake8 because of Python 2 or " +
                          sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
        check_pep8(src_, fLOG=fLOG, extended=[("fLOG", _extended_refactoring)])
Ejemplo n.º 35
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'C0111', 'W0223', 'W0201', 'W0212',
                               'C0415'),
                skip=[
                    "Parameters differ from overridden 'fit' method",
                    "Module 'numpy.random' has no 'RandomState' member",
                    "Instance of 'SkLearnParameters' has no '",
                    " in module 'sklearn.cluster._k_means'",
                    "Instance of 'Struct' has no '",
                ])
Ejemplo n.º 36
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_,
                fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108',
                               'W0613', 'W0212', 'W0703'),
                skip=[
                    "Too many nested blocks",
                    "Module 'numpy.random' has no 'RandomState' member",
                    "Value 'sch' is unsubscriptable",
                    "dataframe_io_helpers.py:133: E1137",
                    "dataframe_io_helpers.py:151: E1137",
                    "dataframe_io_helpers.py:157: E1137",
                    "dataframe_split.py:60: [E731]",
                ])
Ejemplo n.º 37
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_, fLOG=print,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'C0412', 'C0411', 'C0414', 'C0415'),
                skip=["Non-iterable value prange",
                      "E1101: Module 'torch' has no ",
                      "E1101: Class 'mem_flags' has no ",
                      "W0221: Parameters differ from overridden 'forward'",
                      "E0401: Unable to import 'pycuda",
                      "E0401: Unable to import 'pyopencl'",
                      "E0401: Unable to import 'torch'",
                      "E1101: Instance of 'Variable' has no 'data' member",
                      "E0401: Unable to import 'keras",
                      ])
Ejemplo n.º 38
0
    def test_flake8_src(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2 or "Anaconda" in sys.executable \
                or "condavir" in sys.executable:
            warnings.warn(
                "skipping test_flake8 because of Python 2 or " + sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
        check_pep8(src_, fLOG=fLOG, extended=[("fLOG", _extended_refactoring)],
                   ignore=('E501', 'E265', 'E731'),
                   skip=["skip_' imported but unused"],
                   neg_filter="((.*pandas_helper.*)|(.*faq_python.*)|(.*send_feedback.*)|(.*python_exemple_py_to_html.*))")
Ejemplo n.º 39
0
 def test_style_test(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     test = os.path.normpath(os.path.join(thi, "..", ))
     check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0212', 'W0212', 'W0107'),
                skip=["src' imported but unused",
                      "skip_' imported but unused",
                      "skip__' imported but unused",
                      "skip___' imported but unused",
                      "Unused variable 'skip_'",
                      "imported as skip_",
                      "Module 'pygame' has no 'init' member",
                      "Module 'pygame' has no 'MOUSEBUTTONUP' member",
                      "test_graph_distance.py:122: W0612",
                      "Instance of 'tuple' has no '",
                      "Unable to import 'pygame'",
                      "Unused import src",
                      ])
Ejemplo n.º 40
0
    def test_code_style_test(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2:
            warnings.warn(
                "skipping test_code_style because of Python 2 or " + sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        test = os.path.normpath(os.path.join(thi, "..", ))
        check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
                   pylint_ignore=('C0111', 'C0103', 'W0622', 'C1801', 'C0412',
                                  'R0201', 'W0122', 'W0123', 'E1101', 'R1705',
                                  'W0107', 'R1720'),
                   skip=[],
                   extended=[("fLOG", _extended_refactoring)])
Ejemplo n.º 41
0
    def test_code_style_src(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        if sys.version_info[0] == 2:
            warnings.warn(
                "skipping test_code_style because of Python 2 or " + sys.executable)
            return

        thi = os.path.abspath(os.path.dirname(__file__))
        src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
        check_pep8(src_, fLOG=fLOG, extended=[("fLOG", _extended_refactoring)],
                   pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                                  'W0231', 'W0212', 'C0111', 'W0122', 'W0223',
                                  'R1703', 'C0412', 'W0105', 'W0703', 'W0201',
                                  'W0107'),
                   skip=["Unable to import 'pyrsslocal'",
                         ],
                   )
Ejemplo n.º 42
0
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
     check_pep8(src_, fLOG=fLOG,
                pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                               'C0111', 'W0201', 'W0212', 'E0203', 'W0107'),
                skip=["Too many nested blocks",
                      "Module 'numpy.random' has no 'RandomState' member",
                      "Value 'sch' is unsubscriptable",
                      "Instance of 'tuple' has no ",
                      "Instance of '_Stat' has no 'next_nodes' member",
                      "completion.py:125: W0612",
                      "Parameters differ from overridden '",
                      "do not assign a lambda expression, use a def",
                      "Module 'matplotlib.cm' has no 'rainbow' member",
                      "Value 'self.label' is unsubscriptable",
                      "Unused variable 'count_edge_left'",
                      "Unused variable 'k' ",
                      "Redefining built-in 'format'",
                      "poulet.py:146: C0200",
                      "Unable to import 'pygame'",
                      ])
    def test_unused_variable(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        this = os.path.abspath(os.path.dirname(__file__))

        def check_pep8_one_file():
            check_pep8(this, fLOG=fLOG, max_line_length=150, recursive=False,
                       neg_pattern="##",
                       pattern="test_check_pep8_sample.py")

        def check_pep8_error_file():
            check_pep8(this, fLOG=fLOG, recursive=False,
                       pylint_ignore=('C0111', 'R0201', 'C0103'),
                       pattern="test_check_pep8_sample.py",
                       neg_pattern="##",
                       skip=["test_check_pep8_sample.py:15",
                             "test_check_pep8_sample.py:18"])

        self.assertRaise(check_pep8_one_file, PEP8Exception,
                         "line too long (165 > 150 characters)")
        self.assertRaise(check_pep8_one_file, PEP8Exception,
                         "F[ECL1] line too long (link) 169 > 150")

        check_pep8(this, fLOG=fLOG, max_line_length=170, recursive=False,
                   pylint_ignore=('C0111', 'R0201', 'C0103'),
                   pattern="test_check_pep8_sample.py",
                   neg_pattern="##",
                   skip=["test_check_pep8_sample.py:373: [E731]",
                         "test_check_pep8_sample.py:36",
                         "test_check_pep8_sample.py:39",
                         "test_check_pep8_sample.py:11",
                         "test_check_pep8_sample.py:40: E0602",
                         "test_check_pep8_sample.py:40: W0104",
                         "test_check_pep8_sample.py:37: W0612",
                         ])
 def test_style_src(self):
     thi = os.path.abspath(os.path.dirname(__file__))
     src_ = os.path.normpath(os.path.join(
         thi, "..", "..", "python3_module_template"))
     check_pep8(src_,
                skip=["myexampleb.py:61: C0123", "myexampleb.py:59: C0123"])
 def check_pep8_one_file():
     check_pep8(this, fLOG=fLOG, max_line_length=150, recursive=False,
                neg_pattern="##",
                pattern="test_check_pep8_sample.py")
Ejemplo n.º 46
0
    def test_style_src(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        thi = os.path.abspath(os.path.dirname(__file__))
        src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))

        skip = ["do not assign a lambda expression, use a def",
                "too many leading '#' for block comment",
                "line too long (480 > 143",
                "Redefining name 'fLOG' from outer scope",
                "Unable to import 'System",
                "parallel_thread.py:39: R1710",
                "dice.py:51: W0612",
                "dice.py:47: W0612",
                "Redefining built-in 'format'",
                "Unused variable 'variance_a_eviter'",
                "Attribute 'objets' defined outside __init__",
                "Attribute 'sources' defined outside __init__",
                "Redefining built-in 'round'",
                "Redefining built-in 'iter'",
                "Unable to import 'ENSAE.",
                "Instance of '_TableFormulaStat' has no ",
                "Line too long (480/143)",
                "Unable to import 'MagicJupyter' (pylint)",
                "Unused variable 'n'",
                "Unused variable 'i'",
                "bad operand type for unary -: matrix",
                "No name 'AddReference' in module 'clr'",
                "Instance of 'TableFormula' has no 'table' member",
                "Unexpected keyword argument 'sheet' in function call",
                "Redefining built-in 'filter'",
                "Unused variable 'a'",
                "No name 'resize' in module 'cv2'",
                "No name 'imread' in module 'cv2'",
                "No name 'VideoWriter_fourcc' in module 'cv2'",
                "No name 'VideoWriter' in module 'cv2'",
                "'pygame' has no 'error' member",
                "'pygame' has no 'init' member",
                "Module 'matplotlib.cm' has no 'rainbow' member",
                "Redefining built-in 'input'",
                "Unused variable 'vt'",
                "Value 'lastrow' is unsubscriptable",
                "tsp_bresenham.py:9: R1710",
                "Redefining built-in 'next'",
                "Attribute '__dict__' defined outside __init__",
                "Instance of 'Rule' has no 'clauses' member",
                "Instance of 'LatexCode' has no 'replace' member",
                "filename_helper.py:68: E1136",
                "send_feedback.py:287: W0640",
                "send_feedback.py:286: W0640",
                "send_feedback.py:135: W0640",
                "send_feedback.py:135: W0631",
                "send_feedback.py:26",
                "projects_helper.py:16: W0102",
                "mail_helper.py:79: W0102",
                "jenkins_helper.py:142: W0102",
                "pandas_helper.py:8: W0611",
                "pandas_helper.py:7: W0611",
                "table_formula.py:2702: W0612",
                "ftp_publish_helper.py:246: E0401",
                "ftp_publish_helper.py:138: E0401",
                "Unable to import 'pycuda",
                "Unable to import 'pyopencl'",
                "Unable to import 'selenium",
                "Unable to import 'ensae_teaching_cs.td_1a.flask_helper'",
                "Unused import clr",
                "Module 'clr' has no 'AddReference' member",
                "Unable to import 'clr'",
                "send_feedback.py:292: E0602",
                "send_feedback.py:137: W0631",
                "send_feedback.py:137: W0640",
                "R1720",
                ]

        if is_travis_or_appveyor() == "appveyor":
            skip.extend(["Unable to import 'fairtest'"])

        check_pep8(src_, fLOG=fLOG, skip=skip, verbose=False,
                   run_cmd_filter=_run_cmd_filter,
                   pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
                                  'C0111', 'R1702', 'C0200', 'W0703', 'W0223',
                                  'W020', 'W0212', 'C0123', 'C0302', 'W0221',
                                  'R0912', 'E0203', 'W0201', 'R1710', 'W0603',
                                  'R1711', 'R1714', 'W0107', 'W0640'))