dycw-pre-commit-hooks 0.12.8__py3-none-any.whl → 0.14.39__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.
Files changed (42) hide show
  1. dycw_pre_commit_hooks-0.14.39.dist-info/METADATA +57 -0
  2. dycw_pre_commit_hooks-0.14.39.dist-info/RECORD +28 -0
  3. {dycw_pre_commit_hooks-0.12.8.dist-info → dycw_pre_commit_hooks-0.14.39.dist-info}/WHEEL +1 -1
  4. dycw_pre_commit_hooks-0.14.39.dist-info/entry_points.txt +19 -0
  5. pre_commit_hooks/__init__.py +1 -1
  6. pre_commit_hooks/configs/gitignore +243 -0
  7. pre_commit_hooks/constants.py +166 -0
  8. pre_commit_hooks/hooks/__init__.py +1 -0
  9. pre_commit_hooks/hooks/add_future_import_annotations.py +63 -0
  10. pre_commit_hooks/hooks/add_hooks.py +785 -0
  11. pre_commit_hooks/hooks/check_version_bumped.py +37 -0
  12. pre_commit_hooks/hooks/check_versions_consistent.py +42 -0
  13. pre_commit_hooks/hooks/format_pre_commit_config.py +70 -0
  14. pre_commit_hooks/hooks/format_requirements.py +56 -0
  15. pre_commit_hooks/{replace_sequence_str/__init__.py → hooks/replace_sequence_str.py} +25 -19
  16. pre_commit_hooks/hooks/run_prek_autoupdate.py +56 -0
  17. pre_commit_hooks/hooks/run_version_bump.py +48 -0
  18. pre_commit_hooks/hooks/setup_bump_my_version.py +99 -0
  19. pre_commit_hooks/hooks/setup_direnv.py +142 -0
  20. pre_commit_hooks/hooks/setup_git.py +40 -0
  21. pre_commit_hooks/hooks/setup_pyright.py +82 -0
  22. pre_commit_hooks/hooks/setup_ruff.py +129 -0
  23. pre_commit_hooks/hooks/update_ci_action_versions.py +47 -0
  24. pre_commit_hooks/hooks/update_ci_extensions.py +34 -0
  25. pre_commit_hooks/hooks/update_requirements.py +165 -0
  26. pre_commit_hooks/types.py +18 -0
  27. pre_commit_hooks/utilities.py +599 -0
  28. dycw_pre_commit_hooks-0.12.8.dist-info/METADATA +0 -46
  29. dycw_pre_commit_hooks-0.12.8.dist-info/RECORD +0 -19
  30. dycw_pre_commit_hooks-0.12.8.dist-info/entry_points.txt +0 -7
  31. pre_commit_hooks/check_submodules/__init__.py +0 -50
  32. pre_commit_hooks/check_submodules/__main__.py +0 -6
  33. pre_commit_hooks/common.py +0 -131
  34. pre_commit_hooks/format_requirements/__init__.py +0 -107
  35. pre_commit_hooks/format_requirements/__main__.py +0 -6
  36. pre_commit_hooks/mirror_files/__init__.py +0 -57
  37. pre_commit_hooks/mirror_files/__main__.py +0 -6
  38. pre_commit_hooks/replace_sequence_str/__main__.py +0 -6
  39. pre_commit_hooks/run_bump_my_version/__init__.py +0 -53
  40. pre_commit_hooks/run_bump_my_version/__main__.py +0 -6
  41. pre_commit_hooks/tag_commits/__init__.py +0 -103
  42. pre_commit_hooks/tag_commits/__main__.py +0 -6
