rolling-pin 0.10.0__tar.gz → 0.10.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rolling-pin
3
- Version: 0.10.0
3
+ Version: 0.10.1
4
4
  Summary: A library of generic tools for ETL work and visualization of JSON blobs and python repositories
5
5
  License: MIT
6
6
  Keywords: ETL,blob,dependency,graph,svg,networkx,transform,code metrics,dependency diagram,build system
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rolling-pin"
3
- version = "0.10.0"
3
+ version = "0.10.1"
4
4
  description = "A library of generic tools for ETL work and visualization of JSON blobs and python repositories"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -33,10 +33,10 @@ dependencies = [
33
33
  "ipython",
34
34
  "lunchbox",
35
35
  "networkx",
36
- "numpy>=1.23.4,<=1.24.4",
36
+ "numpy>=1.23.4",
37
37
  "pandas>=1.1.5",
38
38
  "plotly>=5.22.0",
39
- "pydot<=1.4.2",
39
+ "pydot>=1.4.2",
40
40
  "pyyaml",
41
41
  "radon<6.0.0",
42
42
  "schematics",
@@ -335,17 +335,28 @@ class RepoETL():
335
335
  return data
336
336
 
337
337
  @staticmethod
338
- def _to_networkx_graph(data):
339
- # (DataFrame) -> networkx.DiGraph
338
+ def _to_networkx_graph(data, escape_chars=False):
339
+ # (DataFrame, bool) -> networkx.DiGraph
340
340
  '''
341
341
  Converts given DataFrame into networkx directed graph.
342
342
 
343
343
  Args:
344
- DataFrame: DataFrame of nodes.
344
+ data (DataFrame): DataFrame of nodes.
345
+ escape_chars (bool, optional): Escape special characters. Used to
346
+ avoid dot file errors. Default: False.
345
347
 
346
348
  Returns:
347
349
  networkx.DiGraph: Graph of nodes.
348
350
  '''
351
+ # escape periods for dot file interpolation
352
+ if escape_chars:
353
+ data = data.copy()
354
+ data.node_name = data.node_name \
355
+ .fillna('') \
356
+ .apply(lambda x: re.sub(r'\.', '\\.', x))
357
+ data.dependencies = data.dependencies \
358
+ .apply(lambda x: [re.sub(r'\.', '\\.', y) for y in x])
359
+
349
360
  graph = networkx.DiGraph()
350
361
  data.apply(
351
362
  lambda x: graph.add_node(
@@ -406,7 +417,7 @@ class RepoETL():
406
417
  color_scheme = rpt.COLOR_SCHEME
407
418
 
408
419
  # create dot graph
409
- graph = self.to_networkx_graph()
420
+ graph = self._to_networkx_graph(self._data, escape_chars=True)
410
421
  dot = networkx.drawing.nx_pydot.to_pydot(graph)
411
422
 
412
423
  # set layout orientation
File without changes
File without changes