当前位置: 首页>>代码示例>>Python>>正文


Python pyquickhelper.fLOG函数代码示例

本文整理汇总了Python中pyquickhelper.fLOG函数的典型用法代码示例。如果您正苦于以下问题:Python fLOG函数的具体用法?Python fLOG怎么用?Python fLOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fLOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_jenkins_local

    def test_jenkins_local(self):
        fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__")

        st = rst_table_modules()
        fLOG("\n" + st)
        assert st is not None
        assert len(st) > 0
开发者ID:vincentCGI,项目名称:ensae_teaching_cs,代码行数:7,代码来源:test_modules_documentation.py

示例2: test_graph

    def test_graph(self) :
        """
        This test is failing with Python 3.4 if many pictures are drawn.
        """
        fLOG (__file__, self._testMethodName, OutputPrint = __name__ == "__main__")

        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache2")
        stocks = [ StockPrices ("BNP.PA", folder = cache),
                    StockPrices ("CA.PA", folder = cache),
                    StockPrices ("SAF.PA", folder = cache),
                    ]
                    
        if True:
            fig, ax, plt = StockPrices.draw(stocks, figsize=(16,8), field = ["Adj Close", "Close"])
            img = os.path.abspath(os.path.join(os.path.split(__file__)[0],"temp_image.png"))
            if os.path.exists(img): os.remove(img)
            fig.savefig(img)
            assert os.path.exists(img)

        if True and sys.version_info < (3,4) :
            fig, ax, plt = StockPrices.draw(stocks, begin="2010-01-01")
            img = os.path.abspath(os.path.join(os.path.split(__file__)[0],"temp_image2.png"))
            if os.path.exists(img): os .remove(img)
            fig.savefig(img)
            assert os.path.exists(img)
            
        if True and sys.version_info < (3,4):
            fig, ax, plt = StockPrices.draw(stocks[:1], begin="2010-01-01")
            img = os.path.abspath(os.path.join(os.path.split(__file__)[0],"temp_image3.png"))
            if os.path.exists(img): os .remove(img)
            fig.savefig(img)
            assert os.path.exists(img)     
开发者ID:ped4747,项目名称:pyensae,代码行数:33,代码来源:test_stock_graph.py

