facebookresearch / labgraph

LabGraph is a Python framework for rapidly prototyping experimental systems for real-time streaming applications. It is particularly well-suited to real-time neuroscience, physiology and psychology experiments.
MIT License
161 stars 48 forks source link

Using Black for Code Formatter? #74

Open dtemir opened 2 years ago

dtemir commented 2 years ago

🚀 Feature

I think it would be a good idea to use Black https://github.com/psf/black as a code formatter to set a code style.

Motivation

I just think it would be a good idea to set a standard across the entire project.

I ran black . on the entire repository and got this. It looks like it would be especially useful to make extensions more readable.

Skipping .ipynb files as Jupyter dependencies are not installed.
You can fix this by running ``pip install black[jupyter]``
reformatted extensions/graphviz_support/graphviz_support/errors/errors.py
reformatted extensions/graphviz_support/graphviz_support/tests/demo_graph/amplifier.py
reformatted extensions/graphviz_support/graphviz_support/tests/demo_graph/attenuator.py
reformatted extensions/graphviz_support/graphviz_support/tests/demo_graph/noise_generator.py
reformatted extensions/graphviz_support/graphviz_support/graphviz_node/graphviz_node.py
reformatted extensions/graphviz_support/graphviz_support/tests/demo_graph/demo.py
reformatted buck_ext.py
reformatted extensions/graphviz_support/graphviz_support/tests/demo_graph/rolling_averager.py
reformatted extensions/graphviz_support/graphviz_support/generate_graphviz/generate_graphviz.py
reformatted extensions/graphviz_support/graphviz_support/tests/test_lg_graphviz_api.py
reformatted extensions/labgraph_viz/labgraph_viz/application/application.py
reformatted extensions/labgraph_viz/labgraph_viz/examples/application_example.py
reformatted extensions/labgraph_viz/labgraph_viz/examples/scatter_plot_example.py
reformatted extensions/labgraph_viz/labgraph_viz/examples/line_plot_example.py
reformatted extensions/labgraph_viz/labgraph_viz/examples/spatial_plot_example.py
reformatted extensions/labgraph_viz/labgraph_viz/examples/heat_map_example.py
reformatted extensions/labgraph_viz/labgraph_viz/plots/bar_plot.py
reformatted extensions/labgraph_viz/labgraph_viz/plots/heat_map.py
reformatted extensions/labgraph_viz/labgraph_viz/plots/color_map.py
reformatted extensions/psychopy_example/psychopy_example/__main__.py
reformatted extensions/yaml_support/labgraph_monitor/aliases/aliases.py
reformatted extensions/psychopy_example/setup.py
reformatted extensions/yaml_support/labgraph_monitor/labgraph_monitor.py
reformatted extensions/yaml_support/labgraph_monitor/lg_monitor_node/lg_monitor_message.py
reformatted extensions/yaml_support/labgraph_monitor/lg_monitor_node/lg_monitor_node.py
reformatted extensions/yaml_support/labgraph_monitor/server/lg_monitor_server.py
reformatted extensions/yaml_support/labgraph_yaml_parser/loader/base_loader.py
reformatted extensions/psychopy_example/psychopy_example/components.py
reformatted extensions/yaml_support/labgraph_yaml_parser/loader/errors/errors.py
reformatted extensions/yaml_support/labgraph_yaml_parser/model/base_model.py
reformatted extensions/yaml_support/labgraph_yaml_parser/loader/python_file_loader.py
reformatted extensions/yaml_support/labgraph_monitor/examples/labgraph_monitor_example.py
reformatted extensions/yaml_support/labgraph_yaml_parser/serializer/base_serializer.py
reformatted extensions/yaml_support/labgraph_yaml_parser/serializer/yaml_serializer.py
reformatted extensions/labgraph_viz/labgraph_viz/plots/line_plot.py
reformatted extensions/yaml_support/labgraph_yaml_parser/tests/tests_code/test_py_code.py
reformatted extensions/yaml_support/labgraph_yaml_parser/tests/tests_code/test_lg_unit_node.py
reformatted extensions/yaml_support/labgraph_monitor/generate_lg_monitor/generate_lg_monitor.py
reformatted extensions/yaml_support/setup.py
reformatted extensions/yaml_support/labgraph_yaml_parser/model/lg_unit_model.py
reformatted extensions/yaml_support/labgraph_monitor/tests/test_lg_monitor_api.py
reformatted labgraph/devices/protocols/lsl/lsl_message.py
reformatted labgraph/devices/protocols/lsl/lsl_poller_node.py
reformatted extensions/yaml_support/labgraph_yaml_parser/_parser/lg_units_parser.py
reformatted labgraph/devices/protocols/lsl/lsl_sender_node.py
reformatted extensions/yaml_support/labgraph_monitor/server/serializer_node.py
reformatted extensions/yaml_support/labgraph_yaml_parser/tests/test_lg_yaml_api.py
reformatted labgraph/examples/rate.py
reformatted labgraph/examples/zmq_source.py
reformatted labgraph/events/tests/test_event_generator_node.py
reformatted labgraph/devices/protocols/lsl/tests/test_lsl_node.py
reformatted labgraph/examples/simulation.py
reformatted labgraph/examples/simple_viz_zmq.py
reformatted labgraph/runners/tests/test_process_manager.py
reformatted setup.py
reformatted labgraph/runners/tests/test_exception.py
reformatted signal_processing/synthetic/generators/tests/test_sine_wave_generator.py
reformatted test.py
reformatted labgraph/runners/process_manager.py
reformatted signal_processing/utils/types/time_series.py

All done! ✨ 🍰 ✨
60 files reformatted, 238 files left unchanged.
bennaaym commented 2 years ago

@dtemir, a great suggestion I was thinking about that too. maybe Labgraph can use GitHub pre-commit hook to automate the formating (Black) and linting (Flake8) process.

dtemir commented 2 years ago

@dtemir, a great suggestion I was thinking about that too. maybe Labgraph can use GitHub pre-commit hook to automate the formating (Black) and linting (Flake8) process.

Awesome idea. Looking into that right now.

Never built pre-commit hooks before. I was mostly thinking of a Makefile, but automating would good!