yardstick-predict 0.4.0__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.
@@ -0,0 +1,35 @@
1
+ """Forecast how long a coding-agent task will take and what it will cost, before it runs."""
2
+
3
+ import os
4
+ import sys
5
+
6
+ __version__ = "0.4.0"
7
+
8
+
9
+ def _keep_the_current_folder_out(argv: list[str] | None = None) -> None:
10
+ """When Python runs one of this package's modules with -m, keep the folder it started in off the import path.
11
+
12
+ Python's -m puts that folder first, so a file there, such as a project's own json.py, would be imported in
13
+ place of Python's own. The commands this package installs start Python with -P, which keeps the folder
14
+ out. Commands installed by older versions don't, so this takes the folder out before the package imports
15
+ anything else. A file that Python itself loads before this package can still get in, so installing the
16
+ commands again is the real fix.
17
+ """
18
+ if sys.flags.safe_path:
19
+ return
20
+ argv = list(getattr(sys, "orig_argv", [])) if argv is None else argv
21
+ try:
22
+ module = argv[argv.index("-m", 1) + 1]
23
+ except (ValueError, IndexError):
24
+ return
25
+ if module.split(".")[0] != __name__:
26
+ return
27
+ try:
28
+ here = os.getcwd()
29
+ except OSError:
30
+ here = None
31
+ if sys.path and sys.path[0] in ("", here):
32
+ del sys.path[0]
33
+
34
+
35
+ _keep_the_current_folder_out()
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ sys.exit(main())