Skip to content

Commit 6d0795a

Browse files
committed
bugfix
1 parent 8b7792a commit 6d0795a

File tree

6 files changed

+20
-9
lines changed

6 files changed

+20
-9
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
project = "LeanDojo"
1414
copyright = "2023, LeanDojo Team"
1515
author = "Kaiyu Yang"
16-
release = "2.1.2"
16+
release = "2.1.3"
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/source/developer-guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ We use `pytest <https://docs.pytest.org/>`_ for testing. You can run tests by:
2121

2222
.. code-block:: bash
2323
24-
VERBOSE=1 CACHE_DIR=~/.cache/lean_dojo_testing DISABLE_REMOTE_CACHE=1 pytest -s tests
2524
rm -rf ~/.cache/lean_dojo_testing
25+
VERBOSE=1 CACHE_DIR=~/.cache/lean_dojo_testing DISABLE_REMOTE_CACHE=1 pytest -s tests
2626
2727
The environment variable :code:`CACHE_DIR` makes sure the testing uses a temporary cache directory that
2828
does not interfere with the deployed code. The temporary cache directory is deleted after the testing completes.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exclude = [
1212

1313
[project]
1414
name = "lean-dojo"
15-
version = "2.1.2"
15+
version = "2.1.3"
1616
authors = [
1717
{ name="Kaiyu Yang", email="kaiyuy@meta.com" },
1818
]

src/lean_dojo/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
load_dotenv()
1616

17-
__version__ = "2.1.2"
17+
__version__ = "2.1.3"
1818

1919
logger.remove()
2020
if "VERBOSE" in os.environ or "DEBUG" in os.environ:

src/lean_dojo/data_extraction/lean.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
LEAN4_REPO = None
5151
"""The GitHub Repo for Lean 4 itself."""
5252

53+
LEAN4_NIGHTLY_REPO = None
54+
"""The GitHub Repo for Lean 4 nightly releases."""
55+
5356
_URL_REGEX = re.compile(r"(?P<url>.*?)/*")
5457

5558
_SSH_TO_HTTPS_REGEX = re.compile(r"^git@github\.com:(.+)/(.+)(?:\.git)?$")
@@ -327,17 +330,19 @@ def start_pos(self) -> Pos:
327330
def end_pos(self) -> Pos:
328331
"""Return the end position of a source file.
329332
330-
Args:
331-
zero_indexed (bool, optional): Whether to use 0-index instead of 1-index. Defaults to False.
332-
333333
Returns:
334334
Pos: A :class:`Pos` object representing the end of this file.
335335
"""
336336
# Line and column numbers are 1-indexed by default.
337+
if self.is_empty():
338+
return self.start_pos
337339
line_nb = self.num_lines
338340
column_nb = 1 + len(self.code[-1])
339341
return Pos(line_nb, column_nb)
340342

343+
def is_empty(self) -> bool:
344+
return len(self.code) == 0
345+
341346
def convert_pos(self, byte_idx: int) -> Pos:
342347
"""Convert a byte index (:code:`String.Pos` in Lean 4) to a :class:`Pos` object."""
343348
n = 0
@@ -442,7 +447,13 @@ def get_lean4_commit_from_config(config_dict: Dict[str, Any]) -> str:
442447
prefix = "leanprover/lean4:"
443448
assert config.startswith(prefix), f"Invalid Lean 4 version: {config}"
444449
version = config[len(prefix) :]
445-
return _to_commit_hash(LEAN4_REPO, version)
450+
if version.startswith("nightly-"):
451+
global LEAN4_NIGHTLY_REPO
452+
if LEAN4_NIGHTLY_REPO is None:
453+
LEAN4_NIGHTLY_REPO = GITHUB.get_repo("leanprover/lean4-nightly")
454+
return _to_commit_hash(LEAN4_NIGHTLY_REPO, version)
455+
else:
456+
return _to_commit_hash(LEAN4_REPO, version)
446457

447458

448459
URL = str

src/lean_dojo/data_extraction/traced_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ def _callback(node: ModuleImportNode, _) -> None:
839839
def get_premise_definitions(self) -> List[Dict[str, Any]]:
840840
"""Return all theorems and definitions defined in the current file that
841841
can be potentially used as premises, including the premises in the theorem
842-
statement and premises in the tactics used to prove the theorem.
842+
statement and premises in the tactics used to prove the theorem.
843843
844844
Returns:
845845
List[Dict[str, Any]]: _description_

0 commit comments

Comments
 (0)