rolling-pin 0.9.6__py3-none-any.whl → 0.10.1__py3-none-any.whl
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.
- rolling_pin/radon_etl.py +52 -39
- rolling_pin/repo_etl.py +15 -4
- rolling_pin/tools.py +75 -10
- {rolling_pin-0.9.6.dist-info → rolling_pin-0.10.1.dist-info}/METADATA +4 -4
- rolling_pin-0.10.1.dist-info/RECORD +15 -0
- rolling_pin-0.9.6.dist-info/RECORD +0 -15
- {rolling_pin-0.9.6.dist-info → rolling_pin-0.10.1.dist-info}/WHEEL +0 -0
- {rolling_pin-0.9.6.dist-info → rolling_pin-0.10.1.dist-info}/entry_points.txt +0 -0
- {rolling_pin-0.9.6.dist-info → rolling_pin-0.10.1.dist-info}/licenses/LICENSE +0 -0
rolling_pin/radon_etl.py
CHANGED
@@ -5,13 +5,13 @@ import os
|
|
5
5
|
import re
|
6
6
|
from pathlib import Path
|
7
7
|
|
8
|
-
|
8
|
+
from pandas import DataFrame
|
9
|
+
from radon.cli import CCHarvester, HCHarvester, MIHarvester, RawHarvester
|
10
|
+
from radon.cli import Config
|
9
11
|
import numpy as np
|
10
12
|
import pandas as pd
|
11
|
-
|
13
|
+
import plotly.express as px
|
12
14
|
import radon.complexity
|
13
|
-
from radon.cli import Config
|
14
|
-
from radon.cli import CCHarvester, HCHarvester, MIHarvester, RawHarvester
|
15
15
|
|
16
16
|
from rolling_pin.blob_etl import BlobETL
|
17
17
|
import rolling_pin.tools as rpt
|
@@ -413,8 +413,6 @@ class RadonETL():
|
|
413
413
|
Returns:
|
414
414
|
RadonETL: self.
|
415
415
|
'''
|
416
|
-
cf.go_offline()
|
417
|
-
|
418
416
|
def remove_test_modules(data):
|
419
417
|
# type: (DataFrame) -> DataFrame
|
420
418
|
mask = data.fullpath\
|
@@ -436,13 +434,6 @@ class RadonETL():
|
|
436
434
|
bugs='bugs (B) - V / 3000 - an estimate of the errors in the implementation',
|
437
435
|
)
|
438
436
|
|
439
|
-
params = dict(
|
440
|
-
theme='henanigans',
|
441
|
-
colors=rpt.COLOR_SCALE,
|
442
|
-
dimensions=(900, 900),
|
443
|
-
asFigure=True,
|
444
|
-
)
|
445
|
-
|
446
437
|
html = '<body style="background: #242424">\n'
|
447
438
|
|
448
439
|
raw = remove_test_modules(self.raw_metrics)
|
@@ -452,42 +443,64 @@ class RadonETL():
|
|
452
443
|
|
453
444
|
raw['docstring_ratio'] = raw.multiline_comment / raw.code
|
454
445
|
raw.sort_values('docstring_ratio', inplace=True)
|
455
|
-
|
456
|
-
|
457
|
-
|
446
|
+
|
447
|
+
# line count
|
448
|
+
fig = px.bar(
|
449
|
+
raw,
|
458
450
|
title='Line Count Metrics',
|
459
|
-
|
460
|
-
|
451
|
+
x=raw.drop(columns='fullpath').columns.tolist(),
|
452
|
+
y='fullpath',
|
453
|
+
orientation='h',
|
454
|
+
barmode='group',
|
455
|
+
width=900,
|
456
|
+
height=900,
|
457
|
+
color_discrete_sequence=rpt.COLOR_SCALE,
|
458
|
+
)
|
459
|
+
fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
|
460
|
+
html += fig.to_html()
|
461
461
|
|
462
|
-
|
463
|
-
|
464
|
-
|
462
|
+
# maintainability
|
463
|
+
fig = px.bar(
|
464
|
+
mi,
|
465
465
|
title='Maintainability Metrics',
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
466
|
+
x='maintainability_index',
|
467
|
+
y='fullpath',
|
468
|
+
orientation='h',
|
469
|
+
barmode='group',
|
470
|
+
width=900,
|
471
|
+
height=900,
|
472
|
+
color_discrete_sequence=rpt.COLOR_SCALE,
|
473
|
+
)
|
474
|
+
fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
|
475
|
+
html += fig.to_html()
|
470
476
|
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
bins=50,
|
477
|
+
# cyclomatic
|
478
|
+
fig = px.histogram(
|
479
|
+
cc[['cyclomatic_complexity', 'cyclomatic_rank']],
|
475
480
|
title='Cyclomatic Metric Distributions',
|
476
|
-
|
477
|
-
|
481
|
+
nbins=10,
|
482
|
+
width=900,
|
483
|
+
height=500,
|
484
|
+
color_discrete_sequence=rpt.COLOR_SCALE,
|
485
|
+
)
|
486
|
+
fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
|
487
|
+
html += fig.to_html()
|
478
488
|
|
489
|
+
# halstead
|
479
490
|
cols = [
|
480
491
|
'h1', 'h2', 'n1', 'n2', 'vocabulary', 'length', 'calculated_length',
|
481
492
|
'volume', 'difficulty', 'effort', 'time', 'bugs'
|
482
493
|
]
|
483
|
-
|
484
|
-
.rename(mapper=lambda x: lut[x], axis=1)
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
494
|
+
fig = px.histogram(
|
495
|
+
hal[cols].rename(mapper=lambda x: lut[x], axis=1),
|
496
|
+
title='Halstead Metric Distributions',
|
497
|
+
nbins=10,
|
498
|
+
width=1400,
|
499
|
+
height=500,
|
500
|
+
color_discrete_sequence=rpt.COLOR_SCALE,
|
501
|
+
)
|
502
|
+
fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
|
503
|
+
html += fig.to_html()
|
491
504
|
|
492
505
|
html += '\n</body>'
|
493
506
|
|
rolling_pin/repo_etl.py
CHANGED
@@ -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.
|
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
|
rolling_pin/tools.py
CHANGED
@@ -38,18 +38,83 @@ COLOR_SCHEME = dict(
|
|
38
38
|
edge_module='#B6ECF3',
|
39
39
|
) # type: Dict[str, str]
|
40
40
|
|
41
|
+
|
42
|
+
PLOTLY_COLOR_SCHEME = dict(
|
43
|
+
bg='#242424',
|
44
|
+
blue1='#5F95DE',
|
45
|
+
blue2='#93B6E6',
|
46
|
+
cyan1='#7EC4CF',
|
47
|
+
cyan2='#B6ECF3',
|
48
|
+
dark1='#040404',
|
49
|
+
dark2='#141414',
|
50
|
+
dialog1='#444459',
|
51
|
+
dialog2='#5D5D7A',
|
52
|
+
green1='#8BD155',
|
53
|
+
green2='#A0D17B',
|
54
|
+
grey1='#343434',
|
55
|
+
grey2='#444444',
|
56
|
+
light1='#A4A4A4',
|
57
|
+
light2='#F4F4F4',
|
58
|
+
orange1='#EB9E58',
|
59
|
+
orange2='#EBB483',
|
60
|
+
purple1='#C98FDE',
|
61
|
+
purple2='#AC92DE',
|
62
|
+
red1='#F77E70',
|
63
|
+
red2='#DE958E',
|
64
|
+
yellow1='#E8EA7E',
|
65
|
+
yellow2='#E9EABE',
|
66
|
+
)
|
67
|
+
|
68
|
+
|
41
69
|
COLOR_SCALE = [
|
42
|
-
'
|
43
|
-
'
|
44
|
-
'#EBB483',
|
45
|
-
'#A0D17B',
|
46
|
-
'#93B6E6',
|
47
|
-
'#AC92DE',
|
48
|
-
'#E9EABE',
|
49
|
-
'#7EC4CF',
|
50
|
-
'#F77E70',
|
51
|
-
'#EB9E58',
|
70
|
+
'cyan2', 'red2', 'green2', 'blue2', 'orange2', 'purple2', 'yellow2',
|
71
|
+
'light2', 'cyan1', 'red1', 'green1', 'blue1'
|
52
72
|
] # type: List[str]
|
73
|
+
COLOR_SCALE = [PLOTLY_COLOR_SCHEME[x] for x in COLOR_SCALE]
|
74
|
+
|
75
|
+
|
76
|
+
PLOTLY_LAYOUT_THEME = {
|
77
|
+
'legend': {
|
78
|
+
'bgcolor': PLOTLY_COLOR_SCHEME['bg'],
|
79
|
+
'title': {'text': ''},
|
80
|
+
'font': {
|
81
|
+
'color': PLOTLY_COLOR_SCHEME['light2']
|
82
|
+
}
|
83
|
+
},
|
84
|
+
'paper_bgcolor': PLOTLY_COLOR_SCHEME['bg'],
|
85
|
+
'plot_bgcolor': PLOTLY_COLOR_SCHEME['bg'],
|
86
|
+
'title': {
|
87
|
+
'font': {
|
88
|
+
'color': PLOTLY_COLOR_SCHEME['light2']
|
89
|
+
}
|
90
|
+
},
|
91
|
+
'xaxis': {
|
92
|
+
'gridcolor': PLOTLY_COLOR_SCHEME['grey1'],
|
93
|
+
'showgrid': True,
|
94
|
+
'tickfont': {
|
95
|
+
'color': PLOTLY_COLOR_SCHEME['light1']
|
96
|
+
},
|
97
|
+
'title': {
|
98
|
+
'font': {
|
99
|
+
'color': PLOTLY_COLOR_SCHEME['light1']
|
100
|
+
}
|
101
|
+
},
|
102
|
+
'zerolinecolor': PLOTLY_COLOR_SCHEME['grey2']
|
103
|
+
},
|
104
|
+
'yaxis': {
|
105
|
+
'gridcolor': PLOTLY_COLOR_SCHEME['grey1'],
|
106
|
+
'showgrid': True,
|
107
|
+
'tickfont': {
|
108
|
+
'color': PLOTLY_COLOR_SCHEME['light1']
|
109
|
+
},
|
110
|
+
'title': {
|
111
|
+
'font': {
|
112
|
+
'color': PLOTLY_COLOR_SCHEME['light1']
|
113
|
+
}
|
114
|
+
},
|
115
|
+
'zerolinecolor': PLOTLY_COLOR_SCHEME['grey2']
|
116
|
+
}
|
117
|
+
}
|
53
118
|
|
54
119
|
|
55
120
|
# PREDICATE-FUNCTIONS-----------------------------------------------------------
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: rolling-pin
|
3
|
-
Version: 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
|
@@ -15,14 +15,14 @@ Classifier: Programming Language :: Python :: 3.8
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.9
|
16
16
|
Classifier: Typing :: Typed
|
17
17
|
Requires-Dist: click>=8.1.3
|
18
|
-
Requires-Dist: cufflinks
|
19
18
|
Requires-Dist: graphviz
|
20
19
|
Requires-Dist: ipython
|
21
20
|
Requires-Dist: lunchbox
|
22
21
|
Requires-Dist: networkx
|
23
|
-
Requires-Dist: numpy
|
22
|
+
Requires-Dist: numpy>=1.23.4
|
24
23
|
Requires-Dist: pandas>=1.1.5
|
25
|
-
Requires-Dist:
|
24
|
+
Requires-Dist: plotly>=5.22.0
|
25
|
+
Requires-Dist: pydot>=1.4.2
|
26
26
|
Requires-Dist: pyyaml
|
27
27
|
Requires-Dist: radon<6.0.0
|
28
28
|
Requires-Dist: schematics
|
@@ -0,0 +1,15 @@
|
|
1
|
+
rolling_pin/__init__.py,sha256=R_g0FYses--dTmvbZLtFFI-FPn4og6p8zmkEesYmN1A,511
|
2
|
+
rolling_pin/blob_etl.py,sha256=79eEeCZwPeJ8XwMlLp9-MywDwC-HlqMK-MJhksLrPdU,20712
|
3
|
+
rolling_pin/command.py,sha256=xaM3Zp516sS2iF8RWb6qwGpc_IYmIkwtzJ2vDK9zPZo,6477
|
4
|
+
rolling_pin/conform_config.py,sha256=W-Ps6FPuZ7SOxFOfEjIo2MZac1vCRuVky6samSZPQkw,2630
|
5
|
+
rolling_pin/conform_etl.py,sha256=VyHAKVvdOtjx6Fy8dWn6XMfNh9OFgBbidyDUnSl3Zl4,9594
|
6
|
+
rolling_pin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
rolling_pin/radon_etl.py,sha256=0rxFSnv2z41vKFe35XqCHSnnjT9qNNjouaCcIYkcHgI,18252
|
8
|
+
rolling_pin/repo_etl.py,sha256=Q6W-_4hTNh3nj5o9eTz5d7HuH5Kf9Uew8W9UD52dCJ0,21041
|
9
|
+
rolling_pin/toml_etl.py,sha256=fyioQTfqFW1e15qZ8F64sX379V5JzNlBKBuC5IPIgIo,4350
|
10
|
+
rolling_pin/tools.py,sha256=bLZGXDg5DuV59RxiVjLIwTAr83X5nMBElvR7w0mEnx8,19179
|
11
|
+
rolling_pin-0.10.1.dist-info/entry_points.txt,sha256=nbMiJnGLhp49xrtx1pjK8sJiBrwkpj2kq-ezp8Zfyyk,56
|
12
|
+
rolling_pin-0.10.1.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
|
13
|
+
rolling_pin-0.10.1.dist-info/METADATA,sha256=B7s0WHFa3vdPUKujCpbyGuA45FAmlphifDzmRDonhSM,20054
|
14
|
+
rolling_pin-0.10.1.dist-info/licenses/LICENSE,sha256=Z61vsRc9ZyRu0Tm3TkYgIeKDjUJCR3dT0hJonw9Q3i4,1067
|
15
|
+
rolling_pin-0.10.1.dist-info/RECORD,,
|
@@ -1,15 +0,0 @@
|
|
1
|
-
rolling_pin/__init__.py,sha256=R_g0FYses--dTmvbZLtFFI-FPn4og6p8zmkEesYmN1A,511
|
2
|
-
rolling_pin/blob_etl.py,sha256=79eEeCZwPeJ8XwMlLp9-MywDwC-HlqMK-MJhksLrPdU,20712
|
3
|
-
rolling_pin/command.py,sha256=xaM3Zp516sS2iF8RWb6qwGpc_IYmIkwtzJ2vDK9zPZo,6477
|
4
|
-
rolling_pin/conform_config.py,sha256=W-Ps6FPuZ7SOxFOfEjIo2MZac1vCRuVky6samSZPQkw,2630
|
5
|
-
rolling_pin/conform_etl.py,sha256=VyHAKVvdOtjx6Fy8dWn6XMfNh9OFgBbidyDUnSl3Zl4,9594
|
6
|
-
rolling_pin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
rolling_pin/radon_etl.py,sha256=SbGrRQM-exMBXiVmCL1ZThvxwLbZNL6URK6J97Ffdis,17681
|
8
|
-
rolling_pin/repo_etl.py,sha256=W3ms6zdK22A6d9kVzHLP3HE1h0fTPMUeXww0c57Nq-k,20479
|
9
|
-
rolling_pin/toml_etl.py,sha256=fyioQTfqFW1e15qZ8F64sX379V5JzNlBKBuC5IPIgIo,4350
|
10
|
-
rolling_pin/tools.py,sha256=Mt0BsOIhF-CC9mo-6JtNLPYjzJPdk3xgeAing0tZnQc,17498
|
11
|
-
rolling_pin-0.9.6.dist-info/entry_points.txt,sha256=nbMiJnGLhp49xrtx1pjK8sJiBrwkpj2kq-ezp8Zfyyk,56
|
12
|
-
rolling_pin-0.9.6.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
|
13
|
-
rolling_pin-0.9.6.dist-info/METADATA,sha256=0gCe3nfOtEw1Q7LOUI_2ORBfxMZm6LQiMcgcP2YkMDE,20057
|
14
|
-
rolling_pin-0.9.6.dist-info/licenses/LICENSE,sha256=Z61vsRc9ZyRu0Tm3TkYgIeKDjUJCR3dT0hJonw9Q3i4,1067
|
15
|
-
rolling_pin-0.9.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|