8
8
from pathlib import Path
9
9
10
10
import click
11
- import pytask
12
- from pytask .exceptions import CollectionError
13
- from pytask .exceptions import TaskDuplicatedError
14
- from pytask . mark_ import has_marker
15
- from pytask .nodes import FilePathNode
16
- from pytask .nodes import PythonFunctionTask
17
- from pytask .report import CollectionReport
18
- from pytask .report import CollectionReportFile
19
- from pytask .report import CollectionReportTask
20
-
21
-
22
- @pytask . hookimpl
11
+ from _pytask . config import hookimpl
12
+ from _pytask .exceptions import CollectionError
13
+ from _pytask .exceptions import TaskDuplicatedError
14
+ from _pytask . mark import has_marker
15
+ from _pytask .nodes import FilePathNode
16
+ from _pytask .nodes import PythonFunctionTask
17
+ from _pytask .report import CollectionReport
18
+ from _pytask .report import CollectionReportFile
19
+ from _pytask .report import CollectionReportTask
20
+
21
+
22
+ @hookimpl
23
23
def pytask_collect (session ):
24
24
reports = _collect_from_paths (session )
25
25
tasks = _extract_tasks_from_reports (reports )
@@ -66,13 +66,13 @@ def _collect_from_paths(session):
66
66
return collected_reports
67
67
68
68
69
- @pytask . hookimpl
69
+ @hookimpl
70
70
def pytask_ignore_collect (path , config ):
71
71
ignored = any (fnmatch .fnmatch (path , pattern ) for pattern in config ["ignore" ])
72
72
return ignored
73
73
74
74
75
- @pytask . hookimpl
75
+ @hookimpl
76
76
def pytask_collect_file_protocol (session , path , reports ):
77
77
try :
78
78
reports = session .hook .pytask_collect_file (
@@ -85,7 +85,7 @@ def pytask_collect_file_protocol(session, path, reports):
85
85
return reports
86
86
87
87
88
- @pytask . hookimpl
88
+ @hookimpl
89
89
def pytask_collect_file (session , path , reports ):
90
90
if path .name .startswith ("task_" ) and path .suffix == ".py" :
91
91
spec = importlib .util .spec_from_file_location (path .stem , str (path ))
@@ -115,7 +115,7 @@ def pytask_collect_file(session, path, reports):
115
115
return collected_reports
116
116
117
117
118
- @pytask . hookimpl
118
+ @hookimpl
119
119
def pytask_collect_task_protocol (session , reports , path , name , obj ):
120
120
try :
121
121
session .hook .pytask_collect_task_setup (
@@ -132,7 +132,7 @@ def pytask_collect_task_protocol(session, reports, path, name, obj):
132
132
return CollectionReportTask .from_exception (path , name , exc_info )
133
133
134
134
135
- @pytask . hookimpl (trylast = True )
135
+ @hookimpl (trylast = True )
136
136
def pytask_collect_task_setup (session , reports , path , name ):
137
137
paths_to_tasks_w_ident_name = [
138
138
i .path .as_posix ()
@@ -148,7 +148,7 @@ def pytask_collect_task_setup(session, reports, path, name):
148
148
)
149
149
150
150
151
- @pytask . hookimpl (trylast = True )
151
+ @hookimpl (trylast = True )
152
152
def pytask_collect_task (session , path , name , obj ):
153
153
"""Collect a task which is a function.
154
154
@@ -163,7 +163,7 @@ def pytask_collect_task(session, path, name, obj):
163
163
)
164
164
165
165
166
- @pytask . hookimpl (trylast = True )
166
+ @hookimpl (trylast = True )
167
167
def pytask_collect_node (path , node ):
168
168
"""Collect a node of a task as a :class:`pytask.nodes.FilePathNode`.
169
169
@@ -219,7 +219,7 @@ def _extract_tasks_from_reports(reports):
219
219
return [i .task for i in reports if i .successful ]
220
220
221
221
222
- @pytask . hookimpl
222
+ @hookimpl
223
223
def pytask_collect_log (session , reports , tasks ):
224
224
tm_width = session .config ["terminal_width" ]
225
225
0 commit comments