Skip to content

Commit

Permalink
added blacken-docs for doc code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fxjung committed Feb 9, 2024
1 parent 61bd951 commit ffc344b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ repos:
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.1.1
5 changes: 2 additions & 3 deletions doc/extras.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ Later this can e.g. be used as input for the analytics module:
.. code-block:: python
stops, requests = get_stops_and_requests(
events=read_events_json("events.jsonl"),
space=read_params_json("params.json")
)
events=read_events_json("events.jsonl"), space=read_params_json("params.json")
)
.. automodule:: ridepy.extras.io
:members:
Expand Down
4 changes: 1 addition & 3 deletions doc/issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ If you in fact have run into an unreported issue, please describe clearly which
.. code:: markdown
```python
def my_broken_function(a: int, b:float):
def my_broken_function(a: int, b: float):
result = do_stuff()
return 42 + result
```
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dev = [
"twine",
"build",
"auditwheel",
"blacken-docs",
]

doc = [
Expand Down
5 changes: 5 additions & 0 deletions src/ridepy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,16 @@ def analyze(
respectively.
"""

tasks = {"stops", "requests", "vehicle_quantities"}
if compute_system_quantities:
tasks.add("system_quantities")

system_quantities = []
for simulation_id in simulation_ids:
_, sys_quant = perform_single_analysis(
sim_id=simulation_id,
data_dir=output_directory,
tasks_if_existent=tasks,
)
system_quantities.append(sys_quant)

Expand Down
6 changes: 3 additions & 3 deletions src/ridepy/extras/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ParamsJSONEncoder(json.JSONEncoder):
.. code-block:: python
>>> json.dumps(params, cls=ParamsJSONEncoder)
json.dumps(params, cls=ParamsJSONEncoder)
"""

Expand Down Expand Up @@ -63,7 +63,7 @@ class ParamsJSONDecoder(json.JSONDecoder):
.. code-block:: python
>>> json.loads(params, cls=ParamsJSONDecoder)
json.loads(params, cls=ParamsJSONDecoder)
"""

Expand Down Expand Up @@ -117,7 +117,7 @@ class EventsJSONEncoder(json.JSONEncoder):
.. code-block:: python
>>> json.dumps(events, cls=EventsJSONEncoder)
json.dumps(events, cls=EventsJSONEncoder)
"""

Expand Down
13 changes: 9 additions & 4 deletions src/ridepy/extras/simulation_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,15 @@ def _two_level_dict_update(
.. code-block:: python
>>> SimulationSet._two_level_dict_update(
... {"a": {"b": 5, 6: 8}}, {"a": {6: "fooo", 8: "baaar"}, "baz": {"6": 6}}
... )
{'a': {'b': 5, 6: 'fooo', 8: 'baaar'}, 'baz': {'6': 6}}
SimulationSet._two_level_dict_update(
{"a": {"b": 5, 6: 8}}, {"a": {6: "fooo", 8: "baaar"}, "baz": {"6": 6}}
)
yields
.. code-block:: python
{"a": {"b": 5, 6: "fooo", 8: "baaar"}, "baz": {"6": 6}}
Parameters
Expand Down
3 changes: 1 addition & 2 deletions src/ridepy/util/dispatchers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ def MyFancyDispatcher(
stoplist: Stoplist,
space: TransportSpace,
seat_capacity: int,
) -> SingleVehicleSolution:
...
) -> SingleVehicleSolution: ...
"""

Expand Down

0 comments on commit ffc344b

Please sign in to comment.