示例3: test_notebook_runner

    def test_notebook_runner(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        jupyter_cython_extension()
开发者ID:vincentCGI,项目名称:ensae_teaching_cs,代码行数:7,代码来源:test_check_cython.py

示例4: test_ls

 def test_ls(self):
     fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__")
     if self.client is None:
         return
     df = self.client.ls(self.blob_serv, None)
     fLOG(df)
     assert isinstance(df, pandas.DataFrame)
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:7,代码来源:test_azure.py

示例5: test_import_sql

    def test_import_sql(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        file = os.path.join(
            os.path.abspath(
                os.path.split(__file__)[0]),
            "data",
            "ACA.PA.txt")
        dbf = os.path.join(
            os.path.abspath(
                os.path.split(__file__)[0]),
            "temp_database_inti.db3")
        if os.path.exists(dbf):
            os.remove(dbf)
        assert not os.path.exists(dbf)

        face = InterfaceSQL.create(dbf)
        face.connect()

        face.import_flat_file(file, "ACAPA2")
        assert face.CC.ACAPA2._ == "ACAPA2"

        face.close()
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:25,代码来源:test_interface_sql.py

示例6: test_covariance

    def test_covariance(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache_cov")
        stocks = [StockPrices("BNP.PA", folder=cache),
                  StockPrices("CA.PA", folder=cache),
                  StockPrices("SAF.PA", folder=cache),
                  ]

        dates = StockPrices.available_dates(stocks)
        ok = dates[dates["missing"] == 0]
        stocks = [v.keep_dates(ok) for v in stocks]

        cov = StockPrices.covariance(stocks)
        assert len(cov) == 3

        cor = StockPrices.covariance(stocks, cov=False)
        assert len(cor) == 3
        assert cor.ix["BNP.PA", "BNP.PA"] == 1
        assert cor.ix[2, 2] == 1

        ret, mat = StockPrices.covariance(stocks, cov=False, ret=True)
        assert len(ret) == 3
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:26,代码来源:test_stock_http.py

示例7: test_data_velib_simulation

    def test_data_velib_simulation(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__",
            LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        for speed in (10, 15):
            for bike in (1, 2, 3, 5, 10):
                df = DataVelibCollect.to_df(data)
                dfp, dfs = DataVelibCollect.simulate(
                    df, bike, speed, fLOG=fLOG)

                dfp.to_csv(
                    "out_simul_bike_nb{0}_sp{1}_path.txt".format(
                        bike,
                        speed),
                    sep="\t",
                    index=False)
                dfs.to_csv(
                    "out_simul_bike_nb{0}_sp{1}_data.txt".format(
                        bike,
                        speed),
                    sep="\t",
                    index=False)
                if __name__ != "__main__":
                    return
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:29,代码来源:test_data_velib_simulation.py

示例8: test_notebook_runner_correction_1_7

    def test_notebook_runner_correction_1_7(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        temp = get_temp_folder(__file__, "temp_notebook1a_correction_1_7")
        keepnote = ls_notebooks("td1a")
        assert len(keepnote) > 0

        cp = os.path.join(temp, "..", "data", "seance4_excel.txt")
        shutil.copy(cp, temp)
        cp = os.path.join(temp, "..", "data", "seance4_excel.xlsx")
        shutil.copy(cp, temp)

        res = execute_notebooks(temp, keepnote,
                                lambda i, n: "_12" not in n
                                and "session6." not in n
                                and "session8." not in n
                                and "session9." not in n
                                and "session_10." not in n
                                and "session_11." not in n
                                and "correction" in n,
                                fLOG=fLOG,
                                clean_function=clean_function_1a)
        unittest_raise_exception_notebook(res, fLOG)
开发者ID:vincentCGI,项目名称:ensae_teaching_cs,代码行数:25,代码来源:test_notebook_1a_correction_1_7.py

示例9: test_flake8

    def test_flake8(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"))
        exe = os.path.dirname(sys.executable)
        scr = os.path.join(exe, "Scripts")
        fla = os.path.join(scr, "flake8")
        cmd = fla + " " + src
        out, err = run_cmd(cmd, fLOG=fLOG, wait=True)

        lines = out.split("\n")
        lines = [_ for _ in lines if "E501" not in _ and "__init__.py" not in _ and "E265" not in _
                 and "W291" not in _]
        lines = [_ for _ in lines if len(_) > 1]
        if __name__ == "__main__":
            for l in lines:
                spl = l.split(":")
                if len(spl[0]) == 1:
                    spl[1] = ":".join(spl[0:2])
                    del spl[0]
                    print(
                        '  File "{0}", line {1}, {2}'.format(spl[0], spl[1], spl[-1]))
        if len(lines) > 0:
            raise Exception(
                "{0} lines\n{1}".format(len(lines), "\n".join(lines)))
开发者ID:WilliamRen,项目名称:python3_module_template,代码行数:29,代码来源:test_flake8.py

示例10: test_data_velib_animation

    def test_data_velib_animation(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__",
            LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        if "travis" in sys.executable:
            return

        try:
            from JSAnimation import IPython_display
        except ImportError:
            import pymyinstall
            pymyinstall.ModuleInstall(
                "JSAnimation",
                "github",
                "jakevdp").install(
                temp_folder="c:\\temp")

        df = DataVelibCollect.to_df(data)
        anime = DataVelibCollect.js_animation(df)

        from JSAnimation import HTMLWriter
        wr = HTMLWriter(embed_frames=False)
        anime.save(os.path.join(fold, "out_animation.html"), writer=wr)
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:28,代码来源:test_data_velib_offline.py

示例11: test_import_flatflitand_copy

    def test_import_flatflitand_copy(self) :
        fLOG (__file__, self._testMethodName, OutputPrint = __name__ == "__main__")
        
        file = os.path.join(os.path.abspath(os.path.split(__file__)[0]), "data", "ACA.PA.txt")
        dbf  = os.path.join(os.path.abspath(os.path.split(__file__)[0]), "temp_database_copy.db3")
        if os.path.exists(dbf) : os.remove(dbf)

        dbf2  = os.path.join(os.path.abspath(os.path.split(__file__)[0]), "out_copy.db3")
        if os.path.exists(dbf2) : os.remove(dbf2)
        
        import_flatfile_into_database(dbf, file, fLOG = fLOG)
        assert os.path.exists(dbf)
        
        db = Database(dbf, LOG = fLOG)
        dbm = Database(dbf2, LOG = fLOG)
        db.copy_to(dbm)

        db.connect()
        dbm.connect()
        tbls = dbm.get_table_list()
        if len(tbls)!=1 : raise Exception("expects one table not %d" % len(tbls))
        view = db.execute_view("SELECT * FROM ACAPA")
        viewm = dbm.execute_view("SELECT * FROM ACAPA")
        db.close()
        dbm.close()
        assert len(view) == len(viewm)
        
        dbm2 = Database(":memory:", LOG = fLOG)
        db.copy_to(dbm2)
        dbm2.connect()
        tbls = dbm2.get_table_list()
        if len(tbls)!=1 : raise Exception("expects one table not %d" % len(tbls))
        viewm2 = dbm2.execute_view("SELECT * FROM ACAPA")
        dbm2.close()
        assert len(view) == len(viewm2)
开发者ID:ped4747,项目名称:pyensae,代码行数:35,代码来源:test_database_copy.py

示例12: test_csharp

    def test_csharp(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        code = """
        namespace hello
        {
            public static class world
            {
                public static double function(double x, doubly y)
                {
                    return x+y ;
                }
            }
        }
        """

        clparser, cllexer = get_parser_lexer("C#")
        parser = parse_code(code, clparser, cllexer)
        tree = parser.parse()
        st = get_tree_string(tree, parser)
        fLOG(st.replace("\\n", "\n"))
        assert len(st) > 0
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:25,代码来源:test_parse_code.py

示例13: test_save_stock

    def test_save_stock(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")
        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache_file")
        name = os.path.join(cache, "BNP.PA.2000-01-03.2014-01-15.txt")
        if os.path.exists(name):
            os.remove(name)

        stock = StockPrices(
            "BNP.PA",
            folder=cache,
            end=datetime.datetime(
                2014,
                1,
                15))

        file = os.path.join(cache, "save.txt")
        if os.path.exists(file):
            os.remove(file)
        stock.to_csv(file)
        assert os.path.exists(file)

        stock2 = StockPrices(file, sep="\t")
        assert stock.dataframe.shape == stock2.dataframe.shape
        df = stock2.dataframe
        file = os.path.join(cache, "out_excel.xlsx")
        if os.path.exists(file):
            os.remove(file)
        df.to_excel(file)
        assert os.path.exists(file)
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:33,代码来源:test_stock_file.py

示例14: nb_open

def nb_open(filename, profile="default", fLOG=fLOG):
    """
    open a notebook with an existing server,
    if no server can be found, it starts a new one
    (and the function runs until the server is closed)

    @param      filename        notebook
    @param      profile         profile to use
    @param      fLOG            logging function
    @return                     a running server or None if not found
    """
    filename = os.path.abspath(filename)
    server_inf = find_best_server(filename, profile)
    if server_inf is not None:
        fLOG("Using existing server at", server_inf["notebook_dir"])
        path = os.path.relpath(filename, start=server_inf["notebook_dir"])
        url = url_path_join(server_inf["url"], "notebooks", path)
        webbrowser.open(url, new=2)
        return server_inf
    else:
        fLOG("Starting new server")
        home_dir = os.path.dirname(filename)
        server = notebookapp.launch_new_instance(
            file_to_run=os.path.abspath(filename),
            notebook_dir=home_dir,
            open_browser=True,
            # Avoid it seeing our own argv
            argv=[],
        )
        return server
开发者ID:vincentCGI,项目名称:ensae_teaching_cs,代码行数:30,代码来源:faq_jupyter_helper.py

示例15: test_notebook_runner

 def test_notebook_runner(self):
     fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__")
     temp = get_temp_folder(__file__, "temp_notebook2a_1")
     keepnote = ls_notebooks("td2a")
     assert len(keepnote) > 0
     res = execute_notebooks(temp, keepnote, lambda i, n: "_1" in n, fLOG=fLOG)
     unittest_raise_exception_notebook(res, fLOG)
开发者ID:vincentCGI,项目名称:ensae_teaching_cs,代码行数:7,代码来源:test_notebook_2a_1.py


注:本文中的pyquickhelper.fLOG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。