Skip to content

Commit 05b0d98

Browse files
committed
🎨 adjust comments and docstrings to line-length
1 parent a0c4ca2 commit 05b0d98

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

src/vuegen/report.py

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,26 @@ def value_with_dot(self):
8787
@dataclass
8888
class Component:
8989
"""
90-
Base class for different components in a report subsection. It encapsulates elements like
91-
plots, dataframes, markdown, or apicalls, providing a consistent structure for report generation.
90+
Base class for different components in a report subsection. It encapsulates elements
91+
like plots, dataframes, markdown, or apicalls,
92+
providing a consistent structure for report generation.
9293
9394
Attributes
9495
----------
9596
_id_counter : ClassVar[int]
9697
Class-level counter for unique IDs.
9798
id : int
98-
Unique identifier for the component, assigned automatically when an object is created.
99+
Unique identifier for the component, assigned automatically
100+
when an object is created.
99101
title : str
100102
Title of the component.
101103
component_type : ComponentType
102104
Type of the component (e.g., PLOT, DATAFRAME, MARKDOWN, APICALL).
103105
logger : logging.Logger
104106
Logger object for tracking warnings, errors, and info messages.
105107
file_path : Optional[str]
106-
Path to the file associated with the component (e.g., plot JSON file, image file, csv file, etc.).
108+
Path to the file associated with the component
109+
(e.g., plot JSON file, image file, csv file, etc.).
107110
caption : Optional[str]
108111
Caption providing additional context about the component (default: None).
109112
"""
@@ -134,7 +137,8 @@ class Plot(Component):
134137
plot_type : PlotType
135138
The type of the plot (INTERACTIVE or STATIC).
136139
csv_network_format : CSVNetworkFormat, optional
137-
The format of the CSV file for network plots (EDGELIST or ADJLIST) (default is None).
140+
The format of the CSV file for network plots (EDGELIST or ADJLIST)
141+
(default is None).
138142
"""
139143

140144
def __init__(
@@ -265,7 +269,8 @@ def read_network(self) -> nx.Graph:
265269
f"Unsupported format for CSV/TXT file: {self.csv_network_format}."
266270
)
267271

268-
# Handle other formats using the mapping and return the NetworkX graph object from the specified network file
272+
# Handle other formats using the mapping and return the NetworkX graph object
273+
# from the specified network file
269274
G = file_extension_map[file_extension](file_stream)
270275
G = self._add_size_attribute(G)
271276
self.logger.info(f"Successfully read network from file: {self.file_path}.")
@@ -393,7 +398,8 @@ def create_and_save_pyvis_network(self, G: nx.Graph, output_file: str) -> Networ
393398

394399
def _add_size_attribute(self, G: nx.Graph) -> nx.Graph:
395400
"""
396-
Adds a 'size' attribute to the nodes of a NetworkX graph based on their degree centrality.
401+
Adds a 'size' attribute to the nodes of a NetworkX graph
402+
based on their degree centrality.
397403
398404
Parameters
399405
----------
@@ -445,9 +451,11 @@ class DataFrame(Component):
445451
Attributes
446452
----------
447453
file_format : DataFrameFormat
448-
The format of the file from which the DataFrame is loaded (e.g., CSV, TXT, PARQUET).
454+
The format of the file from which the DataFrame is loaded
455+
(e.g., CSV, TXT, PARQUET).
449456
delimiter : Optional[str]
450-
The delimiter to use if the file is a delimited text format (e.g., ';', '\t', etc).
457+
The delimiter to use if the file is a delimited text format
458+
(e.g., ';', '\t', etc).
451459
"""
452460

453461
def __init__(
@@ -530,7 +538,8 @@ class APICall(Component):
530538
api_url : str
531539
The URL of the API to interact with.
532540
method : str
533-
HTTP method to use for the request ("GET", "POST", or "PUT"). The deafult is "GET".
541+
HTTP method to use for the request ("GET", "POST", or "PUT").
542+
The deafult is "GET".
534543
headers : Optional[dict]
535544
Headers to include in the API request (default is None).
536545
params : Optional[dict]
@@ -617,12 +626,14 @@ def make_api_request(
617626
class ChatBot(Component):
618627
"""
619628
A component for creating a ChatBot that interacts with an API.
620-
This component uses an APICall instance to send requests to the chatbot API and receive responses.
629+
This component uses an APICall instance to send requests
630+
to the chatbot API and receive responses.
621631
622632
Attributes
623633
----------
624634
api_call : APICall
625-
An instance of the APICall class used to interact with the API for fetching chatbot responses.
635+
An instance of the APICall class used to interact
636+
with the API for fetching chatbot responses.
626637
model : Optional[str]
627638
The language model to use for the chatbot (default is None).
628639
headers : Optional[dict]
@@ -670,7 +681,8 @@ class Subsection:
670681
_id_counter : ClassVar[int]
671682
Class-level counter for unique IDs.
672683
id : int
673-
Unique identifier for the subsection, assigned automatically when an object is created.
684+
Unique identifier for the subsection, assigned automatically
685+
when an object is created.
674686
title : str
675687
Title of the subsection.
676688
components : List[Component]
@@ -709,7 +721,8 @@ class Section:
709721
_id_counter : ClassVar[int]
710722
Class-level counter for unique IDs.
711723
id : int
712-
Unique identifier for the section, assigned automatically when an object is created.
724+
Unique identifier for the section, assigned automatically
725+
when an object is created.
713726
title : str
714727
Title of the section.
715728
subsections : List[Subsection]
@@ -798,7 +811,8 @@ def generate_report(self, output_dir: str = "sections") -> None:
798811
Parameters
799812
----------
800813
output_dir : str, optional
801-
The folder where the generated report files will be saved (default is 'sections').
814+
The folder where the generated report files will be saved
815+
(default is 'sections').
802816
"""
803817
pass
804818

@@ -822,7 +836,8 @@ def _generate_component_imports(self) -> str:
822836
Parameters
823837
----------
824838
component : r.Component
825-
The component for which to generate the required imports. The component can be of type:
839+
The component for which to generate the required imports.
840+
The component can be of type:
826841
- PLOT
827842
- DATAFRAME
828843
- MARKDOWN
@@ -852,7 +867,8 @@ def _format_text(self, text: str, type: str, level: int, color: str) -> str:
852867
type : str
853868
The type of the text (e.g., 'header', 'paragraph').
854869
level : int, optional
855-
If the text is a header, the level of the header (e.g., 1 for h1, 2 for h2, etc.).
870+
If the text is a header, the level of the header
871+
(e.g., 1 for h1, 2 for h2, etc.).
856872
color : str, optional
857873
The color of the header text.
858874
@@ -884,8 +900,9 @@ def _generate_subsection(
884900
self, subsection: Subsection
885901
) -> tuple[List[str], List[str]]:
886902
"""
887-
Generate code to render components (plots, dataframes, markdown) in the given subsection,
888-
creating imports and content for the subsection based on the component type.
903+
Generate code to render components (plots, dataframes, markdown) in the given
904+
subsection, creating imports and content for the subsection based on
905+
the component type.
889906
890907
Parameters
891908
----------

0 commit comments

Comments
 (0)