omdev 0.0.0.dev140__py3-none-any.whl → 0.0.0.dev142__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.
Potentially problematic release.
This version of omdev might be problematic. Click here for more details.
- omdev/.manifests.json +27 -15
- omdev/scripts/interp.py +13 -0
- omdev/scripts/pyproject.py +123 -86
- omdev/tools/cloc.py +149 -0
- omdev/{json → tools/json}/__main__.py +1 -1
- {omdev-0.0.0.dev140.dist-info → omdev-0.0.0.dev142.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev140.dist-info → omdev-0.0.0.dev142.dist-info}/RECORD +18 -17
- /omdev/{json → tools/json}/__init__.py +0 -0
- /omdev/{json → tools/json}/cli.py +0 -0
- /omdev/{json → tools/json}/formats.py +0 -0
- /omdev/{json → tools/json}/io.py +0 -0
- /omdev/{json → tools/json}/parsing.py +0 -0
- /omdev/{json → tools/json}/processing.py +0 -0
- /omdev/{json → tools/json}/rendering.py +0 -0
- {omdev-0.0.0.dev140.dist-info → omdev-0.0.0.dev142.dist-info}/LICENSE +0 -0
- {omdev-0.0.0.dev140.dist-info → omdev-0.0.0.dev142.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev140.dist-info → omdev-0.0.0.dev142.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev140.dist-info → omdev-0.0.0.dev142.dist-info}/top_level.txt +0 -0
omdev/.manifests.json
CHANGED
|
@@ -95,21 +95,6 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
{
|
|
99
|
-
"module": ".json.__main__",
|
|
100
|
-
"attr": "_CLI_MODULE",
|
|
101
|
-
"file": "omdev/json/__main__.py",
|
|
102
|
-
"line": 4,
|
|
103
|
-
"value": {
|
|
104
|
-
"$.cli.types.CliModule": {
|
|
105
|
-
"cmd_name": [
|
|
106
|
-
"json",
|
|
107
|
-
"j"
|
|
108
|
-
],
|
|
109
|
-
"mod_name": "omdev.json.__main__"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
98
|
{
|
|
114
99
|
"module": ".magic.find",
|
|
115
100
|
"attr": "_CLI_MODULE",
|
|
@@ -230,6 +215,18 @@
|
|
|
230
215
|
}
|
|
231
216
|
}
|
|
232
217
|
},
|
|
218
|
+
{
|
|
219
|
+
"module": ".tools.cloc",
|
|
220
|
+
"attr": "_CLI_MODULE",
|
|
221
|
+
"file": "omdev/tools/cloc.py",
|
|
222
|
+
"line": 144,
|
|
223
|
+
"value": {
|
|
224
|
+
"$.cli.types.CliModule": {
|
|
225
|
+
"cmd_name": "cloc",
|
|
226
|
+
"mod_name": "omdev.tools.cloc"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
233
230
|
{
|
|
234
231
|
"module": ".tools.doc",
|
|
235
232
|
"attr": "_CLI_MODULE",
|
|
@@ -278,6 +275,21 @@
|
|
|
278
275
|
}
|
|
279
276
|
}
|
|
280
277
|
},
|
|
278
|
+
{
|
|
279
|
+
"module": ".tools.json.__main__",
|
|
280
|
+
"attr": "_CLI_MODULE",
|
|
281
|
+
"file": "omdev/tools/json/__main__.py",
|
|
282
|
+
"line": 4,
|
|
283
|
+
"value": {
|
|
284
|
+
"$.cli.types.CliModule": {
|
|
285
|
+
"cmd_name": [
|
|
286
|
+
"json",
|
|
287
|
+
"j"
|
|
288
|
+
],
|
|
289
|
+
"mod_name": "omdev.tools.json.__main__"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
281
293
|
{
|
|
282
294
|
"module": ".tools.mkrelimp",
|
|
283
295
|
"attr": "_CLI_MODULE",
|
omdev/scripts/interp.py
CHANGED
|
@@ -63,6 +63,9 @@ UnparsedVersion = ta.Union['Version', str]
|
|
|
63
63
|
UnparsedVersionVar = ta.TypeVar('UnparsedVersionVar', bound=UnparsedVersion)
|
|
64
64
|
CallableVersionOperator = ta.Callable[['Version', str], bool]
|
|
65
65
|
|
|
66
|
+
# ../../omlish/lite/subprocesses.py
|
|
67
|
+
SubprocessChannelOption = ta.Literal['pipe', 'stdout', 'devnull']
|
|
68
|
+
|
|
66
69
|
|
|
67
70
|
########################################
|
|
68
71
|
# ../../packaging/versions.py
|
|
@@ -1659,6 +1662,16 @@ class Interp:
|
|
|
1659
1662
|
##
|
|
1660
1663
|
|
|
1661
1664
|
|
|
1665
|
+
SUBPROCESS_CHANNEL_OPTION_VALUES: ta.Mapping[SubprocessChannelOption, int] = {
|
|
1666
|
+
'pipe': subprocess.PIPE,
|
|
1667
|
+
'stdout': subprocess.STDOUT,
|
|
1668
|
+
'devnull': subprocess.DEVNULL,
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
##
|
|
1673
|
+
|
|
1674
|
+
|
|
1662
1675
|
_SUBPROCESS_SHELL_WRAP_EXECS = False
|
|
1663
1676
|
|
|
1664
1677
|
|
omdev/scripts/pyproject.py
CHANGED
|
@@ -101,6 +101,9 @@ UnparsedVersion = ta.Union['Version', str]
|
|
|
101
101
|
UnparsedVersionVar = ta.TypeVar('UnparsedVersionVar', bound=UnparsedVersion)
|
|
102
102
|
CallableVersionOperator = ta.Callable[['Version', str], bool]
|
|
103
103
|
|
|
104
|
+
# ../../omlish/lite/subprocesses.py
|
|
105
|
+
SubprocessChannelOption = ta.Literal['pipe', 'stdout', 'devnull']
|
|
106
|
+
|
|
104
107
|
|
|
105
108
|
########################################
|
|
106
109
|
# ../../magic/magic.py
|
|
@@ -3300,120 +3303,144 @@ _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES: ta.Dict[ta.Any, type] = {
|
|
|
3300
3303
|
}
|
|
3301
3304
|
|
|
3302
3305
|
|
|
3303
|
-
|
|
3304
|
-
ty: ta.Any,
|
|
3305
|
-
rec: ta.Callable[[ta.Any], ObjMarshaler],
|
|
3306
|
-
*,
|
|
3307
|
-
nonstrict_dataclasses: bool = False,
|
|
3308
|
-
) -> ObjMarshaler:
|
|
3309
|
-
if isinstance(ty, type):
|
|
3310
|
-
if abc.ABC in ty.__bases__:
|
|
3311
|
-
return PolymorphicObjMarshaler.of([ # type: ignore
|
|
3312
|
-
PolymorphicObjMarshaler.Impl(
|
|
3313
|
-
ity,
|
|
3314
|
-
ity.__qualname__,
|
|
3315
|
-
rec(ity),
|
|
3316
|
-
)
|
|
3317
|
-
for ity in deep_subclasses(ty)
|
|
3318
|
-
if abc.ABC not in ity.__bases__
|
|
3319
|
-
])
|
|
3320
|
-
|
|
3321
|
-
if issubclass(ty, enum.Enum):
|
|
3322
|
-
return EnumObjMarshaler(ty)
|
|
3323
|
-
|
|
3324
|
-
if dc.is_dataclass(ty):
|
|
3325
|
-
return DataclassObjMarshaler(
|
|
3326
|
-
ty,
|
|
3327
|
-
{f.name: rec(f.type) for f in dc.fields(ty)},
|
|
3328
|
-
nonstrict=nonstrict_dataclasses,
|
|
3329
|
-
)
|
|
3306
|
+
##
|
|
3330
3307
|
|
|
3331
|
-
if is_generic_alias(ty):
|
|
3332
|
-
try:
|
|
3333
|
-
mt = _OBJ_MARSHALER_GENERIC_MAPPING_TYPES[ta.get_origin(ty)]
|
|
3334
|
-
except KeyError:
|
|
3335
|
-
pass
|
|
3336
|
-
else:
|
|
3337
|
-
k, v = ta.get_args(ty)
|
|
3338
|
-
return MappingObjMarshaler(mt, rec(k), rec(v))
|
|
3339
3308
|
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
[
|
|
3346
|
-
|
|
3309
|
+
class ObjMarshalerManager:
|
|
3310
|
+
def __init__(
|
|
3311
|
+
self,
|
|
3312
|
+
*,
|
|
3313
|
+
default_obj_marshalers: ta.Dict[ta.Any, ObjMarshaler] = _DEFAULT_OBJ_MARSHALERS, # noqa
|
|
3314
|
+
generic_mapping_types: ta.Dict[ta.Any, type] = _OBJ_MARSHALER_GENERIC_MAPPING_TYPES, # noqa
|
|
3315
|
+
generic_iterable_types: ta.Dict[ta.Any, type] = _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES, # noqa
|
|
3316
|
+
) -> None:
|
|
3317
|
+
super().__init__()
|
|
3347
3318
|
|
|
3348
|
-
|
|
3349
|
-
|
|
3319
|
+
self._obj_marshalers = dict(default_obj_marshalers)
|
|
3320
|
+
self._generic_mapping_types = generic_mapping_types
|
|
3321
|
+
self._generic_iterable_types = generic_iterable_types
|
|
3350
3322
|
|
|
3351
|
-
|
|
3323
|
+
self._lock = threading.RLock()
|
|
3324
|
+
self._marshalers: ta.Dict[ta.Any, ObjMarshaler] = dict(_DEFAULT_OBJ_MARSHALERS)
|
|
3325
|
+
self._proxies: ta.Dict[ta.Any, ProxyObjMarshaler] = {}
|
|
3352
3326
|
|
|
3327
|
+
#
|
|
3353
3328
|
|
|
3354
|
-
|
|
3329
|
+
def make_obj_marshaler(
|
|
3330
|
+
self,
|
|
3331
|
+
ty: ta.Any,
|
|
3332
|
+
rec: ta.Callable[[ta.Any], ObjMarshaler],
|
|
3333
|
+
*,
|
|
3334
|
+
nonstrict_dataclasses: bool = False,
|
|
3335
|
+
) -> ObjMarshaler:
|
|
3336
|
+
if isinstance(ty, type):
|
|
3337
|
+
if abc.ABC in ty.__bases__:
|
|
3338
|
+
return PolymorphicObjMarshaler.of([ # type: ignore
|
|
3339
|
+
PolymorphicObjMarshaler.Impl(
|
|
3340
|
+
ity,
|
|
3341
|
+
ity.__qualname__,
|
|
3342
|
+
rec(ity),
|
|
3343
|
+
)
|
|
3344
|
+
for ity in deep_subclasses(ty)
|
|
3345
|
+
if abc.ABC not in ity.__bases__
|
|
3346
|
+
])
|
|
3347
|
+
|
|
3348
|
+
if issubclass(ty, enum.Enum):
|
|
3349
|
+
return EnumObjMarshaler(ty)
|
|
3350
|
+
|
|
3351
|
+
if dc.is_dataclass(ty):
|
|
3352
|
+
return DataclassObjMarshaler(
|
|
3353
|
+
ty,
|
|
3354
|
+
{f.name: rec(f.type) for f in dc.fields(ty)},
|
|
3355
|
+
nonstrict=nonstrict_dataclasses,
|
|
3356
|
+
)
|
|
3355
3357
|
|
|
3358
|
+
if is_generic_alias(ty):
|
|
3359
|
+
try:
|
|
3360
|
+
mt = self._generic_mapping_types[ta.get_origin(ty)]
|
|
3361
|
+
except KeyError:
|
|
3362
|
+
pass
|
|
3363
|
+
else:
|
|
3364
|
+
k, v = ta.get_args(ty)
|
|
3365
|
+
return MappingObjMarshaler(mt, rec(k), rec(v))
|
|
3356
3366
|
|
|
3357
|
-
|
|
3367
|
+
try:
|
|
3368
|
+
st = self._generic_iterable_types[ta.get_origin(ty)]
|
|
3369
|
+
except KeyError:
|
|
3370
|
+
pass
|
|
3371
|
+
else:
|
|
3372
|
+
[e] = ta.get_args(ty)
|
|
3373
|
+
return IterableObjMarshaler(st, rec(e))
|
|
3358
3374
|
|
|
3359
|
-
|
|
3375
|
+
if is_union_alias(ty):
|
|
3376
|
+
return OptionalObjMarshaler(rec(get_optional_alias_arg(ty)))
|
|
3360
3377
|
|
|
3361
|
-
|
|
3378
|
+
raise TypeError(ty)
|
|
3362
3379
|
|
|
3380
|
+
#
|
|
3363
3381
|
|
|
3364
|
-
def register_opj_marshaler(ty: ta.Any, m: ObjMarshaler) -> None:
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3382
|
+
def register_opj_marshaler(self, ty: ta.Any, m: ObjMarshaler) -> None:
|
|
3383
|
+
with self._lock:
|
|
3384
|
+
if ty in self._obj_marshalers:
|
|
3385
|
+
raise KeyError(ty)
|
|
3386
|
+
self._obj_marshalers[ty] = m
|
|
3369
3387
|
|
|
3388
|
+
def get_obj_marshaler(
|
|
3389
|
+
self,
|
|
3390
|
+
ty: ta.Any,
|
|
3391
|
+
*,
|
|
3392
|
+
no_cache: bool = False,
|
|
3393
|
+
**kwargs: ta.Any,
|
|
3394
|
+
) -> ObjMarshaler:
|
|
3395
|
+
with self._lock:
|
|
3396
|
+
if not no_cache:
|
|
3397
|
+
try:
|
|
3398
|
+
return self._obj_marshalers[ty]
|
|
3399
|
+
except KeyError:
|
|
3400
|
+
pass
|
|
3370
3401
|
|
|
3371
|
-
def get_obj_marshaler(
|
|
3372
|
-
ty: ta.Any,
|
|
3373
|
-
*,
|
|
3374
|
-
no_cache: bool = False,
|
|
3375
|
-
**kwargs: ta.Any,
|
|
3376
|
-
) -> ObjMarshaler:
|
|
3377
|
-
with _OBJ_MARSHALERS_LOCK:
|
|
3378
|
-
if not no_cache:
|
|
3379
3402
|
try:
|
|
3380
|
-
return
|
|
3403
|
+
return self._proxies[ty]
|
|
3381
3404
|
except KeyError:
|
|
3382
3405
|
pass
|
|
3383
3406
|
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3407
|
+
rec = functools.partial(
|
|
3408
|
+
self.get_obj_marshaler,
|
|
3409
|
+
no_cache=no_cache,
|
|
3410
|
+
**kwargs,
|
|
3411
|
+
)
|
|
3388
3412
|
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3413
|
+
p = ProxyObjMarshaler()
|
|
3414
|
+
self._proxies[ty] = p
|
|
3415
|
+
try:
|
|
3416
|
+
m = self.make_obj_marshaler(ty, rec, **kwargs)
|
|
3417
|
+
finally:
|
|
3418
|
+
del self._proxies[ty]
|
|
3419
|
+
p.m = m
|
|
3394
3420
|
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
del _OBJ_MARSHALER_PROXIES[ty]
|
|
3401
|
-
p.m = m
|
|
3421
|
+
if not no_cache:
|
|
3422
|
+
self._obj_marshalers[ty] = m
|
|
3423
|
+
return m
|
|
3424
|
+
|
|
3425
|
+
#
|
|
3402
3426
|
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3427
|
+
def marshal_obj(self, o: ta.Any, ty: ta.Any = None) -> ta.Any:
|
|
3428
|
+
return self.get_obj_marshaler(ty if ty is not None else type(o)).marshal(o)
|
|
3429
|
+
|
|
3430
|
+
def unmarshal_obj(self, o: ta.Any, ty: ta.Union[ta.Type[T], ta.Any]) -> T:
|
|
3431
|
+
return self.get_obj_marshaler(ty).unmarshal(o)
|
|
3406
3432
|
|
|
3407
3433
|
|
|
3408
3434
|
##
|
|
3409
3435
|
|
|
3410
3436
|
|
|
3411
|
-
|
|
3412
|
-
return get_obj_marshaler(ty if ty is not None else type(o)).marshal(o)
|
|
3437
|
+
OBJ_MARSHALER_MANAGER = ObjMarshalerManager()
|
|
3413
3438
|
|
|
3439
|
+
register_opj_marshaler = OBJ_MARSHALER_MANAGER.register_opj_marshaler
|
|
3440
|
+
get_obj_marshaler = OBJ_MARSHALER_MANAGER.get_obj_marshaler
|
|
3414
3441
|
|
|
3415
|
-
|
|
3416
|
-
|
|
3442
|
+
marshal_obj = OBJ_MARSHALER_MANAGER.marshal_obj
|
|
3443
|
+
unmarshal_obj = OBJ_MARSHALER_MANAGER.unmarshal_obj
|
|
3417
3444
|
|
|
3418
3445
|
|
|
3419
3446
|
########################################
|
|
@@ -3706,6 +3733,16 @@ class RequirementsRewriter:
|
|
|
3706
3733
|
##
|
|
3707
3734
|
|
|
3708
3735
|
|
|
3736
|
+
SUBPROCESS_CHANNEL_OPTION_VALUES: ta.Mapping[SubprocessChannelOption, int] = {
|
|
3737
|
+
'pipe': subprocess.PIPE,
|
|
3738
|
+
'stdout': subprocess.STDOUT,
|
|
3739
|
+
'devnull': subprocess.DEVNULL,
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
|
|
3743
|
+
##
|
|
3744
|
+
|
|
3745
|
+
|
|
3709
3746
|
_SUBPROCESS_SHELL_WRAP_EXECS = False
|
|
3710
3747
|
|
|
3711
3748
|
|
omdev/tools/cloc.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import dataclasses as dc
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
import typing as ta
|
|
5
|
+
|
|
6
|
+
from ..cli import CliModule
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
SUPPORTED_EXTENSIONS: ta.Mapping[str, str] = {
|
|
10
|
+
'.c': 'c',
|
|
11
|
+
'.cpp': 'c',
|
|
12
|
+
'.h': 'c',
|
|
13
|
+
'.hpp': 'c',
|
|
14
|
+
'.py': 'python',
|
|
15
|
+
'.js': 'javascript',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
COMMENT_PATTERNS: ta.Mapping[str, tuple[str, str | None, str | None]] = {
|
|
20
|
+
'c': (r'//', r'/\*', r'\*/'),
|
|
21
|
+
'python': (r'#', None, None),
|
|
22
|
+
'javascript': (r'//', r'/\*', r'\*/'),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dc.dataclass(frozen=True)
|
|
27
|
+
class FileLineCount:
|
|
28
|
+
loc: int
|
|
29
|
+
blanks: int
|
|
30
|
+
comments: int
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def count_lines(file_path: str, language: str) -> FileLineCount:
|
|
34
|
+
single_line_comment, block_comment_start, block_comment_end = COMMENT_PATTERNS[language]
|
|
35
|
+
|
|
36
|
+
in_block_comment = False
|
|
37
|
+
|
|
38
|
+
loc = 0
|
|
39
|
+
blank_lines = 0
|
|
40
|
+
comment_lines = 0
|
|
41
|
+
|
|
42
|
+
with open(file_path, encoding='utf-8') as file:
|
|
43
|
+
for line in file:
|
|
44
|
+
stripped = line.strip()
|
|
45
|
+
if not stripped:
|
|
46
|
+
blank_lines += 1
|
|
47
|
+
continue
|
|
48
|
+
|
|
49
|
+
if in_block_comment:
|
|
50
|
+
comment_lines += 1
|
|
51
|
+
if block_comment_end and re.search(block_comment_end, stripped):
|
|
52
|
+
in_block_comment = False
|
|
53
|
+
continue
|
|
54
|
+
|
|
55
|
+
if block_comment_start and re.search(block_comment_start, stripped):
|
|
56
|
+
comment_lines += 1
|
|
57
|
+
if block_comment_end and not re.search(block_comment_end, stripped):
|
|
58
|
+
in_block_comment = True
|
|
59
|
+
continue
|
|
60
|
+
|
|
61
|
+
if single_line_comment and stripped.startswith(single_line_comment):
|
|
62
|
+
comment_lines += 1
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
loc += 1
|
|
66
|
+
|
|
67
|
+
return FileLineCount(
|
|
68
|
+
loc=loc,
|
|
69
|
+
blanks=blank_lines,
|
|
70
|
+
comments=comment_lines,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def count_lines_in_directory(directory: str) -> ta.Mapping[str, FileLineCount]:
|
|
75
|
+
results: dict[str, FileLineCount] = {}
|
|
76
|
+
for root, _, files in os.walk(directory):
|
|
77
|
+
for file in files:
|
|
78
|
+
ext = os.path.splitext(file)[1]
|
|
79
|
+
if ext in SUPPORTED_EXTENSIONS:
|
|
80
|
+
language = SUPPORTED_EXTENSIONS[ext]
|
|
81
|
+
file_path = os.path.join(root, file)
|
|
82
|
+
results[file_path] = count_lines(file_path, language)
|
|
83
|
+
return results
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def display_results(results: ta.Mapping[str, FileLineCount]) -> None:
|
|
87
|
+
total_loc = total_blanks = total_comments = 0
|
|
88
|
+
file_width = max(map(len, results))
|
|
89
|
+
dash_width = 41 + file_width
|
|
90
|
+
|
|
91
|
+
print(
|
|
92
|
+
f"{'File'.ljust(file_width)} "
|
|
93
|
+
f"{'LOC':<10} "
|
|
94
|
+
f"{'Blank Lines':<15} "
|
|
95
|
+
f"{'Comment Lines':<15}",
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
print('-' * dash_width)
|
|
99
|
+
|
|
100
|
+
for file, counts in sorted(results.items()):
|
|
101
|
+
loc, blanks, comments = counts.loc, counts.blanks, counts.comments
|
|
102
|
+
total_loc += loc
|
|
103
|
+
total_blanks += blanks
|
|
104
|
+
total_comments += comments
|
|
105
|
+
print(
|
|
106
|
+
f'{file.ljust(file_width)} '
|
|
107
|
+
f'{loc:<10} '
|
|
108
|
+
f'{blanks:<15} '
|
|
109
|
+
f'{comments:<15}',
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
print('-' * dash_width)
|
|
113
|
+
|
|
114
|
+
print(
|
|
115
|
+
f"{' ' * file_width} "
|
|
116
|
+
f"{'LOC':<10} "
|
|
117
|
+
f"{'Blank Lines':<15} "
|
|
118
|
+
f"{'Comment Lines':<15}",
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
print('-' * dash_width)
|
|
122
|
+
|
|
123
|
+
print(
|
|
124
|
+
f"{'Total'.ljust(file_width)} "
|
|
125
|
+
f"{total_loc:<10} "
|
|
126
|
+
f"{total_blanks:<15} "
|
|
127
|
+
f"{total_comments:<15}",
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _main() -> None:
|
|
132
|
+
import argparse
|
|
133
|
+
|
|
134
|
+
parser = argparse.ArgumentParser(description='Count lines of code in source files.')
|
|
135
|
+
parser.add_argument('directory', help='The directory to analyze.', nargs='+')
|
|
136
|
+
args = parser.parse_args()
|
|
137
|
+
|
|
138
|
+
for directory in args.directory:
|
|
139
|
+
results = count_lines_in_directory(directory)
|
|
140
|
+
display_results(results)
|
|
141
|
+
print()
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# @omlish-manifest
|
|
145
|
+
_CLI_MODULE = CliModule('cloc', __name__)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if __name__ == '__main__':
|
|
149
|
+
_main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev142
|
|
4
4
|
Summary: omdev
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
13
|
Requires-Python: >=3.12
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omlish==0.0.0.dev142
|
|
16
16
|
Provides-Extra: all
|
|
17
17
|
Requires-Dist: black~=24.10; extra == "all"
|
|
18
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
omdev/.manifests.json,sha256=
|
|
1
|
+
omdev/.manifests.json,sha256=Uq3VB0ovogq663SM_1fuRBjqbod7kE30wNxBByQI2zo,8033
|
|
2
2
|
omdev/__about__.py,sha256=n5x-SO70OgbDQFzQ1d7sZDVMsnkQc4PxQZPFaIQFa0E,1281
|
|
3
3
|
omdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
omdev/bracepy.py,sha256=I8EdqtDvxzAi3I8TuMEW-RBfwXfqKbwp06CfOdj3L1o,2743
|
|
@@ -79,14 +79,6 @@ omdev/interp/resolvers.py,sha256=tpzlmqGp1C4QKdA6TfcPmtmaygu7mb6WK2RPSbyNQ6s,302
|
|
|
79
79
|
omdev/interp/standalone.py,sha256=XcltiL7ypcfV89C82_3knQ3Kx7aW4wnnxf2056ZXC3A,7731
|
|
80
80
|
omdev/interp/system.py,sha256=bI-JhX4GVJqW7wMxnIa-DGJWnCLmFcIsnl9pc1RGY2g,3513
|
|
81
81
|
omdev/interp/types.py,sha256=EMN3StEMkFoQAMUIZd7JYL4uUWqzFGY-2hTL8EBznYM,2437
|
|
82
|
-
omdev/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
83
|
-
omdev/json/__main__.py,sha256=A2NlzsXebLuA0Zw6sikwM_tXZsyBYf33Q8qpNhtaY5o,167
|
|
84
|
-
omdev/json/cli.py,sha256=EubIMT-n2XsjWBZjSy2fWXqijlwrIhLsfbkg3SZzi28,9586
|
|
85
|
-
omdev/json/formats.py,sha256=XHabWAQnAQ9uNS7fHu3mdgxoptWw00RVLq08uadD6kk,1753
|
|
86
|
-
omdev/json/io.py,sha256=IoJ5asjS_gUan5TcrGgS0KpJaiSE5YQgEGljFMCcDto,1427
|
|
87
|
-
omdev/json/parsing.py,sha256=QLsdYv-fRFNIWwy8KLr19fQ5RodiQEX2hIw4jndnEXM,2180
|
|
88
|
-
omdev/json/processing.py,sha256=iFm5VqaxJ97WHaun2ed7NEjMxhFeJqf28bLNfoDJft0,1209
|
|
89
|
-
omdev/json/rendering.py,sha256=jNShMfCpFR9-Kcn6cUFuOChXHjg71diuTC4x7Ofmz-o,2240
|
|
90
82
|
omdev/magic/__init__.py,sha256=CBzRB71RLyylkrj8dph6JUEddA8KSMJvDgriHqFfJGU,478
|
|
91
83
|
omdev/magic/find.py,sha256=tTmpWXAleaXG3_kNOsRF7s8D0CpYMXbdz6-HbCNBW90,7070
|
|
92
84
|
omdev/magic/magic.py,sha256=h1nxoW6CV1MRCiHjDt3sO4kmG0qTtTRbkDNiPLGo2BE,224
|
|
@@ -130,14 +122,15 @@ omdev/scripts/bumpversion.py,sha256=Kn7fo73Hs8uJh3Hi3EIyLOlzLPWAC6dwuD_lZ3cIzuY,
|
|
|
130
122
|
omdev/scripts/execrss.py,sha256=mR0G0wERBYtQmVIn63lCIIFb5zkCM6X_XOENDFYDBKc,651
|
|
131
123
|
omdev/scripts/exectime.py,sha256=sFb376GflU6s9gNX-2-we8hgH6w5MuQNS9g6i4SqJIo,610
|
|
132
124
|
omdev/scripts/importtrace.py,sha256=oa7CtcWJVMNDbyIEiRHej6ICfABfErMeo4_haIqe18Q,14041
|
|
133
|
-
omdev/scripts/interp.py,sha256=
|
|
134
|
-
omdev/scripts/pyproject.py,sha256=
|
|
125
|
+
omdev/scripts/interp.py,sha256=cJQYbRsx2Qf05itHg4iUNlGjcuqWeM-86RDbaZ6Mjco,74241
|
|
126
|
+
omdev/scripts/pyproject.py,sha256=XJ3cXjavrTvpuhwHYKH5CBaiQG52R9i1Lm72G3rdGm8,176910
|
|
135
127
|
omdev/scripts/slowcat.py,sha256=lssv4yrgJHiWfOiHkUut2p8E8Tq32zB-ujXESQxFFHY,2728
|
|
136
128
|
omdev/scripts/tmpexec.py,sha256=WTYcf56Tj2qjYV14AWmV8SfT0u6Y8eIU6cKgQRvEK3c,1442
|
|
137
129
|
omdev/toml/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
|
138
130
|
omdev/toml/parser.py,sha256=ojhCYIk23ELRx2f9xUCwLTRq13UM6wrYGWoyxZBurlo,29327
|
|
139
131
|
omdev/toml/writer.py,sha256=lk3on3YXVbWuLJa-xsOzOhs1bBAT1vXqw4mBbluZl_w,3040
|
|
140
132
|
omdev/tools/__init__.py,sha256=iVJAOQ0viGTQOm0DLX4uZLro-9jOioYJGLg9s0kDx1A,78
|
|
133
|
+
omdev/tools/cloc.py,sha256=13lUsYLyn1LoelhsCeKrRkIwwPE0x54JmdhXJ_lvWh0,3811
|
|
141
134
|
omdev/tools/doc.py,sha256=mv9XfitzqXl3vFHSenv01xHCxWf8g03rUAb_sqoty98,2556
|
|
142
135
|
omdev/tools/docker.py,sha256=k2BrVvFYwyGov064CPHd_HWo9aqR1zHc2UeEsVwPth4,6827
|
|
143
136
|
omdev/tools/git.py,sha256=bfhYUFip7zVxtsyXk8yEFbK2y2zguhvgraLhXc7A53M,6899
|
|
@@ -148,12 +141,20 @@ omdev/tools/pip.py,sha256=cRYKRCjuMI9SR1CBORBbOCePyildLiCIMCECvBDY61E,3471
|
|
|
148
141
|
omdev/tools/prof.py,sha256=KmnPInf8JYXtkXyCl2CucTPfxzCUoM605SA8NLHrWrY,1467
|
|
149
142
|
omdev/tools/qr.py,sha256=tm68lPwEAkEwIL2sUKPKBYfwwPtjVWG1DBZwur8_jY8,1737
|
|
150
143
|
omdev/tools/sqlrepl.py,sha256=tmFZh80-xsGM62dyQ7_UGLebChrj7IHbIPYBWDJMgVk,5741
|
|
144
|
+
omdev/tools/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
145
|
+
omdev/tools/json/__main__.py,sha256=wqpkN_NsQyNwKW4qjVj8ADJ4_C98KhrFBtE-Z1UamfU,168
|
|
146
|
+
omdev/tools/json/cli.py,sha256=EubIMT-n2XsjWBZjSy2fWXqijlwrIhLsfbkg3SZzi28,9586
|
|
147
|
+
omdev/tools/json/formats.py,sha256=XHabWAQnAQ9uNS7fHu3mdgxoptWw00RVLq08uadD6kk,1753
|
|
148
|
+
omdev/tools/json/io.py,sha256=IoJ5asjS_gUan5TcrGgS0KpJaiSE5YQgEGljFMCcDto,1427
|
|
149
|
+
omdev/tools/json/parsing.py,sha256=QLsdYv-fRFNIWwy8KLr19fQ5RodiQEX2hIw4jndnEXM,2180
|
|
150
|
+
omdev/tools/json/processing.py,sha256=iFm5VqaxJ97WHaun2ed7NEjMxhFeJqf28bLNfoDJft0,1209
|
|
151
|
+
omdev/tools/json/rendering.py,sha256=jNShMfCpFR9-Kcn6cUFuOChXHjg71diuTC4x7Ofmz-o,2240
|
|
151
152
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
152
153
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
|
153
154
|
omdev/tools/pawk/pawk.py,sha256=Eckymn22GfychCQcQi96BFqRo_LmiJ-EPhC8TTUJdB4,11446
|
|
154
|
-
omdev-0.0.0.
|
|
155
|
-
omdev-0.0.0.
|
|
156
|
-
omdev-0.0.0.
|
|
157
|
-
omdev-0.0.0.
|
|
158
|
-
omdev-0.0.0.
|
|
159
|
-
omdev-0.0.0.
|
|
155
|
+
omdev-0.0.0.dev142.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
|
156
|
+
omdev-0.0.0.dev142.dist-info/METADATA,sha256=vIeFYVEB7oIe35hTR-g4SVT5Qg30RiWFC0cj4BplvQk,1760
|
|
157
|
+
omdev-0.0.0.dev142.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
158
|
+
omdev-0.0.0.dev142.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
|
159
|
+
omdev-0.0.0.dev142.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
|
160
|
+
omdev-0.0.0.dev142.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/omdev/{json → tools/json}/io.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|