@@ -0,0 +1,599 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from collections.abc import Iterator, MutableSet
5
+ from contextlib import contextmanager, suppress
6
+ from dataclasses import dataclass
7
+ from functools import partial
8
+ from pathlib import Path
9
+ from subprocess import CalledProcessError
10
+ from typing import TYPE_CHECKING, Any, assert_never, overload
11
+
12
+ import tomlkit
13
+ import yaml
14
+ from libcst import Module, parse_module
15
+ from tomlkit import TOMLDocument, aot, array, document, string, table
16
+ from tomlkit.exceptions import ParseError
17
+ from tomlkit.items import AoT, Array, Table
18
+ from utilities.atomicwrites import writer
19
+ from utilities.concurrent import concurrent_map
20
+ from utilities.functions import ensure_class, ensure_str
21
+ from utilities.iterables import OneEmptyError, one
22
+ from utilities.packaging import Requirement
23
+ from utilities.subprocess import run
24
+ from utilities.types import PathLike, StrDict
25
+ from utilities.typing import is_str_dict
26
+ from utilities.version import Version3, Version3Error
27
+
28
+ from pre_commit_hooks.constants import BUMPVERSION_TOML, PATH_CACHE, PYPROJECT_TOML
29
+
30
+ if TYPE_CHECKING:
31
+ from collections.abc import Callable, Iterable, Iterator, MutableSet
32
+
33
+ from utilities.types import PathLike, StrDict
34
+
35
+ from pre_commit_hooks.types import (
36
+ ArrayLike,
37
+ ContainerLike,
38
+ FuncRequirement,
39
+ TransformArray,
40
+ )
41
+
42
+
43
+ def apply[T](func: Callable[[], T], /) -> T:
44
+ return func()
45
+
46
+
47
+ ##
48
+
49
+
50
+ def are_equal_modulo_new_line(x: str, y: str, /) -> bool:
51
+ return ensure_new_line(x) == ensure_new_line(y)
52
+
53
+
54
+ ##
55
+
56
+
57
+ @overload
58
+ def ensure_contains(container: AoT, /, *objs: Table) -> None: ...
59
+ @overload
60
+ def ensure_contains(container: list[str], /, *objs: str) -> None: ...
61
+ @overload
62
+ def ensure_contains(container: list[StrDict], /, *objs: StrDict) -> None: ...
63
+ def ensure_contains(container: ArrayLike, /, *objs: Any) -> None:
64
+ for obj in objs:
65
+ if obj not in container:
66
+ container.append(obj)
67
+
68
+
69
+ def ensure_contains_partial_dict(
70
+ container: list[StrDict], partial: StrDict, /, *, extra: StrDict | None = None
71
+ ) -> StrDict:
72
+ try:
73
+ return get_partial_dict(container, partial)
74
+ except OneEmptyError:
75
+ dict_ = partial | ({} if extra is None else extra)
76
+ container.append(dict_)
77
+ return dict_
78
+
79
+
80
+ def ensure_contains_partial_str(list_: Array | list[str], text: str, /) -> str:
81
+ try:
82
+ return get_partial_str(list_, text)
83
+ except OneEmptyError:
84
+ list_.append(text)
85
+ return text
86
+
87
+
88
+ @overload
89
+ def ensure_not_contains(container: AoT, /, *objs: Table) -> None: ...
90
+ @overload
91
+ def ensure_not_contains(container: list[str], /, *objs: str) -> None: ...
92
+ @overload
93
+ def ensure_not_contains(container: list[StrDict], /, *objs: StrDict) -> None: ...
94
+ def ensure_not_contains(container: ArrayLike, /, *objs: Any) -> None:
95
+ for obj in objs:
96
+ try:
97
+ index = next(i for i, o in enumerate(container) if o == obj)
98
+ except StopIteration:
99
+ pass
100
+ else:
101
+ del container[index]
102
+
103
+
104
+ ##
105
+
106
+
107
+ def ensure_new_line(text: str, /) -> str:
108
+ return text.strip("\n") + "\n"
109
+
110
+
111
+ ##
112
+
113
+
114
+ def get_aot(container: ContainerLike, key: str, /) -> AoT:
115
+ return ensure_class(container[key], AoT)
116
+
117
+
118
+ def get_array(container: ContainerLike, key: str, /) -> Array:
119
+ return ensure_class(container[key], Array)
120
+
121
+
122
+ def get_dict(dict_: StrDict, key: str, /) -> StrDict:
123
+ if is_str_dict(value := dict_[key]):
124
+ return value
125
+ raise TypeError(value)
126
+
127
+
128
+ def get_list_dicts(dict_: StrDict, key: str, /) -> list[StrDict]:
129
+ list_ = ensure_class(dict_[key], list)
130
+ for i in list_:
131
+ if not is_str_dict(i):
132
+ raise TypeError(i)
133
+ return list_
134
+
135
+
136
+ def get_list_strs(dict_: StrDict, key: str, /) -> list[str]:
137
+ list_ = ensure_class(dict_[key], list)
138
+ for i in list_:
139
+ if not isinstance(i, str):
140
+ raise TypeError(i)
141
+ return list_
142
+
143
+
144
+ def get_table(container: ContainerLike, key: str, /) -> Table:
145
+ return ensure_class(container[key], Table)
146
+
147
+
148
+ ##
149
+
150
+
151
+ def get_set_aot(container: ContainerLike, key: str, /) -> AoT:
152
+ try:
153
+ return get_aot(container, key)
154
+ except KeyError:
155
+ value = container[key] = aot()
156
+ return value
157
+
158
+
159
+ def get_set_array(container: ContainerLike, key: str, /) -> Array:
160
+ try:
161
+ return get_array(container, key)
162
+ except KeyError:
163
+ value = container[key] = array()
164
+ return value
165
+
166
+
167
+ def get_set_dict(dict_: StrDict, key: str, /) -> StrDict:
168
+ try:
169
+ return get_dict(dict_, key)
170
+ except KeyError:
171
+ value = dict_[key] = {}
172
+ return value
173
+
174
+
175
+ def get_set_list_dicts(dict_: StrDict, key: str, /) -> list[StrDict]:
176
+ try:
177
+ return get_list_dicts(dict_, key)
178
+ except KeyError:
179
+ value = dict_[key] = []
180
+ return value
181
+
182
+
183
+ def get_set_list_strs(dict_: StrDict, key: str, /) -> list[str]:
184
+ try:
185
+ return get_list_strs(dict_, key)
186
+ except KeyError:
187
+ value = dict_[key] = []
188
+ return value
189
+
190
+
191
+ def get_set_table(container: ContainerLike, key: str, /) -> Table:
192
+ try:
193
+ return get_table(container, key)
194
+ except KeyError:
195
+ value = container[key] = table()
196
+ return value
197
+
198
+
199
+ ##
200
+
201
+
202
+ def get_partial_dict(iterable: Iterable[StrDict], dict_: StrDict, /) -> StrDict:
203
+ return one(i for i in iterable if _is_partial_dict(dict_, i))
204
+
205
+
206
+ def _is_partial_dict(obj: Any, dict_: StrDict, /) -> bool:
207
+ if not isinstance(obj, dict):
208
+ return False
209
+ results: dict[str, bool] = {}
210
+ for key, obj_value in obj.items():
211
+ try:
212
+ dict_value = dict_[key]
213
+ except KeyError:
214
+ results[key] = False
215
+ else:
216
+ if isinstance(obj_value, dict) and isinstance(dict_value, dict):
217
+ results[key] = _is_partial_dict(obj_value, dict_value)
218
+ else:
219
+ results[key] = obj_value == dict_value
220
+ return all(results.values())
221
+
222
+
223
+ ##
224
+
225
+
226
+ def get_partial_str(iterable: Iterable[Any], text: str, /) -> str:
227
+ return one(i for i in iterable if _is_partial_str(i, text))
228
+
229
+
230
+ def _is_partial_str(obj: Any, text: str, /) -> bool:
231
+ return isinstance(obj, str) and (text in obj)
232
+
233
+
234
+ ##
235
+
236
+
237
+ def get_pyproject_dependencies(doc: TOMLDocument, /) -> PyProjectDependencies:
238
+ out = PyProjectDependencies()
239
+ try:
240
+ project = get_table(doc, "project")
241
+ except KeyError:
242
+ pass
243
+ else:
244
+ with suppress(KeyError):
245
+ out.dependencies = get_array(project, "dependencies")
246
+ try:
247
+ opt_dependencies = get_table(project, "optional-dependencies")
248
+ except KeyError:
249
+ pass
250
+ else:
251
+ out.opt_dependencies = {}
252
+ for key in opt_dependencies:
253
+ out.opt_dependencies[ensure_str(key)] = get_array(opt_dependencies, key)
254
+ try:
255
+ dep_grps = get_table(doc, "dependency-groups")
256
+ except KeyError:
257
+ pass
258
+ else:
259
+ out.dep_groups = {}
260
+ for key in dep_grps:
261
+ out.dep_groups[ensure_str(key)] = get_array(dep_grps, key)
262
+ return out
263
+
264
+
265
+ @dataclass(kw_only=True, slots=True)
266
+ class PyProjectDependencies:
267
+ dependencies: Array | None = None
268
+ opt_dependencies: dict[str, Array] | None = None
269
+ dep_groups: dict[str, Array] | None = None
270
+
271
+ def map_array(self, func: TransformArray, /) -> None:
272
+ if (deps := self.dependencies) is not None:
273
+ func(deps)
274
+ if (opt_depedencies := self.opt_dependencies) is not None:
275
+ for deps in opt_depedencies.values():
276
+ func(deps)
277
+ if (dep_grps := self.dep_groups) is not None:
278
+ for deps in dep_grps.values():
279
+ func(deps)
280
+
281
+ def map_requirements(self, func: FuncRequirement, /) -> None:
282
+ if (deps := self.dependencies) is not None:
283
+ self._map_requirements1(deps, func)
284
+ if (opt_depedencies := self.opt_dependencies) is not None:
285
+ for deps in opt_depedencies.values():
286
+ self._map_requirements1(deps, func)
287
+ if (dep_grps := self.dep_groups) is not None:
288
+ for deps in dep_grps.values():
289
+ self._map_requirements1(deps, func)
290
+
291
+ def _map_requirements1(self, array: Array, func: FuncRequirement, /) -> None:
292
+ new: list[str] = []
293
+ for curr_i in array:
294
+ req = Requirement(ensure_str(curr_i))
295
+ new.append(str(func(req)))
296
+ array.clear()
297
+ for new_i in sorted(new):
298
+ array.append(string(new_i))
299
+
300
+
301
+ ##
302
+
303
+
304
+ def get_version_from_path(*, path: PathLike = BUMPVERSION_TOML) -> Version3:
305
+ text = Path(path).read_text()
306
+ return _get_version_from_toml_text(text)
307
+
308
+
309
+ def get_version_origin_master(*, path: PathLike = BUMPVERSION_TOML) -> Version3:
310
+ with suppress(CalledProcessError):
311
+ text = run("git", "tag", "--points-at", "origin/master", return_=True)
312
+ for line in text.splitlines():
313
+ with suppress(Version3Error):
314
+ return Version3.parse(line)
315
+ try:
316
+ text = run("git", "show", f"origin/master:{path}", return_=True)
317
+ except CalledProcessError:
318
+ msg = "Unable to get the version of origin/master"
319
+ raise ValueError(msg) from None
320
+ return _get_version_from_toml_text(text)
321
+
322
+
323
+ def _get_version_from_toml_text(text: str, /) -> Version3:
324
+ try:
325
+ doc = tomlkit.parse(text)
326
+ tool = get_table(doc, "tool")
327
+ bumpversion = get_table(tool, "bumpversion")
328
+ version = bumpversion["current_version"]
329
+ return Version3.parse(str(version))
330
+ except (ParseError, KeyError, Version3Error):
331
+ msg = f"Unable to get the version from {text!r}"
332
+ raise ValueError(msg) from None
333
+
334
+
335
+ ##
336
+
337
+
338
+ def path_throttle_cache(name: str, /) -> Path:
339
+ cwd_name = Path.cwd().name
340
+ return PATH_CACHE / "throttle" / f"{name}--{cwd_name}"
341
+
342
+
343
+ ##
344
+
345
+
346
+ def run_all_maybe_raise(*funcs: Callable[[], bool]) -> None:
347
+ """Run all of a set of jobs."""
348
+
349
+ results = concurrent_map(apply, funcs, parallelism="threads")
350
+ if not all(results):
351
+ raise SystemExit(1)
352
+
353
+
354
+ ##
355
+
356
+
357
+ def run_prettier(path: PathLike, /) -> None:
358
+ with suppress(CalledProcessError):
359
+ run("prettier", "-w", str(path))
360
+
361
+
362
+ def run_taplo(path: PathLike, /) -> None:
363
+ with suppress(CalledProcessError):
364
+ run(
365
+ "taplo",
366
+ "format",
367
+ "--option",
368
+ "indent_tables=true",
369
+ "--option",
370
+ "indent_entries=true",
371
+ "--option",
372
+ "reorder_keys=true",
373
+ str(path),
374
+ )
375
+
376
+
377
+ ##
378
+
379
+
380
+ def set_version(version: Version3, /, *, path: PathLike = BUMPVERSION_TOML) -> None:
381
+ run("bump-my-version", "replace", "--new-version", str(version), str(path))
382
+
383
+
384
+ ##
385
+
386
+
387
+ def write_text(
388
+ path: PathLike, text: str, /, *, modifications: MutableSet[Path] | None = None
389
+ ) -> None:
390
+ with writer(path, overwrite=True) as temp:
391
+ _ = temp.write_text(ensure_new_line(text))
392
+ if modifications is not None:
393
+ modifications.add(Path(path))
394
+
395
+
396
+ ##
397
+
398
+
399
+ @contextmanager
400
+ def yield_immutable_write_context[T](
401
+ path: PathLike,
402
+ loads: Callable[[str], T],
403
+ get_default: Callable[[], T],
404
+ dumps: Callable[[T], str],
405
+ /,
406
+ *,
407
+ modifications: MutableSet[Path] | None = None,
408
+ ) -> Iterator[_WriteContext[T]]:
409
+ try:
410
+ current = Path(path).read_text()
411
+ except FileNotFoundError:
412
+ current = None
413
+ input_ = get_default()
414
+ output = get_default()
415
+ else:
416
+ input_ = loads(current)
417
+ output = loads(current)
418
+ yield (context := _WriteContext(input=input_, output=output))
419
+ if current is None:
420
+ write_text(path, dumps(context.output), modifications=modifications)
421
+ else:
422
+ match context.output, loads(current):
423
+ case Module() as output_module, Module() as current_module:
424
+ if not are_equal_modulo_new_line(
425
+ output_module.code, current_module.code
426
+ ):
427
+ write_text(path, dumps(output_module), modifications=modifications)
428
+ case TOMLDocument() as output_doc, TOMLDocument() as current_doc:
429
+ if not (output_doc == current_doc): # noqa: SIM201
430
+ write_text(path, dumps(output_doc), modifications=modifications)
431
+ case str() as output_text, str() as current_text:
432
+ if not are_equal_modulo_new_line(output_text, current_text):
433
+ write_text(path, dumps(output_text), modifications=modifications)
434
+ case output_obj, current_obj:
435
+ if output_obj != current_obj:
436
+ write_text(path, dumps(output_obj), modifications=modifications)
437
+ case never:
438
+ assert_never(never)
439
+
440
+
441
+ @dataclass(kw_only=True, slots=True)
442
+ class _WriteContext[T]:
443
+ input: T
444
+ output: T
445
+
446
+
447
+ ##
448
+
449
+
450
+ @contextmanager
451
+ def yield_json_dict(
452
+ path: PathLike, /, *, modifications: MutableSet[Path] | None = None
453
+ ) -> Iterator[StrDict]:
454
+ with yield_mutable_write_context(
455
+ path, json.loads, dict, json.dumps, modifications=modifications
456
+ ) as dict_:
457
+ yield dict_
458
+
459
+
460
+ ##
461
+
462
+
463
+ @contextmanager
464
+ def yield_pyproject_toml(
465
+ *, modifications: MutableSet[Path] | None = None
466
+ ) -> Iterator[TOMLDocument]:
467
+ with yield_toml_doc(PYPROJECT_TOML, modifications=modifications) as doc:
468
+ yield doc
469
+
470
+
471
+ ##
472
+
473
+
474
+ @contextmanager
475
+ def yield_mutable_write_context[T](
476
+ path: PathLike,
477
+ loads: Callable[[str], T],
478
+ get_default: Callable[[], T],
479
+ dumps: Callable[[T], str],
480
+ /,
481
+ *,
482
+ modifications: MutableSet[Path] | None = None,
483
+ ) -> Iterator[T]:
484
+ with yield_immutable_write_context(
485
+ path, loads, get_default, dumps, modifications=modifications
486
+ ) as context:
487
+ yield context.output
488
+
489
+
490
+ ##
491
+
492
+
493
+ @contextmanager
494
+ def yield_python_file(
495
+ path: PathLike, /, *, modifications: MutableSet[Path] | None = None
496
+ ) -> Iterator[_WriteContext[Module]]:
497
+ with yield_immutable_write_context(
498
+ path,
499
+ parse_module,
500
+ lambda: Module(body=[]),
501
+ lambda module: module.code,
502
+ modifications=modifications,
503
+ ) as context:
504
+ yield context
505
+
506
+
507
+ ##
508
+
509
+
510
+ @contextmanager
511
+ def yield_text_file(
512
+ path: PathLike, /, *, modifications: MutableSet[Path] | None = None
513
+ ) -> Iterator[_WriteContext[str]]:
514
+ with yield_immutable_write_context(
515
+ path, str, lambda: "", str, modifications=modifications
516
+ ) as context:
517
+ yield context
518
+
519
+
520
+ ##
521
+
522
+
523
+ @contextmanager
524
+ def yield_toml_doc(
525
+ path: PathLike, /, *, modifications: MutableSet[Path] | None = None
526
+ ) -> Iterator[TOMLDocument]:
527
+ with yield_mutable_write_context(
528
+ path, tomlkit.parse, document, tomlkit.dumps, modifications=modifications
529
+ ) as doc:
530
+ yield doc
531
+ run_taplo(path)
532
+
533
+
534
+ ##
535
+
536
+
537
+ @contextmanager
538
+ def yield_yaml_dict(
539
+ path: PathLike,
540
+ /,
541
+ *,
542
+ sort_keys: bool = True,
543
+ modifications: MutableSet[Path] | None = None,
544
+ ) -> Iterator[StrDict]:
545
+ with yield_mutable_write_context(
546
+ path,
547
+ yaml.safe_load,
548
+ dict,
549
+ partial(yaml.safe_dump, sort_keys=sort_keys),
550
+ modifications=modifications,
551
+ ) as dict_:
552
+ yield dict_
553
+ run_prettier(path)
554
+
555
+
556
+ ##
557
+
558
+
559
+ __all__ = [
560
+ "PyProjectDependencies",
561
+ "apply",
562
+ "are_equal_modulo_new_line",
563
+ "ensure_contains",
564
+ "ensure_contains_partial_dict",
565
+ "ensure_contains_partial_str",
566
+ "ensure_new_line",
567
+ "ensure_not_contains",
568
+ "get_aot",
569
+ "get_array",
570
+ "get_dict",
571
+ "get_list_dicts",
572
+ "get_list_strs",
573
+ "get_partial_dict",
574
+ "get_partial_str",
575
+ "get_pyproject_dependencies",
576
+ "get_set_aot",
577
+ "get_set_array",
578
+ "get_set_dict",
579
+ "get_set_list_dicts",
580
+ "get_set_list_strs",
581
+ "get_set_table",
582
+ "get_table",
583
+ "get_version_from_path",
584
+ "get_version_origin_master",
585
+ "path_throttle_cache",
586
+ "run_all_maybe_raise",
587
+ "run_prettier",
588
+ "run_taplo",
589
+ "set_version",
590
+ "write_text",
591
+ "yield_immutable_write_context",
592
+ "yield_json_dict",
593
+ "yield_mutable_write_context",
594
+ "yield_pyproject_toml",
595
+ "yield_python_file",
596
+ "yield_text_file",
597
+ "yield_toml_doc",
598
+ "yield_yaml_dict",
599
+ ]
@@ -1,46 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: dycw-pre-commit-hooks
3
- Version: 0.12.8
4
- Author-email: Derek Wan <d.wan@icloud.com>
5
- Requires-Python: >=3.12
6
- Requires-Dist: click<8.3,>=8.2.1
7
- Requires-Dist: dycw-utilities<0.167,>=0.166.5
8
- Requires-Dist: gitpython<3.2,>=3.1.45
9
- Requires-Dist: libcst<1.9,>=1.8.2
10
- Requires-Dist: loguru<0.8,>=0.7.3
11
- Requires-Dist: more-itertools<10.8,>=10.7.0
12
- Requires-Dist: orjson<3.12,>=3.11.3
13
- Requires-Dist: packaging<25.1,>=25.0
14
- Requires-Dist: tomlkit<0.14,>=0.13.2
15
- Requires-Dist: xdg-base-dirs<6.1,>=6.0.2
16
- Description-Content-Type: text/markdown
17
-
18
- # pre-commit-hooks
19
-
20
- ## Overview
21
-
22
- My [`pre-commit`](https://pre-commit.com/) hooks.
23
-
24
- ## Installation
25
-
26
- 1. Install `pre-commit`.
27
-
28
- 1. Add the following to your `.pre-commit-config.yaml`:
29
-
30
- ```yaml
31
- repos:
32
- - repo: https://github.com/dycw/pre-commit-hooks
33
- rev: master
34
- hooks:
35
- - id: check-submodules
36
- - id: format-requirements
37
- - id: replace-sequence-str
38
- - id: run-bump-my-version
39
- - id: tag-commits
40
- ```
41
-
42
- 1. Update your `.pre-commit-config.yaml`:
43
-
44
- ```bash
45
- pre-commit autoupdate
46
- ```
@@ -1,19 +0,0 @@
1
- pre_commit_hooks/__init__.py,sha256=YLG1ztMLECr37VVZERdQ_nviI-TnuwzwSfl9cBayIv8,59
2
- pre_commit_hooks/common.py,sha256=Ovg0kK5CBSBEalGdVxLKjvRX3gbjpzTFRNRopB8tEiw,4247
3
- pre_commit_hooks/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- pre_commit_hooks/check_submodules/__init__.py,sha256=8aJ6sbDclOML5uahK4TNf80Sxf6gCx1kIOYwkv37g9s,1092
5
- pre_commit_hooks/check_submodules/__main__.py,sha256=foSVebwCfSkKcAc3cD5YTzkmrWd7Wso9_mR9-zuyG-o,153
6
- pre_commit_hooks/format_requirements/__init__.py,sha256=dORQ5sNZaOWYY6cw0X1YIic4OHZeTt9EhI21D1uQFyE,3322
7
- pre_commit_hooks/format_requirements/__main__.py,sha256=15JSp_rhjI_Ddoj4MRkHFShfnYxs6GggUhLRlGtrQ0E,156
8
- pre_commit_hooks/mirror_files/__init__.py,sha256=XUmUYHz4otEF5wIK8X0ntH0vkYFBmJwJfXkI8Bz3n0I,1682
9
- pre_commit_hooks/mirror_files/__main__.py,sha256=YzOSNKR2XrVST5dgIVJrpRL28QkcziciOomuKtVX7Jo,149
10
- pre_commit_hooks/replace_sequence_str/__init__.py,sha256=nDjiKV14th2uWbnte1rSvXckysl7ooaLgWo6IP4HI2s,1618
11
- pre_commit_hooks/replace_sequence_str/__main__.py,sha256=B1dxOxngV4vUVnDVrXSywiySOs1P_zF30_4ZMRsOSaY,157
12
- pre_commit_hooks/run_bump_my_version/__init__.py,sha256=OsMY0boz3VTqAtgLCHtC8AvCXx6OYvOXA5H-VAwBFoY,1444
13
- pre_commit_hooks/run_bump_my_version/__main__.py,sha256=w2V3y61jrSau-zxjl8ciHtWPlJQwXbYxNJ2tGYVyI4s,156
14
- pre_commit_hooks/tag_commits/__init__.py,sha256=097p0gfZcykpOPUgGYsrLePe8Nar04eKlCMn_mqPepg,2945
15
- pre_commit_hooks/tag_commits/__main__.py,sha256=qefgYw7LWbvmzZS45-ym6olS4cHqw1Emw2wlqZBXN_o,148
16
- dycw_pre_commit_hooks-0.12.8.dist-info/METADATA,sha256=SPMmd6uxKS3rmwv3zR0RGgv44Py_NYMGWom8R7kIlcI,1105
17
- dycw_pre_commit_hooks-0.12.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
- dycw_pre_commit_hooks-0.12.8.dist-info/entry_points.txt,sha256=0xGzim6HTjeOXJpusYjBk0aEYkXQR2IwrmfzM6KT_r0,368
19
- dycw_pre_commit_hooks-0.12.8.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- [console_scripts]
2
- check-submodules = pre_commit_hooks.check_submodules:main
3
- format-requirements = pre_commit_hooks.format_requirements:main
4
- mirror-files = pre_commit_hooks.mirror_files:main
5
- replace-sequence-str = pre_commit_hooks.replace_sequence_str:main
6
- run-bump-my-version = pre_commit_hooks.run_bump_my_version:main
7
- tag-commits = pre_commit_hooks.tag_commits:main