FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pre-commit/pre_commit/hook.py at main · pre-commit/pre-commit · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
pre-commit
/
pre-commit
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
1k
Star
15.5k
Code
Issues
18
Pull requests
8
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
pre-commit
/
pre_commit
/
hook.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (51 loc) · 1.48 KB
Breadcrumbs
pre-commit
/
pre_commit
/
hook.py
Copy path
File metadata and controls
60 lines (51 loc) · 1.48 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from
__future__
import
annotations
import
logging
from
collections
.
abc
import
Sequence
from
typing
import
Any
from
typing
import
NamedTuple
from
pre_commit
.
prefix
import
Prefix
logger
=
logging
.
getLogger
(
'pre_commit'
)
class
Hook
(
NamedTuple
):
src
:
str
prefix
:
Prefix
id
:
str
name
:
str
entry
:
str
language
:
str
alias
:
str
files
:
str
exclude
:
str
types
:
Sequence
[
str
]
types_or
:
Sequence
[
str
]
exclude_types
:
Sequence
[
str
]
additional_dependencies
:
Sequence
[
str
]
args
:
Sequence
[
str
]
always_run
:
bool
fail_fast
:
bool
pass_filenames
:
bool
description
:
str
language_version
:
str
log_file
:
str
minimum_pre_commit_version
:
str
require_serial
:
bool
stages
:
Sequence
[
str
]
verbose
:
bool
@
property
def
install_key
(
self
)
->
tuple
[
Prefix
,
str
,
str
,
tuple
[
str
, ...]]:
return
(
self
.
prefix
,
self
.
language
,
self
.
language_version
,
tuple
(
self
.
additional_dependencies
),
)
@
classmethod
def
create
(
cls
,
src
:
str
,
prefix
:
Prefix
,
dct
:
dict
[
str
,
Any
])
->
Hook
:
# TODO: have cfgv do this (?)
extra_keys
=
set
(
dct
)
-
_KEYS
if
extra_keys
:
logger
.
warning
(
f'Unexpected key(s) present on
{
src
}
=>
{
dct
[
"id"
]
}
: '
f'
{
", "
.
join
(
sorted
(
extra_keys
))
}
'
,
)
return
cls
(
src
=
src
,
prefix
=
prefix
,
**
{
k
:
dct
[
k
]
for
k
in
_KEYS
})
_KEYS
=
frozenset
(
set
(
Hook
.
_fields
)
-
{
'src'
,
'prefix'
})
Back
|
FazBrowse Home
|
New Git URL