qlever 0.4.2__py3-none-any.whl → 0.4.4__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.

Potentially problematic release.


This version of qlever might be problematic. Click here for more details.

qlever/__init__.py CHANGED
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import sys
2
4
  from pathlib import Path
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import shlex
2
4
  import subprocess
3
5
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import subprocess
2
4
  from pathlib import Path
3
5
 
qlever/config.py CHANGED
@@ -3,8 +3,9 @@ from __future__ import annotations
3
3
  import argparse
4
4
  import os
5
5
  import traceback
6
- from pathlib import Path
7
6
  from importlib.metadata import version
7
+ from pathlib import Path
8
+ from termcolor import colored
8
9
 
9
10
  import argcomplete
10
11
 
@@ -115,17 +116,11 @@ class QleverConfig:
115
116
  argcomplete_enabled = os.environ.get("QLEVER_ARGCOMPLETE_ENABLED")
116
117
  if not argcomplete_enabled and not argcomplete_check_off:
117
118
  log.info("")
118
- log.warn(f"Autocompletion is not enabled for this script, run "
119
- f"the following command, and consider adding it to your "
120
- f"`.bashrc` or `.zshrc`:"
119
+ log.warn(f"To enable autocompletion, run the following command, "
120
+ f"and consider adding it to your `.bashrc` or `.zshrc`:"
121
121
  f"\n\n"
122
122
  f"eval \"$(register-python-argcomplete {script_name})\""
123
- f" && export QLEVER_ARGCOMPLETE_ENABLED=1"
124
- f"\n\n"
125
- f"If autocompletion does not work for you or you don't "
126
- f"want to use it, disable this warning as follows:"
127
- f"\n\n"
128
- f"export QLEVER_ARGCOMPLETE_CHECK_OFF")
123
+ f" && export QLEVER_ARGCOMPLETE_ENABLED=1")
129
124
  log.info("")
130
125
 
131
126
  # Create a temporary parser only to parse the `--qleverfile` option, in
@@ -180,7 +175,10 @@ class QleverConfig:
180
175
  # command. We have a dedicated class for each command. These classes
181
176
  # are defined in the modules in `qlever/commands`. In `__init__.py`
182
177
  # an object of each class is created and stored in `command_objects`.
183
- parser = argparse.ArgumentParser()
178
+ parser = argparse.ArgumentParser(
179
+ description=colored("This is the qlever command line tool, "
180
+ "it's all you need to work with QLever",
181
+ attrs=["bold"]))
184
182
  parser.add_argument("--version", action="version",
185
183
  version=f"%(prog)s {version('qlever')}")
186
184
  add_qleverfile_option(parser)
@@ -198,6 +196,11 @@ class QleverConfig:
198
196
  # because it is executed whenever the user triggers the autocompletion.
199
197
  argcomplete.autocomplete(parser, always_complete_options="long")
200
198
 
199
+ # If called without arguments, show the help message.
200
+ if len(os.sys.argv) == 1:
201
+ parser.print_help()
202
+ exit(1)
203
+
201
204
  # Parse the command line arguments.
202
205
  args = parser.parse_args()
203
206
 
qlever/log.py CHANGED
@@ -1,6 +1,4 @@
1
- # Copyright 2024, University of Freiburg,
2
- # Chair of Algorithms and Data Structures
3
- # Author: Hannah Bast <bast@cs.uni-freiburg.de>
1
+ from __future__ import annotations
4
2
 
5
3
  import logging
6
4
  from contextlib import contextmanager
qlever/qlever_main.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # Chair of Algorithms and Data Structures
6
6
  # Author: Hannah Bast <bast@cs.uni-freiburg.de>
7
7
 
8
+ from __future__ import annotations
9
+
8
10
  import re
9
11
  import traceback
10
12