-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor wiki: create functions, better logs and names (#2242)
- Loading branch information
1 parent
9d4d382
commit 449ed28
Showing
3 changed files
with
139 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
from dataclasses import dataclass | ||
from pathlib import Path | ||
|
||
|
||
@dataclass(frozen=True) | ||
class Config: | ||
wiki_dir: Path | ||
hist_lines_dir: Path | ||
manifests_dir: Path | ||
|
||
repository: str | ||
allow_no_files: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
from pathlib import Path | ||
|
||
|
||
def get_manifest_timestamp(manifest_file: Path) -> str: | ||
file_content = manifest_file.read_text() | ||
TIMESTAMP_PREFIX = "Build timestamp: " | ||
TIMESTAMP_LENGTH = 20 | ||
timestamp = file_content[ | ||
file_content.find(TIMESTAMP_PREFIX) + len(TIMESTAMP_PREFIX) : | ||
][:TIMESTAMP_LENGTH] | ||
# Should be good enough till year 2100 | ||
assert timestamp.startswith("20"), timestamp | ||
assert timestamp.endswith("Z"), timestamp | ||
return timestamp | ||
|
||
|
||
def get_manifest_year_month(manifest_file: Path) -> str: | ||
return get_manifest_timestamp(manifest_file)[:7] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters