88from pathlib import Path
99
1010import 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
2323def pytask_collect (session ):
2424 reports = _collect_from_paths (session )
2525 tasks = _extract_tasks_from_reports (reports )
@@ -66,13 +66,13 @@ def _collect_from_paths(session):
6666 return collected_reports
6767
6868
69- @pytask . hookimpl
69+ @hookimpl
7070def pytask_ignore_collect (path , config ):
7171 ignored = any (fnmatch .fnmatch (path , pattern ) for pattern in config ["ignore" ])
7272 return ignored
7373
7474
75- @pytask . hookimpl
75+ @hookimpl
7676def pytask_collect_file_protocol (session , path , reports ):
7777 try :
7878 reports = session .hook .pytask_collect_file (
@@ -85,7 +85,7 @@ def pytask_collect_file_protocol(session, path, reports):
8585 return reports
8686
8787
88- @pytask . hookimpl
88+ @hookimpl
8989def pytask_collect_file (session , path , reports ):
9090 if path .name .startswith ("task_" ) and path .suffix == ".py" :
9191 spec = importlib .util .spec_from_file_location (path .stem , str (path ))
@@ -115,7 +115,7 @@ def pytask_collect_file(session, path, reports):
115115 return collected_reports
116116
117117
118- @pytask . hookimpl
118+ @hookimpl
119119def pytask_collect_task_protocol (session , reports , path , name , obj ):
120120 try :
121121 session .hook .pytask_collect_task_setup (
@@ -132,7 +132,7 @@ def pytask_collect_task_protocol(session, reports, path, name, obj):
132132 return CollectionReportTask .from_exception (path , name , exc_info )
133133
134134
135- @pytask . hookimpl (trylast = True )
135+ @hookimpl (trylast = True )
136136def pytask_collect_task_setup (session , reports , path , name ):
137137 paths_to_tasks_w_ident_name = [
138138 i .path .as_posix ()
@@ -148,7 +148,7 @@ def pytask_collect_task_setup(session, reports, path, name):
148148 )
149149
150150
151- @pytask . hookimpl (trylast = True )
151+ @hookimpl (trylast = True )
152152def pytask_collect_task (session , path , name , obj ):
153153 """Collect a task which is a function.
154154
@@ -163,7 +163,7 @@ def pytask_collect_task(session, path, name, obj):
163163 )
164164
165165
166- @pytask . hookimpl (trylast = True )
166+ @hookimpl (trylast = True )
167167def pytask_collect_node (path , node ):
168168 """Collect a node of a task as a :class:`pytask.nodes.FilePathNode`.
169169
@@ -219,7 +219,7 @@ def _extract_tasks_from_reports(reports):
219219 return [i .task for i in reports if i .successful ]
220220
221221
222- @pytask . hookimpl
222+ @hookimpl
223223def pytask_collect_log (session , reports , tasks ):
224224 tm_width = session .config ["terminal_width" ]
225225
0 commit comments