-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor file paths and URLs handling
- Loading branch information
Showing
8 changed files
with
31 additions
and
22 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,6 @@ | ||
from deciphon_core.schema import FilePath | ||
from pydantic import TypeAdapter | ||
|
||
|
||
def file_path(x: FilePath): | ||
return TypeAdapter(FilePath).validate_python(x) |
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
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
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
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
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
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import urllib.parse | ||
from deciphonctl import settings | ||
from pydantic import HttpUrl | ||
|
||
|
||
def url(endpoint: str): | ||
return urllib.parse.urljoin(settings.sched_url.unicode_string(), endpoint) | ||
from pydantic import HttpUrl, TypeAdapter | ||
|
||
|
||
def url_filename(url: HttpUrl): | ||
path = url.path | ||
assert isinstance(path, str) | ||
return path.split("/")[-1] | ||
|
||
|
||
def http_url(url: str): | ||
return TypeAdapter(HttpUrl).validate_strings(url) |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "deciphonctl" | ||
version = "0.4.1" | ||
version = "0.4.2" | ||
description = "Control Deciphon server." | ||
authors = ["Danilo Horta <[email protected]>"] | ||
license = "MIT" | ||
|