-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
monkey patch pydantic_core.Url for str concatentation
- Loading branch information
1 parent
33c9b38
commit 6bd788b
Showing
5 changed files
with
25 additions
and
4 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,16 @@ | ||
from pydantic_core import Url | ||
|
||
|
||
def __add__(self, other): | ||
return str(self) + other | ||
|
||
|
||
def __radd__(self, other): | ||
return other + str(self) | ||
|
||
|
||
# monkey patch string concatentation until pydantic implements Url as an extension of str again | ||
# https://github.com/pydantic/pydantic-core/pull/1126 | ||
|
||
Url.__add__ = __add__ | ||
Url.__radd__ = __radd__ |
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