From 35fcbbcb734bbbab9897cbc822f76f138f2eae3d Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Fri, 24 Nov 2017 14:29:02 +0800 Subject: [PATCH] format code with pre-commit (#39) --- README.md | 2 +- bin/visual_dl.py | 3 ++- docs/backend_architecture.md | 1 - docs/data_structure.md | 2 +- docs/visualization.md | 2 +- setup.py | 18 ++++++++---------- visualdl/__init__.py | 4 +--- visualdl/backend/logic/im.h | 4 ++-- visualdl/backend/logic/im_test.cc | 2 +- visualdl/backend/storage/storage.h | 6 +++--- visualdl/backend/test.py | 6 +----- visualdl/frontend/src/index.js | 1 - 12 files changed, 21 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index badb87f5..990bf98e 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,4 @@ npm run build ### Step 3: run ``` python bin/visual_dl.py --port=8888 -``` \ No newline at end of file +``` diff --git a/bin/visual_dl.py b/bin/visual_dl.py index 2a286cc7..7d2121a7 100644 --- a/bin/visual_dl.py +++ b/bin/visual_dl.py @@ -52,7 +52,8 @@ static_file_path = "../visualdl/frontend/dist/" @app.route('/static/') def serve_static(filename): - return send_from_directory(os.path.join(server_path, static_file_path), filename) + return send_from_directory( + os.path.join(server_path, static_file_path), filename) @app.route("/") diff --git a/docs/backend_architecture.md b/docs/backend_architecture.md index 4ef9a6ea..eaa3b0ae 100644 --- a/docs/backend_architecture.md +++ b/docs/backend_architecture.md @@ -48,4 +48,3 @@ IM 与 Server 的关系是 ### Protobuf API - 决定了底层的数据格式,protobuf 提供了序列化的公共界面 - SDK通过Protobuf API操作底层数据 - diff --git a/docs/data_structure.md b/docs/data_structure.md index 32a3abe6..56982ad7 100644 --- a/docs/data_structure.md +++ b/docs/data_structure.md @@ -159,7 +159,7 @@ histogram 需要得到tensor的分布,因此会把完整的tensor 的数值存 ] ``` -## graph +## graph graph 会复杂一些,可能无法借用上述类型 ```javascript diff --git a/docs/visualization.md b/docs/visualization.md index b7151398..1ae69295 100644 --- a/docs/visualization.md +++ b/docs/visualization.md @@ -6,4 +6,4 @@ # 前端增量 -# 前端采样 \ No newline at end of file +# 前端采样 diff --git a/setup.py b/setup.py index fd6b7b93..7865a873 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,10 @@ from setuptools import setup -setup(name="visualdl", - version="0.0.1", - packages=['visualdl'], - include_package_data=True, - install_requires=[ - 'flask>=0.12.1' - ], - url='http://www.baidu.com/', - license='Apache 2.0', -) +setup( + name="visualdl", + version="0.0.1", + packages=['visualdl'], + include_package_data=True, + install_requires=['flask>=0.12.1'], + url='http://www.baidu.com/', + license='Apache 2.0', ) diff --git a/visualdl/__init__.py b/visualdl/__init__.py index 2a1e845b..f4d48fbf 100644 --- a/visualdl/__init__.py +++ b/visualdl/__init__.py @@ -1,5 +1,3 @@ import log -__all__ = [ - 'log' -] +__all__ = ['log'] diff --git a/visualdl/backend/logic/im.h b/visualdl/backend/logic/im.h index dfb73a83..58959779 100644 --- a/visualdl/backend/logic/im.h +++ b/visualdl/backend/logic/im.h @@ -52,6 +52,6 @@ private: Storage storage_; }; -} // namespace visualdl +} // namespace visualdl -#endif // VISUALDL_BACKEND_LOGIC_IM_H +#endif // VISUALDL_BACKEND_LOGIC_IM_H diff --git a/visualdl/backend/logic/im_test.cc b/visualdl/backend/logic/im_test.cc index 8c8896ab..36f5b6e5 100644 --- a/visualdl/backend/logic/im_test.cc +++ b/visualdl/backend/logic/im_test.cc @@ -26,4 +26,4 @@ TEST_F(ImTester, AddRecord) { ASSERT_EQ(im.storage().Find("tag0")->records_size(), 20UL); } -} // namespace visualdl +} // namespace visualdl diff --git a/visualdl/backend/storage/storage.h b/visualdl/backend/storage/storage.h index a623eb0f..385f9983 100644 --- a/visualdl/backend/storage/storage.h +++ b/visualdl/backend/storage/storage.h @@ -1,8 +1,8 @@ #ifndef VISUALDL_STORAGE_H #define VISUALDL_STORAGE_H -#include #include +#include #include "visualdl/backend/storage/storage.pb.h" @@ -66,6 +66,6 @@ private: storage::Storage proto_; }; -} // namespace visualdl +} // namespace visualdl -#endif // VISUALDL_STORAGE_H +#endif // VISUALDL_STORAGE_H diff --git a/visualdl/backend/test.py b/visualdl/backend/test.py index e7c1add3..19373434 100644 --- a/visualdl/backend/test.py +++ b/visualdl/backend/test.py @@ -46,11 +46,7 @@ class TabletTester(unittest.TestCase): scalar = self.tablet.as_float_scalar() py_captions = ["train", "test"] step_ids = [10, 20, 30] - py_records = [ - [0.1, 0.2], - [0.2, 0.3], - [0.3, 0.4] - ] + py_records = [[0.1, 0.2], [0.2, 0.3], [0.3, 0.4]] scalar.set_captions(py_captions) for i in range(len(py_records)): diff --git a/visualdl/frontend/src/index.js b/visualdl/frontend/src/index.js index 74c3dd0a..3c31ecf6 100644 --- a/visualdl/frontend/src/index.js +++ b/visualdl/frontend/src/index.js @@ -6,4 +6,3 @@ new App({ titleName: 'VisualDL' } }).attach(document.getElementById('root')); - -- GitLab